mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-12 09:41:47 +02:00
font-patcher: Fix empty glyph handling in get_multiglyph_boundingBox()
[why] When the combinded bounding box of a range of glyphs is to be determined and the range contains an empty glyph the resulting bounding box will always include the [0, 0] point (that is the point-ish bounding box of the empty glyph). [how] If more than one codepoint is to be considered empty glyphs are ignored. But if only one (concrete) codepoint is queried do return the empty (i.e. [0, 0, 0, 0]) bounding box. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
2b9a41f871
commit
cd026579c5
1 changed files with 3 additions and 0 deletions
|
@ -1250,6 +1250,9 @@ def get_multiglyph_boundingBox(glyphs, destGlyph = None):
|
|||
destGlyph.font.paste()
|
||||
glyph = destGlyph
|
||||
gbb = glyph.boundingBox()
|
||||
if len(glyphs) > 1 and gbb[0] == gbb[2] and gbb[1] == gbb[3]:
|
||||
# Ignore empty glyphs if we examine more than one glyph
|
||||
continue
|
||||
bbox[0] = gbb[0] if bbox[0] is None or bbox[0] > gbb[0] else bbox[0]
|
||||
bbox[1] = gbb[1] if bbox[1] is None or bbox[1] > gbb[1] else bbox[1]
|
||||
bbox[2] = gbb[2] if bbox[2] is None or bbox[2] < gbb[2] else bbox[2]
|
||||
|
|
Loading…
Reference in a new issue