➜ Heavy Round-Tipped Rightwards Arrow (U+279C) scalling in AtlasEngine #18582

Closed
opened 2026-01-31 06:18:24 +00:00 by claunia · 2 comments
Owner

Originally created by @kasper93 on GitHub (Oct 2, 2022).

Windows Terminal version

54dc2c4

Windows build number

10.0.19044.0

Other Software

No response

Steps to reproduce

  1. Paste

Expected Behavior

  1. Glyph is centered
  2. Glyph is not truncated

Actual Behavior

  1. Glyph is not centered
  2. Glyph is truncated

Before we start I want to say that I have this arrow in my zsh prompt that's why even small issues are noticeable looking at this all the time :)

There are two issues:

  • After scaling glyphs are not properly centered vertically. Enlarged for dramatic effect:

EDIT: ...and after writing all this, I noticed that this is expected behavior after 97dc5c8d75 Well I'm still complaining, my prompt (not on screenshots) looks ugly and I don't like this new behavior :( Mintty renders it centered.

image
Without scaling it is centered, although truncated. Basically this:

diff --git a/src/renderer/atlas/AtlasEngine.r.cpp b/src/renderer/atlas/AtlasEngine.r.cpp
index 73d6a7092..28008df05 100644
--- a/src/renderer/atlas/AtlasEngine.r.cpp
+++ b/src/renderer/atlas/AtlasEngine.r.cpp
@@ -636,6 +636,7 @@ AtlasEngine::CachedGlyphLayout AtlasEngine::_getCachedGlyphLayout(const wchar_t*
             scale.x = layoutBox.x / actualSizeX;
             scale.y = scale.x;
             scaleCenter.x = layoutBox.x * 0.5f;
+            scaleCenter.y = layoutBox.y * 0.5f;
         }
         if (overhang.top > _r.dipPerPixel || overhang.bottom > _r.dipPerPixel)
         {

With patch:
image

  • Second issue is more tricky. Basically what we do is to scale glyph to fit perfectly in the layout box. But it doesn't work nicely. If you look closely at the screenshots you will notice that both tail and the tip of the arrow is truncated by 1 or 2 pixels. I know it is very nitpicky and actually hard to show, sorry for that. It is more noticeable on normal smaller fonts where we have less pixels. Anyway I haven't read whole code, maybe there is clever way to round down scaling factor so it is always safe to apply, for my local build I just added safe margin around glyph, so that scaling never puts arrow outside allowed area.
    Without margin, tip is flat:
    image
    With margin, tip is nicely round:
    image

I personally think that having such margin/padding (depending how you look at it ;p) is better overall, even tho we are not using 100% of available space, in turn we are not actually overhanging ever due to scaling. But hey, there is probably better way to handle this (round/floor somewhere), I just quickly made the change for this report needs.

EDIT: Maybe we go out of the layout box because of anti-aliasing? Because I think it can alter surrounding (sub)pixels, but if we are exactly on the border and clip it would look worse?

Again sorry, for being nitpicky here, but I think we can make rendering nicer. Or if this is expected look and feel, at least I will know that I tried.

Thanks,
Kacper

/CC @lhecker

Originally created by @kasper93 on GitHub (Oct 2, 2022). ### Windows Terminal version 54dc2c4 ### Windows build number 10.0.19044.0 ### Other Software _No response_ ### Steps to reproduce 1. Paste `➜` ### Expected Behavior 1. Glyph is centered 2. Glyph is not truncated ### Actual Behavior 1. Glyph is not centered 2. Glyph is truncated Before we start I want to say that I have this arrow in my zsh prompt that's why even small issues are noticeable looking at this all the time :) There are two issues: * After scaling glyphs are not properly centered vertically. Enlarged for dramatic effect: EDIT: ...and after writing all this, I noticed that this is expected behavior after https://github.com/microsoft/terminal/commit/97dc5c8d754495d68996d341df961c9515b05804 Well I'm still complaining, my prompt (not on screenshots) looks ugly and I don't like this new behavior :( Mintty renders it centered. ![image](https://user-images.githubusercontent.com/1126053/193429072-f371bf6f-b4c1-4601-bb3e-3c2b369ae3ae.png) Without scaling it is centered, although truncated. Basically this: ``` diff diff --git a/src/renderer/atlas/AtlasEngine.r.cpp b/src/renderer/atlas/AtlasEngine.r.cpp index 73d6a7092..28008df05 100644 --- a/src/renderer/atlas/AtlasEngine.r.cpp +++ b/src/renderer/atlas/AtlasEngine.r.cpp @@ -636,6 +636,7 @@ AtlasEngine::CachedGlyphLayout AtlasEngine::_getCachedGlyphLayout(const wchar_t* scale.x = layoutBox.x / actualSizeX; scale.y = scale.x; scaleCenter.x = layoutBox.x * 0.5f; + scaleCenter.y = layoutBox.y * 0.5f; } if (overhang.top > _r.dipPerPixel || overhang.bottom > _r.dipPerPixel) { ``` With patch: ![image](https://user-images.githubusercontent.com/1126053/193429335-13f6614d-8260-49d1-9961-fe48e0944a10.png) * Second issue is more tricky. Basically what we do is to scale glyph to fit perfectly in the layout box. But it doesn't work nicely. If you look closely at the screenshots you will notice that both tail and the tip of the arrow is truncated by 1 or 2 pixels. I know it is very nitpicky and actually hard to show, sorry for that. It is more noticeable on normal smaller fonts where we have less pixels. Anyway I haven't read whole code, maybe there is clever way to round down scaling factor so it is always safe to apply, for my local build I just added safe margin around glyph, so that scaling never puts arrow outside allowed area. Without margin, tip is flat: ![image](https://user-images.githubusercontent.com/1126053/193430099-0cf307b8-3f89-4742-9284-eb128998ddf2.png) With margin, tip is nicely round: ![image](https://user-images.githubusercontent.com/1126053/193430114-09736ba3-8e73-48a4-98f4-bfa41a6b29f7.png) I personally think that having such margin/padding (depending how you look at it ;p) is better overall, even tho we are not using 100% of available space, in turn we are not actually overhanging ever due to scaling. But hey, there is probably better way to handle this (round/floor somewhere), I just quickly made the change for this report needs. EDIT: Maybe we go out of the layout box because of anti-aliasing? Because I think it can alter surrounding (sub)pixels, but if we are exactly on the border and clip it would look worse? Again sorry, for being nitpicky here, but I think we can make rendering nicer. Or if this is expected look and feel, at least I will know that I tried. Thanks, Kacper /CC @lhecker
Author
Owner

@lhecker commented on GitHub (Oct 3, 2022):

I'm very sorry it looks ugly. 😔
I consciously centered these glyphs vertically initially so that arrows like that don't look "off axis", but as you probably already read in the commit you linked, that lead to some other issues with italic text among others. So what I'm doing now is to work on a new version of AtlasEngine which uses freely places glyph quads which allows for overlapping glyphs:
image

You seem to have compiled your own Windows Terminal right? If you'd like, you can check this new-new renderer out in my dev/lhecker/atlas-engine-remastered branch (but it's still work in progress). BTW did you know that you can set the "Host.EXE" project as a startup project and it'll launch OpenConsole, aka conhost? If you do that and set this registry key you can use AtlasEngine without compiling all of Windows Terminal first which can take quite a while because of WinUI:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Console]
"UseDx"=dword:00000002

That said I believe this issue could be considered a duplicate of #6864. Would you agree with that?

@lhecker commented on GitHub (Oct 3, 2022): I'm very sorry it looks ugly. 😔 I consciously centered these glyphs vertically initially so that arrows like that don't look "off axis", but as you probably already read in the commit you linked, that lead to some other issues with italic text among others. So what I'm doing now is to work on a new version of AtlasEngine which uses freely places glyph quads which allows for overlapping glyphs: <img width="392" alt="image" src="https://user-images.githubusercontent.com/2256941/193489754-647ecaa8-e65b-44db-993d-146ad955fc49.png"> You seem to have compiled your own Windows Terminal right? If you'd like, you can check this new-new renderer out in my `dev/lhecker/atlas-engine-remastered` branch (but it's still work in progress). BTW did you know that you can set the "Host.EXE" project as a startup project and it'll launch OpenConsole, aka conhost? If you do that and set this registry key you can use AtlasEngine without compiling all of Windows Terminal first which can take quite a while because of WinUI: ``` Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Console] "UseDx"=dword:00000002 ``` That said I believe this issue could be considered a duplicate of #6864. Would you agree with that?
Author
Owner

@ghost commented on GitHub (Oct 9, 2022):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Oct 9, 2022): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18582