font-patcher: Fix Monofur 'Nerd Font Mono' too wide

[why]
Although Monofur is monospaced it has one glyph (hyphen) that is
slightly wider than all others. This results in a Monospaced font that
is slightly too wide.

[how]
Ignore the hyphen width.

[note]
Additionally improve (commented out) debug code (shows now hex
codepoint).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-01-22 14:50:43 +01:00
parent 326ccdf601
commit dd3ed4dc74

View file

@ -986,6 +986,7 @@ class font_patcher:
0x132, 0x133, # IJ, ij (in Overpass Mono)
0x022, 0x027, 0x060, # Single and double quotes in Inconsolata LGC
0x0D0, 0x10F, 0x110, 0x111, 0x127, 0x13E, 0x140, 0x165, # Eth and others with stroke or caron in RobotoMono
0x02D, # hyphen for Monofur
]:
continue # ignore special characters like '1/4' etc and some specifics
try:
@ -999,10 +1000,10 @@ class font_patcher:
print("Warning: Extended glyphs wider than basic glyphs, results might be useless\n {}".format(
report_advance_widths(self.sourceFont)))
warned = True
# print("New MAXWIDTH-A {} {} -> {} {}".format(glyph, self.sourceFont[glyph].width, self.font_dim['width'], xmax))
# print("New MAXWIDTH-A {:X} {} -> {} {}".format(glyph, self.sourceFont[glyph].width, self.font_dim['width'], xmax))
if xmax > self.font_dim['xmax']:
self.font_dim['xmax'] = xmax
# print("New MAXWIDTH-B {} {} -> {} {}".format(glyph, self.sourceFont[glyph].width, self.font_dim['width'], xmax))
# print("New MAXWIDTH-B {:X} {} -> {} {}".format(glyph, self.sourceFont[glyph].width, self.font_dim['width'], xmax))
# print("FINAL", self.font_dim)