-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Feature: correct small rendering #761
Conversation
[why] When the patched font does not have a fullname (which can never happen) the postprocess is called with a wrong filename. [note] Also output the file name of the patched font, for easier access by the user. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] Some fonts set specific lower resolutions and handle the small rendering very nicely. But fontforge does not copy that information when it opens a font; rather some default values are always written. That can destroy the small font rendering. The responsible settings are the 'ppem_to_int' flag and the 'lowestRecPPEM' setting, both in the HEAD table. [how] After successfully patching and generating the new font we copy that settings over from the source font. Instead of using fontTools (and thereby requiring all users to pull that dependency) we handle the raw font file changes ourselves. Fixes: 612 Reported-by: nojus297 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Instead of the hand-made (but more or less trivial) new class It's just the NPM explosion (again) and the inconvenience for end users that let me seek another way to handle it. Many thanks to @nojus297 whose colaboration made this PR possible. |
Would there be a way to run the build locally to produce patched fonts? I am so keen to get my hands on properly scaled Hack font. |
If you have Or you need https://github.com/ryanoasis/nerd-fonts/blob/feature/correct-small-rendering/font-patcher If you use git
Or whatever ;) I do not know where you are. If you need only a very few specific fonts (and tell me which, and wether |
This is great, thank you so much. I use linux, no problem. I'll figure it out! |
Thanks for the fix, and the exclusion of |
What kind of checks to you have in mind? The actual code this PR adds has been tested with the help of Some random thoughts following. But at the moment the concept here is to have everything (also the built artifacts like patched fonts) IN the repo and not only as release artifacts. For easier access by users I assume. What I also look upon with mixed feeling is that the release is defined only as workflow. Having even some kind of And the tests would then be triggered by Use of The question is... is Nerd-Fonts complex enough to change from a github-workflow based release definition to a proper stand alone definition? Hmm. |
I don't doubt that your code is correct and tested. I'm just worried that, as the patcher code is already quite complex, some subtle changes may break it in the future. And it will be hard to notice, as it wasn't easy to understand/reproduce the issue. Therefore, for this case, I had in mind some sort of CI test to simply check if the flags of generated fonts are correct, e. g. with This was inspired by the fact that most recent font builds/releases do not work at all on my machine, they don't show up in font picker. Regression happens easily. Storing patched fonts in the repository is certainly a bad idea, the Also separating patching script from github-releasing workflow is probably a good idea, as is restructuring of the whole project. By the way, also noticed that
|
[why] We 'manually' patch the font file after `fontforge` created it. This can go wrong, for example we fail to create a correct new checksum. Or we fail to patch the correct font property. [how] Also build `showttf` from the `fontforge` package and use it to extract some font properties: * Check the example patched font file checksum * Compare the `lowestRecPPEM` of source to patched font file [note] `fontforge` set `lowestRecPPEM` always to 8 in generated fonts. Hack has a value of 6. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Added, utilizing fontforge's own toolset ;-) |
It fails if the font file is
|
[why] When the source font does not have a HEAD table (i.e. is not a ttf/otf font but for example a sfd) we can not copy the PPEM and flag values. The patcher crashes. [how] Just put the code into a try block. We could check the signature instead, but this would add more and complex code. Reported-by: Jakub Jirutka <jakub@jirutka.cz> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
afcb0e9
to
cfd6927
Compare
Thanks for the report @jirutka! Fixed. |
Description
[why]
Some fonts set specific lower resolutions and handle the small rendering
very nicely. But fontforge does not copy that information when it opens
a font; rather some default values are always written. That can destroy
the small font rendering.
The responsible settings are the
ppem_to_int
flag and thelowestRecPPEM
setting, both in theHEAD
table.[how]
After successfully patching and generating the new font we copy that
settings over from the source font.
Instead of using
fontTools
(and thereby requiring all users to pull thatdependency) we handle the raw font file changes ourselves.
Fixes: 612
Reported-by: @nojus297
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)
All these information is given in Issue #612 but a lot other fonts are also affected.
For example
(Note messages about 'changing' in the bottom, these values are copied over from the source font into the patched font, because
fontforge
does not even read them,)