Closed Finii closed 1 year ago
See also at Nerd Fonts:
Maybe we should pull TableHEADWriter.py
out of font-patcher
already at Nerd Fonts.
But even if we do, that would be visible here only after a NF release.
And then, I'm a bit hesitant to pull stuff apart in font-patcher
; it would be better from a programming perspective, but there are so many ppl ouit there who expect just one script file that does it all, and currently the font-patcher
works ok, even if the FontnameParser
(which I externalized) is not found.
Maybe it is time to 'explode' font-patcher
?
And then somewhere I read that one can create some kind of zip archive (?) that contains multiple python files / modules but is just one file and can be executed, how was that called... packed python? I'm not the python guy :grimacing:
Wait, why are the created files almost double in size now? :thinking:
Edit:
Ah, it's just that Github shows the uncompressed size in the workflow but the compressed size on the release page. Sizes are equal(-ish):
I'm happy to approve this if you want to merge it @Finii
Oh, I completely forgot this PR :blush:
I was sidetracked because I'm not so sure it fixes all problems with Cascadia's rendering. At some point I believed that the static ttf
files are good (better) than the static otf
used at Nerd Fonts for Caskaydia. There seems to be already a difference between unpatched Cascadia Code otf
versus VF ttf
...
Whatever. That are details or other aspects, what is for sure a bug is that we destroy the font flags because we use fontforge
directly. Another idea would be to add more setting to config.cfg
at Nerd Font side, so that we do not need to rename anything here but just specify our target names in the config file. Maybe I will look into that - if I do not forget it :grimacing:
So. Thanks for approving! I myself find the code copy&paste a bit smelly (see comment above), but we can change that if Nerd Fonts got a bit more flexible. At the moment the bit bashing code seems to work stable enough.
I guess I would hold a new release off a bit, because I'm not certain that the Issue is really solved. This is in parallel tackled at Nerd Fonts. I also found new hints what could be the reasons.
So while it is definitively a bug, I fear the solution is not complete. At least I should check / compare the fonts before/after on a Windows machine which I have not right now. I struggle with creating a meaningful release message, and that is a bad sign :grimacing: so .. postponing.
I agree about the smelliness, it's definitely not the nicest of solutions but as you say we'd upstream support from Nerd Fonts for a better solution.
Rechecked original issue.
I can not see any difference in rendering in Windows Terminal for before and after this PR, neither it big nor at small sizes. I compared Delugia before and after this PR and Cascadia Code static. I might make out a 1/4 pixel differences in the stems, but nothing in height, and nothing really visible without looking through a 400% magnifier.
I DO see the difference between Cascadia Code static and Cascadia Code VF, but that is nothing we can change. Will accumulate more data and raise an Issue upstream.
Very visible (for some definitions of 'very') is the height of the dot on the small letter i.
I can not see the difference between VF and static on Mac with Glyphs' TextPreview:
And on Windows, I see the difference in Windows Terminal but not for example with WordPad:
Here the different dot heights again:
Cascadia Code static (i.e. Delugia)
Cascadia Code VF
All fonts here are Open Type with TrueType outlines (i.e. .ttf
)
Cascadia Code VF ttf versus Delugia
Cascadia Code static ttf versus Delugia
The problem turned out to be (follow the link to the issue in Windows Terminal and from there to the issue in Cascadia Code) the hinting. It is done with ttfautohint
. But the VF is manually hinted. That just does not match.
We came up with an improvement in the Cascadia Code issue, but it is unclear if that will ever 'fly'.
The only other option would be to set some hinting up with VTT on a Windows machine in our CI (if that is possible at all, as that is an interactive application); but then Delugia will look like Cascadia VF (and not like Cascadia static).
The autohinting is strange, I tried three autohinters (ttfautohint
, VTT
, and TTH
(which is not free)), and only ttfautohint
generated these different hinting. But maybe Aaron has mercy and corrects the static's hints with the next release :-D
[why] The patched font looks different than the original Cascadia Cove font. Character height seems to differ a bit, esp at smaller sizes.
[how] With Fontforge it is not possible to control some aspects of the generated font. There is no access to the ascpects from within fontforge, and they are also not preserved but rather overwritten with some default values. But these affect the font rendering engines.
Namely this are the flags and the lowest-recommended-ppem of the HEAD table in the font.
The Nerd Fonts font-patcher addresses this shortcoming by manipulating the HEAD table after the patching process directly.
But here we call (after running the font-patcher) fontforge again to rename the font. In that process the details in the HEAD table are again overwritten with stupid default values.
So we take the HEAD table manipulation code from font-patcher and call it again after the renaming.
Differently from Nerd Fonts we copy the font flags exactly and do not only clear the integer-ppem bit.
Fixes: #78