Skip to content

Commit 4ad5bb0

Browse files
committed
Fix regression in handling annotated spans
1 parent 9549324 commit 4ad5bb0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/rinoh/paragraph.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,14 @@ def handle_missing_glyphs(span, container):
441441
return
442442
get_glyph, _ = create_lig_kern(span, container)
443443
string = []
444+
has_missing_glyphs = False
444445
for char in span.text(container):
445446
try:
446447
if char not in '\n\t\N{ZERO WIDTH SPACE}\N{NO-BREAK SPACE}':
447448
get_glyph(char)
448449
string.append(char)
449450
except MissingGlyphException:
451+
has_missing_glyphs = True
450452
if string:
451453
yield SingleStyledText(''.join(string), parent=span)
452454
string.clear()
@@ -455,6 +457,9 @@ def handle_missing_glyphs(span, container):
455457
else:
456458
fallback_span = SingleStyledText(char, style=FALLBACK_STYLE, parent=span)
457459
yield from handle_missing_glyphs(fallback_span, container)
460+
if not has_missing_glyphs:
461+
yield span
462+
return
458463
if string:
459464
yield SingleStyledText(''.join(string), parent=span)
460465

0 commit comments

Comments
 (0)