mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 08:27:22 +03:00
parent
d6da699f91
commit
cd925bc76c
@ -1085,10 +1085,9 @@ def aligned_subtree_verticality(box, top_bottom_subtrees, baseline_y):
|
||||
# Account for the line box itself:
|
||||
top = baseline_y - box.baseline
|
||||
bottom = top + box.margin_height()
|
||||
# Ignore differences smaller than 0.5 to work around Pango roundings
|
||||
if min_y is None or min_y - top > 0.5:
|
||||
if min_y is None or top < min_y:
|
||||
min_y = top
|
||||
if max_y is None or bottom - max_y > 0.5:
|
||||
if max_y is None or bottom > max_y:
|
||||
max_y = bottom
|
||||
|
||||
return max_y, min_y
|
||||
@ -1156,18 +1155,17 @@ def inline_box_verticality(box, top_bottom_subtrees, baseline_y):
|
||||
top_bottom_subtrees.append(child)
|
||||
continue
|
||||
|
||||
# Ignore differences smaller than 0.5 to work around Pango roundings
|
||||
bottom = top + child.margin_height()
|
||||
if min_y is None or min_y - top > 0.5:
|
||||
if min_y is None or top < min_y:
|
||||
min_y = top
|
||||
if max_y is None or bottom - max_y > 0.5:
|
||||
if max_y is None or bottom > max_y:
|
||||
max_y = bottom
|
||||
if isinstance(child, boxes.InlineBox):
|
||||
children_max_y, children_min_y = inline_box_verticality(
|
||||
child, top_bottom_subtrees, child_baseline_y)
|
||||
if children_min_y is not None and min_y - children_min_y > 0.5:
|
||||
if children_min_y is not None and children_min_y < min_y:
|
||||
min_y = children_min_y
|
||||
if children_max_y is not None and children_max_y - max_y > 0.5:
|
||||
if children_max_y is not None and children_max_y > max_y:
|
||||
max_y = children_max_y
|
||||
return max_y, min_y
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user