Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit fractional 0.5 sized font scaling #6678

Closed
musm opened this issue Jun 25, 2020 · 24 comments · Fixed by #14013
Closed

Permit fractional 0.5 sized font scaling #6678

musm opened this issue Jun 25, 2020 · 24 comments · Fixed by #14013
Assignees
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@musm
Copy link

musm commented Jun 25, 2020

Description of the new feature/enhancement

Allow users to set font sizes in 0.5 increments, e.g.:

            "fontSize": 8.5

half-point differences are meaningful at this scale.

1

@musm musm added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jun 25, 2020
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 25, 2020
@DHowett
Copy link
Member

DHowett commented Jun 25, 2020

Fractional point sizes are sufficiently rare in the wild that I’ll have to ask:
Why?

@musm
Copy link
Author

musm commented Jun 25, 2020

Vs Code permits fractional sizing, because the jump between 8 and 9 is quite drastic, especially on some fonts.
half-point differences are meaningful at this scale.

For example, Cascadia Code looks terrible at size 8
image

At size 9 it looks much better, but takes up too much space

image

@DHowett
Copy link
Member

DHowett commented Jun 26, 2020

Alright, sure, I'll throw this on the backlog. This will require a good amount of renderer changes, as that's a shared component with conhost and we've always only ever supported integral sizes.

A font's presentation should not vary so wildly between 8.5 and 9 (which, I might add, is only 1/144 of an inch of difference [1]). What you're probably seeing is a difference in hinting. If the font is hinted at 8 and hinted differently at 9, 8.5 is probably totally unhinted and you're getting raw geometries?

[1] Given that 1pt is 1/72", 0.5pt is 1/144". That is imperceptibly small. Imperceptibly!

@DHowett
Copy link
Member

DHowett commented Jun 26, 2020

Honestly, it might be easier to add a setting to turn off hinting. That would get you the 8.5 behavior at 8 or at 9.

@DHowett DHowett added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Area-Settings Issues related to settings and customizability, for console or terminal Priority-3 A description (P3) Product-Terminal The new Windows Terminal. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 26, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jun 26, 2020
@DHowett DHowett added this to the Terminal Backlog milestone Jun 26, 2020
@aaronbell
Copy link

@DHowett Most likely @musm's setup (aka DPI, scaling factor, rasterization) is such that switching from 8pt to 9pt causes the renderer to round up versus round down, thus making everything larger.

To be honest, I don't know if adding fractional point sizes will help. Ultimately the rasterizer is still going to try and lock the glyphs to a whole pixel, so it'll just guess up or down. As you posited, disabling hinting might be the easier fix as I expect the 9pt wouldn't jump up quite so significantly.

However, it comes at the cost of blurrier text, so it'd definitely be a "use at your own risk" sort of thing!

@musm
Copy link
Author

musm commented Jul 30, 2020

@aaronbell Interesting theory. Do you why this would only apply to Cascadia Code and not other fonts? Personally I'd love to use it but I'm stuck in a gray zone where size 8 is too small and size 9 is way too large.

DPI: Well I'm running 100% no scaling at all.

@aaronbell
Copy link

@musm Out of interest, do you happen to have a 72 DPI screen? I suddenly remembered something :)

In Cascadia Code, there is what's called a GASP table which tells the rasterizer when to turn on / off hinting, and what kind of rasterization approach to use. Right now the GASP table instructions are set to turn on hinting at 9ppem (which equated to 9pt on a 72DPI screen) and above. This setting is following the recommendation of the font rasterization experts at Microsoft.

So what could be happening is that when you switch over to 9pt, the hinting is kicking in to help the font render more sharply and it is making the letters bigger. This may not happen for other fonts because their GASP tables are set differently.

@musm
Copy link
Author

musm commented Jul 30, 2020

According to https://dpi.lv/

image

@aaronbell
Copy link

🤔

@musm
Copy link
Author

musm commented Nov 7, 2020

I'm still puzzled by the drastic jump in font size between size 8 and 7. Especially compared to, say, VS Code.

