Add bounded line expansion for Times body text

This commit is contained in:
gloamxun committed 2026-10-28 23:19:16 +08:00
1 parent 8fef7df187
commit 01b3f518cb
10 files changed
+113 -9

No files matched your search

+18
View File
@@ -37,3 +37,21 @@ expansion window during line breaking (microtype-like), record the chosen
expansion per line, and apply the same factor when painting PDF/SVG text. This
keeps line targets and glyph advances consistent instead of adding overflow or
collapsing interword glue.
## First result
- Added `ParagraphStyle.line_expansion` (thousandths), per-line `line_scales`
on `Paragraph`, and renderer x-advance compression.
- Times text uses a 2% expansion window. The 2.1 paragraph is now **six lines**
(was seven). Text still renders with visible word spaces.
- `3.3 Tables` remains on page 3. The reason is now localized in the page
builder: a top float that does not fit flushes the current page at
`VerticalItem::Float` instead of deferring only the float, so following text
cannot continue on page 2.
- Fidelity moved 0.8944 -> 0.8916 because line breaks and `pdftotext` word
boundaries changed; this is a geometry/flow tradeoff, not a claimed win.
## Next
Defer non-fitting top floats instead of flushing the page, then re-test 3.3.