mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Check glyph definition sizes are identical when merging ttf fonts
This commit is contained in:
parent
411cd21e82
commit
7366d8f57a
@ -17,10 +17,14 @@ def merge_truetype_fonts_for_pdf(*fonts):
|
||||
glyf = font[b'glyf']
|
||||
loca.load_offsets(font[b'head'], font[b'maxp'])
|
||||
for glyph_id in range(len(loca.offset_map) - 1):
|
||||
if glyph_id not in all_glyphs:
|
||||
offset, sz = loca.glyph_location(glyph_id)
|
||||
if sz > 0:
|
||||
prev_glyph_data = all_glyphs.get(glyph_id)
|
||||
if prev_glyph_data is None:
|
||||
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))
|
||||
|
||||
glyf = ans[b'glyf']
|
||||
head = ans[b'head']
|
||||
|
Loading…
x
Reference in New Issue
Block a user