From 9b81b572b79e4322e9babbe5786c23eea7a499d7 Mon Sep 17 00:00:00 2001 From: Evgeniy Krysanov Date: Tue, 11 Jul 2023 18:29:12 +0300 Subject: [PATCH] Fix IndexError when rendering PDF version 1.4 --- weasyprint/pdf/fonts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weasyprint/pdf/fonts.py b/weasyprint/pdf/fonts.py index d277a6c9e..5d6276c8f 100644 --- a/weasyprint/pdf/fonts.py +++ b/weasyprint/pdf/fonts.py @@ -117,7 +117,7 @@ def build_fonts_dictionary(pdf, fonts, compress_pdf, subset, hinting): }) if pdf.version <= b'1.4': cids = sorted(font.widths) - padded_width = int(ceil(cids[-1] / 8)) + padded_width = int(ceil((cids[-1] + 1) / 8)) bits = ['0'] * padded_width * 8 for cid in cids: bits[cid] = '1'