Simple workaround for a dirty Pango bug

Solution given by 🍰 @Tontyna 🍰

Fix #614, fix #585.
This commit is contained in:
Guillaume Ayoub 2018-04-30 23:52:52 +02:00
parent 136587bff6
commit 3a700901bf
1 changed files with 12 additions and 4 deletions

View File

@ -792,10 +792,6 @@ def split_inline_box(context, box, position_x, max_x, skip_stack,
# TODO: should we also accept relative children?
if (child.is_in_normal_flow() and
can_break_inside(child)):
# This waiting child is in flow and can be broken,
# let's break it!
break_found = True
# We break the waiting child at its last possible
# breaking point.
# TODO: The dirty solution chosen here is to
@ -810,6 +806,18 @@ def split_inline_box(context, box, position_x, max_x, skip_stack,
absolute_boxes, fixed_boxes,
line_placeholders, waiting_floats,
line_children))
# As PangoLayout and PangoLogAttr don't always
# agree, we have to rely on the actual split to
# know whether the child was broken.
# https://github.com/Kozea/WeasyPrint/issues/614
break_found = child_resume_at is not None
if child_resume_at is None:
# PangoLayout decided not to break the child
child_resume_at = (0, None)
# TODO: use this when Pango is always 1.40.13+:
# break_found = True
children = children + waiting_children_copy
if child_new_child is None:
# May be None where we have an empty TextBox.