mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Better error message when there is a glyph mismatch
This commit is contained in:
parent
c668fec87b
commit
2207a86ea7
@ -8,6 +8,10 @@ from collections import OrderedDict
|
||||
from functools import partial
|
||||
|
||||
|
||||
class GlyphSizeMismatch(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def merge_truetype_fonts_for_pdf(*fonts):
|
||||
# only merges the glyf and loca tables, ignoring all other tables
|
||||
all_glyphs = {}
|
||||
@ -24,7 +28,7 @@ def merge_truetype_fonts_for_pdf(*fonts):
|
||||
all_glyphs[glyph_id] = glyf.glyph_data(offset, sz, as_raw=True)
|
||||
else:
|
||||
if sz != len(prev_glyph_data):
|
||||
raise Exception('Size mismatch for glyph id: {}'.format(glyph_id))
|
||||
raise GlyphSizeMismatch('Size mismatch for glyph id: {} prev_sz: {} sz: {}'.format(glyph_id, len(prev_glyph_data), sz))
|
||||
|
||||
glyf = ans[b'glyf']
|
||||
head = ans[b'head']
|
||||
|
Loading…
x
Reference in New Issue
Block a user