mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-19 09:51:48 +02:00
font-patcher: Fix monospaced glyph collection detection
[why] When only one symbol glyph is examined we conclude that it comes from a monospaced glyph set. This might be correct or not, but when we can not positively say it is monospaced we should not handle it as monospaced. [how] We require at least TWO glyphs with the same width (and no glyph with a different width) until we set the 'advance' bounding box property. Which says that this particular glyph subset is monospaced. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
46eb6e451c
commit
3cfe4a1a06
1 changed files with 5 additions and 2 deletions
|
@ -1316,11 +1316,14 @@ def get_multiglyph_boundingBox(glyphs, destGlyph = None):
|
||||||
bbox[2] = gbb[2] if bbox[2] is None or bbox[2] < gbb[2] else bbox[2]
|
bbox[2] = gbb[2] if bbox[2] is None or bbox[2] < gbb[2] else bbox[2]
|
||||||
bbox[3] = gbb[3] if bbox[3] is None or bbox[3] < gbb[3] else bbox[3]
|
bbox[3] = gbb[3] if bbox[3] is None or bbox[3] < gbb[3] else bbox[3]
|
||||||
if not bbox[4]:
|
if not bbox[4]:
|
||||||
bbox[4] = gadvance
|
bbox[4] = -gadvance # Negative for one/first glyph
|
||||||
else:
|
else:
|
||||||
if bbox[4] != gadvance:
|
if abs(bbox[4]) != gadvance:
|
||||||
bbox[4] = -1 # Marker for not-monospaced
|
bbox[4] = -1 # Marker for not-monospaced
|
||||||
|
else:
|
||||||
|
bbox[4] = gadvance # Positive for 2 or more glyphs
|
||||||
if bbox[4] and bbox[4] < 0:
|
if bbox[4] and bbox[4] < 0:
|
||||||
|
# Not monospaced when only one glyph is used or multiple glyphs with different advance widths
|
||||||
bbox[4] = None
|
bbox[4] = None
|
||||||
return {
|
return {
|
||||||
'xmin' : bbox[0],
|
'xmin' : bbox[0],
|
||||||
|
|
Loading…
Reference in a new issue