Skip to content

Commit

Permalink
Don’t crash with empty bitmap glyphs
Browse files Browse the repository at this point in the history
Fix #1718.
  • Loading branch information
liZe committed Oct 11, 2022
1 parent 3e501be commit 22cabf7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion weasyprint/pdf/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ def _build_bitmap_font_dictionary(font_dictionary, pdf, font, widths,
}

# Decode bitmaps
if glyph_format in (1, 6):
if 0 in (width, height) or not data:
glyph_info['bitmap'] = b''
elif glyph_format in (1, 6):
glyph_info['bitmap'] = data
elif glyph_format in (2, 5, 7):
padding = (8 - (width % 8)) % 8
Expand Down

0 comments on commit 22cabf7

Please sign in to comment.