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

CascadiaCode: Rehint and use ttf #1179

Merged
merged 1 commit into from
Apr 27, 2023
Merged

CascadiaCode: Rehint and use ttf #1179

merged 1 commit into from
Apr 27, 2023

Conversation

Finii
Copy link
Collaborator

@Finii Finii commented Apr 27, 2023

[why]
A lot people (read: People on Windows) have the variable font (VF) version of Cascadia Code installed - it comes bundled with Windows Terminal.

The static Cascadia Code instances that we use for patching are hinted with ttfautohint which creates small sized glyphs that are visibly very different. People compare the static Caskaydia Cove with the VF Cascadia Code and are surprised.

[how]
First switch from the CFF outlines to TTF outlines - that is the original version (i.e. otf -> ttf). It is unknown why we created patched CFF fonts instead of the TTFs. To get as close as possible to the intended look of the glyphs we should stick with the outline type.

Then we need to re-hint all the fonts, to get hints that are comparable to the VF hints. We can not use the hints of the VF because the outlines are different: The VF has (of course) overlapping outlines, while the static ones (as usual) have not.

The re-hinting can be done with VTT or TTH - both showed results that are more like the original VF font. The usual ttfautohint has been used of the static fonts in the font release and can not be used. It is the reason for this whole problem.

  • Used VTT 6.35
  • Open font file in VTT
  • Import all programs
  • Generate 'VTT talk' via Tools -> AutoHint -> LightLatinAutoHint
  • Save font file as ...

References:

Closes: #998

Requirements / Checklist

What does this Pull Request (PR) do?

How should this be manually tested?

Any background context you can provide?

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

[why]
A lot people (read: People on Windows) have the variable font (VF) version of
Cascadia Code installed - it comes bundled with Windows Terminal.

The static Cascadia Code instances that we use for patching are hinted
with ttfautohint which creates small sized glyphs that are visibly very
different. People compare the static Caskaydia Cove with the VF Cascadia
Code and are surprised.

[how]
First switch from the CFF outlines to TTF outlines - that is the
original version (i.e. otf -> ttf). It is unknown why we created patched
CFF fonts instead of the TTFs. To get as close as possible to the
intended look of the glyphs we should stick with the outline type.

Then we need to re-hint all the fonts, to get hints that are comparable
to the VF hints. We can not use the hints of the VF because the outlines
are different: The VF has (of course) overlapping outlines, while the
static ones (as usual) have not.

The re-hinting can be done with VTT or TTH - both showed results that
are more like the original VF font. The usual ttfautohint has been used
of the static fonts in the font release and can not be used. It is the
reason for this whole problem.

* Used VTT 6.35
* Open font file in VTT
* Import all programs
* Generate 'VTT talk' via Tools -> AutoHint -> LightLatinAutoHint
* Save font file as ...

References:
microsoft/cascadia-code#371
https://learn.microsoft.com/en-us/typography/tools/vtt/

Closes: #998

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator Author

Finii commented Apr 27, 2023

How VTT looks like

grafik

Static font before and after re-hinting

The x-height changes by one pixel at some sizes

grafik

Fontforge shows the theoretical outline with a black line. It is modified by the hints to better fit to the actual pixels (grind shown). The green line is the outline after applying the hints / program. How much area of that green outline is in one particular pixel box determines that pixel's density (blackness).

You see that the green outline does not in general match pixel borders, but especially for the x-height (the height of the lower case letters without ascenders, xnmi..., is pushed down by the program - instead of up what ttfautohint does.

Note that the antialiasing view of fontforge is not (far from) perfect, and different font rendering engines have different results (and user settings). To really see what is going on the most reliable way is to actually install the font and have a look at it in small sizes with a magnifier (that does not do pixel interpolation) 😬

@Finii
Copy link
Collaborator Author

Finii commented Apr 27, 2023

Note that VTT makes the font files considerably bigger. On the other hand the fonts will be even far more bigger after we patch them. But there is for sure room for improvement.

@Finii Finii added this to the v3.0.0 milestone Apr 27, 2023
@Finii Finii marked this pull request as ready for review April 27, 2023 10:36
@Finii Finii merged commit 7ebb443 into master Apr 27, 2023
@Finii Finii deleted the feature/rehint-cascadiacode branch April 27, 2023 13:25
Finii added a commit that referenced this pull request Apr 27, 2023
[why]
The font-patcher check workflow fails because the font used for testing
is gone (replaced by differently named one).

[how]
Correct file names.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this pull request Apr 27, 2023
[why]
The font-patcher check workflow fails because the font used for testing
is gone (replaced by differently named one).

[how]
Correct file names.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
LNKLEO pushed a commit to LNKLEO/Nerd that referenced this pull request Nov 24, 2023
[why]
The font-patcher check workflow fails because the font used for testing
is gone (replaced by differently named one).

[how]
Correct file names.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cascadia Code/Mono text height doesn't match original
1 participant