diff --git a/src/calibre/ebooks/pdf/html_writer.py b/src/calibre/ebooks/pdf/html_writer.py index 86671d19d2..167ad77bcc 100644 --- a/src/calibre/ebooks/pdf/html_writer.py +++ b/src/calibre/ebooks/pdf/html_writer.py @@ -775,10 +775,14 @@ def merge_cmaps(cmaps): def fonts_are_identical(fonts): + sentinel = object() for key in ('ToUnicode', 'Data'): - all_values = {f[key] for f in fonts} - if len(all_values) > 1: - return False + prev_val = sentinel + for f in fonts: + val = f[key] + if prev_val is not sentinel and prev_val != val: + return False + prev_val = val return True