1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-04 16:07:57 +03:00

Don’t crash with Pango 1.42

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.
This commit is contained in:
Guillaume Ayoub 2021-07-18 13:59:26 +02:00
parent 5fba476370
commit 51b90ecf26

View File

@ -97,7 +97,12 @@ class Layout:
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)