Skip to content

fix(#8): support default variable font#60

Merged
francozanardi merged 4 commits into
mainfrom
fix/8-support-default-variable-font
Apr 3, 2026
Merged

fix(#8): support default variable font#60
francozanardi merged 4 commits into
mainfrom
fix/8-support-default-variable-font

Conversation

@francozanardi

Copy link
Copy Markdown
Owner

Fixed

  • Text Layout (height with wrapping): Containers with wrapped text no longer reserve excess vertical space. Previously, when Taffy queried the min-content size of a text node, the reported height was based on one word per line, causing the parent container to over-reserve height even when the final allocated width allowed for more efficient reflow.
  • Font Weight and Style on default fonts: font_weight() and font_style() now work correctly when using the default font, which is a variable font. Note that the current built-in default font only exposes the weight axis.

Closes #8

…nd style for default fonts.

keep in mind the current default font only has weight axis available.
When Taffy requests min-content size, we were shaping with wrap_width=0
(one token per line) and reporting both the resulting width and height.
This caused Taffy to over-reserve vertical space: it assumed the column
needed the artificially tall height, even though the final allocated width
(equal to the longest word) allows much more efficient text reflow.

Fix: for min-content queries, compute the true min-content width first
(wrap_width=0), then re-measure height using that width. This ensures
the reported height is consistent with what the node actually needs at
the width Taffy will allocate.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pictex/text/font_manager.py 50.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@francozanardi francozanardi merged commit 10e1e2a into main Apr 3, 2026
10 checks passed
@francozanardi francozanardi deleted the fix/8-support-default-variable-font branch April 3, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support using font weight + font style in default font

2 participants