1

@danielniccoli
Copy link

danielniccoli commented Nov 13, 2020

I'm on the same boat. Something is off with the font rendering and I often enough wished that I could have the font size that is just in-between 10 and 11, or 11 and 12.

@jojje
Copy link

jojje commented Nov 15, 2020

I too have used Consolas at size 16 on classic console. ConEmu also calculated the font size differently to the classic console, but there the developer considered UX and decided that a font size of 14 would render identically to the classic console, which was also set as the default in that app. I'm using a 1920x1200 screen and classic terminal's consolas font at 16 is just perfect.

In Windows Terminal the font is either too small (at size 10) or too large (size 11). Being able to specify and render at a fractional size would help me get the optimal compromise between screen real estate used and being able to easily read the console text.

@liangzou-deepmap
Copy link

Same issue here. I'm using a Windows surface and Hack font. The font size is either too large (10) or too small (9). I'm looking for a solution to this issue. Thanks!

@musm
Copy link
Author

musm commented Dec 6, 2020

Any chance this could get triaged? The number of users reporting running into the same issue suggests this is indeed something that needs to be looked into.

@DHowett
Copy link
Member

DHowett commented Dec 16, 2020

This has been triaged: it's P3, on the backlog, and if somebody wants to have a look at implementing it they are very welcome to 😄

@w-biggs
Copy link

w-biggs commented Mar 13, 2021

This would definitely be appreciated - it seems like the font sizes (at least for Consolas) are exactly two-thirds in Windows Terminal as they are in the old terminal, which means it's currently impossible to make the text size the same in both unless it's a multiple of three. In the old console, Consolas at 16px looked perfect, but now I'm stuck with 10pt (15px) or 11pt (16.5px), the latter of which looks weirdly stretched horizontally (the vertical bar of a + is twice as thick as the horizontal bar, etc).

@Zerowalker
Copy link

I would also love this, no matter what i do or what font i use it's always blurry like it's got the wrong size and it's resizing it afterwards.
It's just hard to read, and consolas at 16px as stated by others looks great, but you sadly can't get it pixel-perfect in windows terminal as far as i can tell because of the integer size steps.

@musm
Copy link
Author

musm commented Nov 17, 2021

This would definitely be appreciated - it seems like the font sizes (at least for Consolas) are exactly two-thirds in Windows Terminal as they are in the old terminal, which means it's currently impossible to make the text size the same in both unless it's a multiple of three. In the old console, Consolas at 16px looked perfect, but now I'm stuck with 10pt (15px) or 11pt (16.5px), the latter of which looks weirdly stretched horizontally (the vertical bar of a + is twice as thick as the horizontal bar, etc).

Right, this makes it a little frustrating especially for those that prefer very small font sizes.

@rkitover
Copy link
Contributor

I don't know anything about how you guys do rendering, but I use DPI scaling and when I'm tweaking font sizes in CSS for a browser I can make adjustments even in hundreds of a rem and they do make a difference.

@rkitover
Copy link
Contributor

Also I wanted to ask here if anyone has any ideas about how to turn off DPI scaling for this app. I tried the normal way of turning it off for every .exe file, but that has no effect.

@kayzzen01
Copy link

I don't understand almost anything about font rendering, for me it's a bit confusing. For example using Sublime Text setting the font to size 10 is the same as size 16 in Windows command prompt 😄

