Skip to content

Commit 32ccbba

Browse files
committed
Fix: Monospaced fonts wrong width
[why] With commit 821ac68 Create symbols only font directly from sfd template we have a default width for source fonts without a width (i.e. empty fonts). Unfortunately the detection for 'empty font' is wrong. [how] Reorder the commands such that we have a meaningful calculation. Maybe this has been broken by too many (manual) rebases. Fixes: ryanoasis#895 Reported-by: redactedscribe Signed-off-by: Fini Jastrow <[email protected]>
1 parent 3a575eb commit 32ccbba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

font-patcher

+3-3
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ class font_patcher:
835835
# Ignore the y-values, os2_winXXXXX values set above are used for line height
836836
#
837837
# 0x00-0x17f is the Latin Extended-A range
838-
for glyph in range(0x00, 0x17f):
838+
for glyph in range(0x21, 0x17f):
839839
if glyph in range(0x7F, 0xBF):
840840
continue # ignore special characters like '1/4' etc
841841
try:
@@ -848,6 +848,7 @@ class font_patcher:
848848
self.font_dim['xmax'] = xmax
849849

850850
# Calculate font height
851+
self.font_dim['height'] = abs(self.font_dim['ymin']) + self.font_dim['ymax']
851852
if self.font_dim['height'] == 0:
852853
# This can only happen if the input font is empty
853854
# Assume we are using our prepared templates
@@ -857,9 +858,8 @@ class font_patcher:
857858
'xmax' : self.sourceFont.em,
858859
'ymax' : self.sourceFont.ascent,
859860
'width' : self.sourceFont.em,
860-
'height': 0,
861+
'height': abs(self.sourceFont.descent) + self.sourceFont.ascent,
861862
}
862-
self.font_dim['height'] = abs(self.font_dim['ymin']) + self.font_dim['ymax']
863863

864864

865865
def get_scale_factor(self, sym_dim):

0 commit comments

Comments
 (0)