Skip to content

Commit 07b8da7

Browse files
committed
Add fallback for characters not in newstroke font
Fixes #89
1 parent 833369f commit 07b8da7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

InteractiveHtmlBom/core/fontparser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ def parse_font_char(self, chr):
1212
lines = []
1313
line = []
1414
glyph_x = 0
15-
glyph_str = NEWSTROKE_FONT[ord(chr) - ord(' ')]
15+
index = ord(chr) - ord(' ')
16+
if index >= len(NEWSTROKE_FONT):
17+
index = ord('?') - ord(' ')
18+
glyph_str = NEWSTROKE_FONT[index]
1619
for i in range(0, len(glyph_str), 2):
1720
coord = glyph_str[i:i + 2]
1821

0 commit comments

Comments
 (0)