Fix lettering commands (#3385)

pull/3389/head dev-build-kaalleen-fix_lettering_commands
Kaalleen 2024-12-29 19:54:15 +01:00 zatwierdzone przez GitHub
rodzic c429bf5f17
commit f807ccf49a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -231,8 +231,18 @@ class Font(object):
position.x = 0
position.y += self.leading
bounding_box = letter_group.bounding_box()
# We need to insert the destination_group now, even though it is possibly empty
# otherwise we could run into a FragmentError in case a glyph contains commands
destination_group.append(letter_group)
bounding_box = None
try:
bounding_box = letter_group.bounding_box()
except AttributeError:
# letter group is None
continue
# remove destination_group if it is empty
if not bounding_box:
destination_group.remove(letter_group)
continue
line_width = bounding_box.width
@ -243,8 +253,6 @@ class Font(object):
if text_align == 2:
letter_group.transform = f'translate({-line_width}, 0)'
destination_group.append(letter_group)
if text_align in [3, 4]:
for line_group in destination_group.iterchildren():
# print(line_group.label, len(line_group), file=sys.stderr)