Basically if an improvement is possible, I would like the Windows Terminal fonts to be rendered the same way as the command prompt, powershell or cmder.
The fonts from these terminals I mentioned seem to be a little sharper and a little thinner (the inner outline of the fonts looks better). I for example could not make the font size of Windows Terminal equal to the command prompt. It must be what I mentioned about the contour being a little different (maybe I'm talking about antializing).
Here in the documentation there is even an example, the letter "e" the inner outline almost closes the letter.
https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-advanced

I'm starting to use Windows Terminal and I'm really enjoying it. This was really missing for Windows.
If you have any tips I appreciate it.

@zadjii-msft zadjii-msft modified the milestones: Terminal Backlog, Backlog Jan 4, 2022
@lhecker lhecker self-assigned this Sep 15, 2022
@ghost ghost added the In-PR This issue has a related PR label Sep 15, 2022
@ghost ghost closed this as completed in #14013 Sep 16, 2022
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Sep 16, 2022
ghost pushed a commit that referenced this issue Sep 16, 2022
After this commit a user may specify fractional font sizes.
Support was only implemented for AtlasEngine however.
DxEngine continues to use rounded (integer) font sizes.

Closes #6678

## Validation Steps Performed
* Install a bitmap font that requires fractional font sizes
  (e.g. Terminus TTF, https://files.ax86.net/terminus-ttf/)
* Set font size to something integer (e.g. 14pt)
  Glyphs are blurry ✅
* Set font size to something fractional (e.g. 13.5pt)
  Glyphs are crisp ✅
DHowett pushed a commit that referenced this issue Sep 16, 2022
After this commit a user may specify fractional font sizes.
Support was only implemented for AtlasEngine however.
DxEngine continues to use rounded (integer) font sizes.

Closes #6678

## Validation Steps Performed
* Install a bitmap font that requires fractional font sizes
  (e.g. Terminus TTF, https://files.ax86.net/terminus-ttf/)
* Set font size to something integer (e.g. 14pt)
  Glyphs are blurry ✅
* Set font size to something fractional (e.g. 13.5pt)
  Glyphs are crisp ✅

(cherry picked from commit c51bb3a)
Service-Card-Id: 85708971
Service-Version: 1.16
DHowett pushed a commit that referenced this issue Sep 16, 2022
After this commit a user may specify fractional font sizes.
Support was only implemented for AtlasEngine however.
DxEngine continues to use rounded (integer) font sizes.

Closes #6678

* Install a bitmap font that requires fractional font sizes
  (e.g. Terminus TTF, https://files.ax86.net/terminus-ttf/)
* Set font size to something integer (e.g. 14pt)
  Glyphs are blurry ✅
* Set font size to something fractional (e.g. 13.5pt)
  Glyphs are crisp ✅

(cherry picked from commit c51bb3a)
Service-Card-Id: 85708971
Service-Version: 1.16
(cherry picked from commit 73ea629)
DHowett pushed a commit that referenced this issue Sep 21, 2022
After this commit a user may specify fractional font sizes.
Support was only implemented for AtlasEngine however.
DxEngine continues to use rounded (integer) font sizes.

Closes #6678

* Install a bitmap font that requires fractional font sizes
  (e.g. Terminus TTF, https://files.ax86.net/terminus-ttf/)
* Set font size to something integer (e.g. 14pt)
  Glyphs are blurry ✅
* Set font size to something fractional (e.g. 13.5pt)
  Glyphs are crisp ✅

(cherry picked from commit c51bb3a)
Service-Card-Id: 85708971
Service-Version: 1.16
(cherry picked from commit 73ea629)
@ghost
Copy link

ghost commented Sep 23, 2022

🎉This issue was addressed in #14013, which has now been successfully released as Windows Terminal Preview v1.16.2641.0.:tada:

Handy links:

@sryze
Copy link

sryze commented Oct 11, 2023

I am using Terminal 1.19.2682.0 and there is no difference between 10.5 and 11 or 11.5 and 12 font sizes (at least in Cascadia, Hack, Source Code Pro).

@lhecker
Copy link
Member

lhecker commented Oct 16, 2023

@sryze Due to hinting, not every font size increase results in a visual change. This is especially so since the font size in Windows Terminal is given in points (pt = 72 DPI) and not in pixels (px = usually considered 96 DPI, or your monitor DPI). And so two different sizes in points may round to about the same value in pixels.

In other words, support for fractional sizes doesn't imply that every single fractional value ends up having a different appearance. Just pick a size that feels good to you! (If you'd like support for disabling hinting, please open a new issue. It's somewhat unlikely that you'd be happy with the result though as unhinted fonts look fairly terrible on a 96 DPI display.)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.