From 51b90ecf268d25162e176a941d784b3651c08b13 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sun, 18 Jul 2021 13:59:26 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20crash=20with=20Pango=201.42?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Debian stable (Buster, 10) includes Pango 1.42. Until the next version of Debian (Bullseye, 11) is released, keep a workaround to avoid crashes. This workaround is not documented on purpose, support of Pango 1.42 will not be improved. Also note that WeasyPrint with Pango 1.42 will suffer from #1199. Fix #1384. --- weasyprint/text/line_break.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weasyprint/text/line_break.py b/weasyprint/text/line_break.py index ed17d0fe3b..e2943a8c5b 100644 --- a/weasyprint/text/line_break.py +++ b/weasyprint/text/line_break.py @@ -97,7 +97,12 @@ def setup(self, context, font_size, style): pango_context = ffi.gc( pango.pango_font_map_create_context(font_map), gobject.g_object_unref) - pango.pango_context_set_round_glyph_positions(pango_context, False) + try: + pango.pango_context_set_round_glyph_positions(pango_context, False) + except AttributeError: + # TODO: remove this when Cairo 1.44+ is in Debian 11 is released. + # See https://github.com/Kozea/WeasyPrint/issues/1384. + pass self.layout = ffi.gc( pango.pango_layout_new(pango_context), gobject.g_object_unref)