PDF Output: Disable subsetting of embedded TrueType fonts to workaround a bug in chromium as of Qt 6.7.2

This commit is contained in:
Kovid Goyal 2024-08-14 19:45:04 +05:30
parent 4232224213
commit 3d477b904c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -843,6 +843,10 @@ def merge_font_files(fonts, log):
descendant_fonts = [f for f in fonts if f['Subtype'] != 'Type0'] descendant_fonts = [f for f in fonts if f['Subtype'] != 'Type0']
total_size = sum(len(f['Data']) for f in descendant_fonts) total_size = sum(len(f['Data']) for f in descendant_fonts)
merged_sfnt = merge_truetype_fonts_for_pdf(tuple(f['sfnt'] for f in descendant_fonts), log) merged_sfnt = merge_truetype_fonts_for_pdf(tuple(f['sfnt'] for f in descendant_fonts), log)
if False:
# As of Qt 6.7.2 webengine produces W arrays that do not contain all
# used glyph ids, so we cannot subset. Can be tested by
# echo 'this is a test boulder sentence' > test.txt; ebook-convert test.txt .pdf
w_arrays = tuple(filter(None, (f['W'] for f in descendant_fonts))) w_arrays = tuple(filter(None, (f['W'] for f in descendant_fonts)))
glyph_ids = all_glyph_ids_in_w_arrays(w_arrays, as_set=True) glyph_ids = all_glyph_ids_in_w_arrays(w_arrays, as_set=True)
h_arrays = tuple(filter(None, (f['W2'] for f in descendant_fonts))) h_arrays = tuple(filter(None, (f['W2'] for f in descendant_fonts)))