-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Victor Mono vertical alignment? #1116
Comments
[why] Instead of redistributing the line gap we remove it. At least when HHEA or TYPO metrics are used. It's ok with WIN metrics. [how] If we have negative numbers for a gap and want to add more to it, where 'add' means 'make it more', we must of course _subtract_ the value. But baseline-to-baseline code into function so we can check it after all our gymnastics for correctness. It means the metrics. [note] Also correct out-of-sync comment. Fixes: #1116 Reported-by: Nathaniel Evan <nathanielevan> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Thanks for reporting, and with the detailed metrics. Turns out we drop the gap instead of redistributing, because one sign is wrong. Btw, I use
|
After PR:
|
[why] Instead of redistributing the line gap we remove it. At least when HHEA or TYPO metrics are used. It's ok with WIN metrics. [how] If we have negative numbers for a gap and want to add more to it, where 'add' means 'make it more', we must of course _subtract_ the value. But baseline-to-baseline code into function so we can check it after all our gymnastics for correctness. It means the metrics. [note] Also correct out-of-sync comment. Fixes: #1116 Reported-by: Nathaniel Evan <nathanielevan> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@all-contributors Please add @nathanielevan also for bug ❤️ |
I've put up a pull request to add @nathanielevan! 🎉 |
[why] Instead of redistributing the line gap we remove it. At least when HHEA or TYPO metrics are used. It's ok with WIN metrics. [how] If we have negative numbers for a gap and want to add more to it, where 'add' means 'make it more', we must of course _subtract_ the value. But baseline-to-baseline code into function so we can check it after all our gymnastics for correctness. It means the metrics. [note] Also correct out-of-sync comment. Fixes: #1116 Reported-by: Nathaniel Evan <nathanielevan> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Many thanks for the patch, however Fantasque Sans Mono seems to have failed patching:
It's one of those fonts with inconsistent vertical metrics. Did a little debugging and it appears that, at least specifically with this font, it fails at the final check on this line; here's what I got
Here are the metrics of the stock font: So as far as I can tell, if the calculations are correct, |
Merde! I'm currently on the ice, skating with the kids, will look/fix asap. Thank for checking, reporting, etc ❤️ |
Well, And also the last check is ok, I guess. But what is shocking and wrong, maybe is this # We use either TYPO (1) or WIN (2) and compare with HHEA
# and use HHEA (0) if the fonts seems broken - no WIN, see #1056
our_btb = typo_btb if use_typo else win_btb
if our_btb == hhea_btb:
metrics = 1 if use_typo else 2 # conforming font
else:
# We trust the WIN metric more, see experiments in #1056
print("{}: WARNING Font vertical metrics inconsistent (HHEA {} / TYPO {} / WIN {}), using WIN".format(projectName, hhea_btb, typo_btb, win_btb))
our_btb = win_btb
metrics = 1
I need to read #1056 and find out why the code is wrong. |
Hmm, all fonts in Do you use a different Fantastique Sans Mono? I see it with |
Ah right, I forgot I was using the "large line height" variant -- it's available to download here. Indeed I'm not getting that error with the regular version |
[why] With commit e69a025 font-patcher: Fix line gap redistribution we fixed the wrong adding instead of subtraction of the bottom gap part from the descenders. At least this was done for HHEA and TYPO values. With WIN values the descenders have positive (!) numbers, so the sign was not changed for the WIN case. But that is wrong, as we are already in the ymin xmax coordinate system (and took the negative of the WIN descenders). So of course here also we need to subtract and not add. Mentioned in: #1116 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] With commit 6210087 font-patcher: Use WIN metrics in all conflicting cases we intended to use the WIN metrics for the baseline to baseline calculations for fonts that have contradicting (i.e. broken) metrices. But we use the TYPO metrics instead. [how] This is obviously a typo in the code. To prevent such errors and improve the readability we use Enums now. I believe we silently dropped support for Python 2 some time back. And if not we drop it today :-} [note] Many thanks to Nathaniel Evan for again finding this bug! Mentioned in: #1116 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Thank you so much for reporting and evaluating! Fixed the issue in the two commits mentioned above. 👍 😍 |
I should resign... 😭
There are too many special cases in the code. Well, I will fix this silently en passant with (PR to be filled in) @@ -1039,6 +1039,7 @@ class font_patcher:
'width' : self.sourceFont.em,
'height': self.sourceFont.descent + self.sourceFont.ascent,
}
+ our_btb = self.sourceFont.descent + self.sourceFont.ascent
elif self.font_dim['height'] < 0:
sys.exit("{}: Can not detect sane font height".format(projectName))
|
What are the results of Edit: just checked and it generates an |
Thank you, but, the fix is the diff above. See 49e7662 Not redistributing the gap is not an option? That will destroy the original font vertical metrics. The names are In the
|
[why] Instead of redistributing the line gap we remove it. At least when HHEA or TYPO metrics are used. It's ok with WIN metrics. [how] If we have negative numbers for a gap and want to add more to it, where 'add' means 'make it more', we must of course _subtract_ the value. But baseline-to-baseline code into function so we can check it after all our gymnastics for correctness. It means the metrics. [note] Also correct out-of-sync comment. Fixes: #1116 Reported-by: Nathaniel Evan <nathanielevan> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] With commit e69a025 font-patcher: Fix line gap redistribution we fixed the wrong adding instead of subtraction of the bottom gap part from the descenders. At least this was done for HHEA and TYPO values. With WIN values the descenders have positive (!) numbers, so the sign was not changed for the WIN case. But that is wrong, as we are already in the ymin xmax coordinate system (and took the negative of the WIN descenders). So of course here also we need to subtract and not add. Mentioned in: #1116 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] With commit 6210087 font-patcher: Use WIN metrics in all conflicting cases we intended to use the WIN metrics for the baseline to baseline calculations for fonts that have contradicting (i.e. broken) metrices. But we use the TYPO metrics instead. [how] This is obviously a typo in the code. To prevent such errors and improve the readability we use Enums now. I believe we silently dropped support for Python 2 some time back. And if not we drop it today :-} [note] Many thanks to Nathaniel Evan for again finding this bug! Mentioned in: #1116 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] Instead of redistributing the line gap we remove it. At least when HHEA or TYPO metrics are used. It's ok with WIN metrics. [how] If we have negative numbers for a gap and want to add more to it, where 'add' means 'make it more', we must of course _subtract_ the value. But baseline-to-baseline code into function so we can check it after all our gymnastics for correctness. It means the metrics. [note] Also correct out-of-sync comment. Fixes: ryanoasis#1116 Reported-by: Nathaniel Evan <nathanielevan> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] With commit e69a025 font-patcher: Fix line gap redistribution we fixed the wrong adding instead of subtraction of the bottom gap part from the descenders. At least this was done for HHEA and TYPO values. With WIN values the descenders have positive (!) numbers, so the sign was not changed for the WIN case. But that is wrong, as we are already in the ymin xmax coordinate system (and took the negative of the WIN descenders). So of course here also we need to subtract and not add. Mentioned in: ryanoasis#1116 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] With commit 6210087 font-patcher: Use WIN metrics in all conflicting cases we intended to use the WIN metrics for the baseline to baseline calculations for fonts that have contradicting (i.e. broken) metrices. But we use the TYPO metrics instead. [how] This is obviously a typo in the code. To prevent such errors and improve the readability we use Enums now. I believe we silently dropped support for Python 2 some time back. And if not we drop it today :-} [note] Many thanks to Nathaniel Evan for again finding this bug! Mentioned in: ryanoasis#1116 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Thanks for reporting / showing this @gregbacchus To check I re-patched both fonts with the current So I guess the problem is fixed 😬 |
Thank you @Finii, and great work, by the way! |
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a new issue, complete the issue template with all the details necessary to reproduce, and mention this issue as reference. |
[why] Instead of redistributing the line gap we remove it. At least when HHEA or TYPO metrics are used. It's ok with WIN metrics. [how] If we have negative numbers for a gap and want to add more to it, where 'add' means 'make it more', we must of course _subtract_ the value. But baseline-to-baseline code into function so we can check it after all our gymnastics for correctness. It means the metrics. [note] Also correct out-of-sync comment. Fixes: ryanoasis#1116 Reported-by: Nathaniel Evan <nathanielevan> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
🗹 Requirements
🎯 Subject of the issue
Experienced behavior:
After patched with options
-s
,-l
and-c
, Victor Mono's vertical alignment seems too low. Here's a comparison:Metrics:
Expected behavior:
Patched font retains its vertical alignment
The text was updated successfully, but these errors were encountered: