Added press state, fixed font registry
Python CI / test (3.10) (push) Successful in 2m2s
Python CI / test (3.12) (push) Successful in 1m52s
Python CI / test (3.13) (push) Successful in 1m47s

This commit is contained in:
2025-11-09 17:45:53 +01:00
parent 9ae8ddddca
commit 849ba2f60f
7 changed files with 854 additions and 39 deletions
+22 -9
View File
@@ -100,15 +100,28 @@ def paragraph_layouter(paragraph: Paragraph,
# Cap font size to page maximum if needed
if font.font_size > page.style.max_font_size:
font = Font(
font_path=font._font_path,
font_size=page.style.max_font_size,
colour=font.colour,
weight=font.weight,
style=font.style,
decoration=font.decoration,
background=font.background
)
# Use paragraph's font registry to create the capped font
if hasattr(paragraph, 'get_or_create_font'):
font = paragraph.get_or_create_font(
font_path=font._font_path,
font_size=page.style.max_font_size,
colour=font.colour,
weight=font.weight,
style=font.style,
decoration=font.decoration,
background=font.background
)
else:
# Fallback to direct creation (will still use global cache)
font = Font(
font_path=font._font_path,
font_size=page.style.max_font_size,
colour=font.colour,
weight=font.weight,
style=font.style,
decoration=font.decoration,
background=font.background
)
# Calculate baseline-to-baseline spacing: font size + additional line spacing
# This is the vertical distance between baselines of consecutive lines