From e6b44cf5fae54836dc4ee8ece427de1e4313e14f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 7 Oct 2019 06:57:17 +0530 Subject: [PATCH] PDF Output: Ignore 4 byte differences in glyph sizes when merging. Fixes #1846982 [Conversion from ePub to PDF fails](https://bugs.launchpad.net/calibre/+bug/1846982) --- src/calibre/utils/fonts/sfnt/merge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/fonts/sfnt/merge.py b/src/calibre/utils/fonts/sfnt/merge.py index e36a96909f..a65ce18aae 100644 --- a/src/calibre/utils/fonts/sfnt/merge.py +++ b/src/calibre/utils/fonts/sfnt/merge.py @@ -27,7 +27,7 @@ def merge_truetype_fonts_for_pdf(*fonts): 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): + if abs(sz - len(prev_glyph_data)) > 4: raise GlyphSizeMismatch('Size mismatch for glyph id: {} prev_sz: {} sz: {}'.format(glyph_id, len(prev_glyph_data), sz)) glyf = ans[b'glyf']