mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-31 12:27:22 +02:00
Revert "font-patcher: Use WIN metrics in all conflicting cases"
This reverts commit 621008773c1864002a0c178715c062b4b3c9d36b, and adapts the code to more recent changes (logging, enums). [why] Lekton has a too wide line spacing. Lekton was the only font that selected TYPO but we forced it to WIN, because not all glyphs fit into the values from TYPO. But that seems to be wrong. Examining the glyphs that are really bigger than the TYPO line spaces, these are only graphical glyphs that shall span multiple lines. So I guess we should revert that change and render Lekton with the TYPO values. [note] https://github.com/ryanoasis/nerd-fonts/issues/1056#issuecomment-1529141863
This commit is contained in:
parent
6a24da8602
commit
3432ad667b
21
font-patcher
21
font-patcher
@ -6,7 +6,7 @@
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
# Change the script version when you edit this script:
|
||||
script_version = "4.1.0"
|
||||
script_version = "4.1.1"
|
||||
|
||||
version = "3.0.0"
|
||||
projectName = "Nerd Fonts"
|
||||
@ -1113,11 +1113,22 @@ class font_patcher:
|
||||
our_btb = typo_btb if use_typo else win_btb
|
||||
if our_btb == hhea_btb:
|
||||
metrics = Metric.TYPO if use_typo else Metric.WIN # conforming font
|
||||
elif abs(our_btb - hhea_btb) / our_btb < 0.03:
|
||||
logger.info("Font vertical metrics slightly off (%.1f%)", (our_btb - hhea_btb) / our_btb * 100.0)
|
||||
metrics = Metric.TYPO if use_typo else Metric.WIN
|
||||
else:
|
||||
# We trust the WIN metric more, see experiments in #1056
|
||||
logger.warning("Font vertical metrics inconsistent (HHEA %d / TYPO %d / WIN %d), using WIN", hhea_btb, typo_btb, win_btb)
|
||||
our_btb = win_btb
|
||||
metrics = Metric.WIN
|
||||
# Try the other metric
|
||||
our_btb = typo_btb if not use_typo else win_btb
|
||||
if our_btb == hhea_btb:
|
||||
logger.warning("Font vertical metrics probably wrong USE TYPO METRICS, assume opposite (i.e. %s)", 'True' if not use_typo else 'False')
|
||||
use_typo = not use_typo
|
||||
self.sourceFont.os2_use_typo_metrics = 1 if use_typo else 0
|
||||
metrics = Metric.TYPO if use_typo else Metric.WIN
|
||||
else:
|
||||
# We trust the WIN metric more, see experiments in #1056
|
||||
logger.warning("Font vertical metrics inconsistent (HHEA %d / TYPO %d / WIN %d), using WIN", hhea_btb, typo_btb, win_btb)
|
||||
our_btb = win_btb
|
||||
metrics = Metric.WIN
|
||||
|
||||
# print("FINI hhea {} typo {} win {} use {} {} {}".format(hhea_btb, typo_btb, win_btb, use_typo, our_btb != hhea_btb, self.sourceFont.fontname))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user