mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
Fix: Monospaced fonts wrong width
[why]
With commit
821ac6817
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: #895
Reported-by: redactedscribe
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
a334db4180
commit
b71a9e474b
1 changed files with 3 additions and 3 deletions
|
@ -835,7 +835,7 @@ class font_patcher:
|
||||||
# Ignore the y-values, os2_winXXXXX values set above are used for line height
|
# Ignore the y-values, os2_winXXXXX values set above are used for line height
|
||||||
#
|
#
|
||||||
# 0x00-0x17f is the Latin Extended-A range
|
# 0x00-0x17f is the Latin Extended-A range
|
||||||
for glyph in range(0x00, 0x17f):
|
for glyph in range(0x21, 0x17f):
|
||||||
if glyph in range(0x7F, 0xBF):
|
if glyph in range(0x7F, 0xBF):
|
||||||
continue # ignore special characters like '1/4' etc
|
continue # ignore special characters like '1/4' etc
|
||||||
try:
|
try:
|
||||||
|
@ -848,6 +848,7 @@ class font_patcher:
|
||||||
self.font_dim['xmax'] = xmax
|
self.font_dim['xmax'] = xmax
|
||||||
|
|
||||||
# Calculate font height
|
# Calculate font height
|
||||||
|
self.font_dim['height'] = abs(self.font_dim['ymin']) + self.font_dim['ymax']
|
||||||
if self.font_dim['height'] == 0:
|
if self.font_dim['height'] == 0:
|
||||||
# This can only happen if the input font is empty
|
# This can only happen if the input font is empty
|
||||||
# Assume we are using our prepared templates
|
# Assume we are using our prepared templates
|
||||||
|
@ -857,9 +858,8 @@ class font_patcher:
|
||||||
'xmax' : self.sourceFont.em,
|
'xmax' : self.sourceFont.em,
|
||||||
'ymax' : self.sourceFont.ascent,
|
'ymax' : self.sourceFont.ascent,
|
||||||
'width' : self.sourceFont.em,
|
'width' : self.sourceFont.em,
|
||||||
'height': 0,
|
'height': abs(self.sourceFont.descent) + self.sourceFont.ascent,
|
||||||
}
|
}
|
||||||
self.font_dim['height'] = abs(self.font_dim['ymin']) + self.font_dim['ymax']
|
|
||||||
|
|
||||||
|
|
||||||
def get_scale_factor(self, sym_dim):
|
def get_scale_factor(self, sym_dim):
|
||||||
|
|
Loading…
Reference in a new issue