font-patcher: Fix Overpass Mono too wide

[why]
The 'monospace' width is determined by examining all the 'normal' glyphs
and taking the widest one.

'Normal' means 0x00-0x17f: the Latin Extended-A range.

Unfortunately Overpass (Mono) has wide-as-two-letters IJ and ij ligatures.

[how]
Exclude a small sub-range from the 'find the widest glyph' that contain
these ligatures. Yes they will kind of break, but what can we do if we
want to create a strictly monospaced font?

[note]
Related commit
  fbe07b8ab  Fix Noto too wide

Related: #1043

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-01-10 19:29:23 +01:00 committed by Fini
parent 9514cbc509
commit 8845e3fb99

View file

@ -945,8 +945,8 @@ class font_patcher:
#
# 0x00-0x17f is the Latin Extended-A range
for glyph in range(0x21, 0x17f):
if glyph in range(0x7F, 0xBF):
continue # ignore special characters like '1/4' etc
if glyph in range(0x7F, 0xBF) or glyph in range(0x132, 0x134):
continue # ignore special characters like '1/4' etc and 'IJ' 'ij'
try:
(_, _, xmax, _) = self.sourceFont[glyph].boundingBox()
except TypeError: