Skip to content

Commit

Permalink
font-patcher: Fix Monofur 'Nerd Font Mono' too wide
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
Finii committed Jan 22, 2023
1 parent 326ccdf commit dd3ed4d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)


Expand Down

0 comments on commit dd3ed4d

Please sign in to comment.