mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 16:37:47 +03:00
Fixed list item markers vertical alignement;
adjust vertical position taking into account line height of list item
This commit is contained in:
parent
8f5b2a9053
commit
4569c15b3e
@ -16,6 +16,7 @@ from .percentages import resolve_percentages
|
||||
from .replaced import image_marker_layout
|
||||
from ..text import split_first_line
|
||||
from ..formatting_structure import boxes
|
||||
from ..css.computed_values import strut_layout
|
||||
|
||||
|
||||
def list_marker_layout(context, box):
|
||||
@ -41,6 +42,13 @@ def list_marker_layout(context, box):
|
||||
# content-box.
|
||||
# TODO: align the baselines of the first lines instead?
|
||||
marker.position_y = box.content_box_y()
|
||||
|
||||
# Adjust y position taking into account line_height
|
||||
line_height, baseline = strut_layout(box.style, context.enable_hinting)
|
||||
height = box.style.font_size
|
||||
half_leading = (line_height - height) / 2.
|
||||
marker.position_y += half_leading - 1.0
|
||||
|
||||
# ... and its right with the left of its list-item’s padding box.
|
||||
# (Swap left and right for right-to-left text.)
|
||||
marker.position_x = box.border_box_x()
|
||||
|
Loading…
Reference in New Issue
Block a user