Repository navigation
fix(docx): take what a spacer's line and a taller paragraph reach past their block out of the space below - #874
Merged
Conversation
…t their block out of the space below - A spacer shorter than its hairline - a width anchor of no height, as Panel's and PanelLetter's cards open with - leaves the rest of that tenth of a point hanging below it: the next block takes it out of the space between them, or names it (space above). It stood every card that much taller in Word. - A paragraph Word sets taller than the page - written at its tallest line, where the page sets a wrapped line after a large first one at its own height - hangs what it passes the page by below itself the same way. - Both by more than a tenth of a point only: Word sets lines on a grid 0.12pt apart, and a paragraph written at its tallest line still owes nothing for its twip rounding. - A paragraph the layout opens a page with, with no top edge of its own, leaves the hang, pull and border below the block above on the page above. Fidelity baselines (Word, LibreOffice on Windows) rewritten: nine documents nearer the page in Word, none further.
…w page forgets it - A paragraph or a spacer the layout opens a page with, and a panel, table or row it moves there, name a hang left over a block on the page above - a list item, a line pair, which take nothing out of a top edge of their own - before they forget it, as the next block would have. - oweWhatTheLinesFallShort is settleTheLinesWithThePage: it owes a shortfall and hangs a surplus. Its Javadoc, and the CHANGELOG and recipe, state the rounding rule as measured: what rounding adds over a paragraph's lines hangs, what it takes from one written at its tallest line is not owed. - Tests: a one-size paragraph's rounding surplus, a list item's leftover named at a page end, a spacer of no height named with no space below it, ending a padded card, and taken by the block after it on a new page.
…cer and line hangs Measured by CI's LibreOffice on Linux on this branch: 8 of the 62 documents change, 7 standing nearer the page in median and letter-panel further, as on Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two things reach past their block in Word, and neither was taken out of the space below it or
named: what followed stood lower than the page sets it, silently.
tenth of a point tall, its height less that tenth owed below it. A spacer of no height — a width
anchor, as
Panel's andPanelLetter's cards open with — kept the whole tenth: every card stoodthat much taller in Word.
one height; for lines in more than one size the export writes the tallest line's, and the page
sets each line at its own, so a wrapped line after a large first one stands closer on the page.
What a paragraph fell short of the page was owed below it; what it passed the page by was
not.
CompactMono's skills, two lines to a paragraph and each written 0.12pt taller than thepage, ended its sidebar a point low in Word.
What changed
All in
DocxSemanticBackend:writeSpacer: a spacer shorter than its hairline leaves the rest of that tenth ashangingBelow— the mechanism a line held to its icon already uses. The next block takes it outof the space owed above it, then out of its own top edge, and names what is left (
space above). Ending a cell, the space the cell owes below takes it first, then the cell's overhang,which a row or a panel takes (its padding below). The spacer is still written, so a band, a
layer column or a shape container measures and writes it as before.
settleTheLinesWithThePage(wasoweWhatTheLinesFallShort): a paragraph whose written linespass the page by more than a tenth of a point hangs that below itself the same way.
LINES_ROUNDING_TOLERANCE= 0.1pt both ways. Measured: Word sets baselines on a grid 0.12pt(1/600in) apart — a 194-twip exact line steps 9.72pt six times and 9.60 once — so a correction
under a tenth of a point moves a line a step or nothing: at 0.01pt, 13 documents moved nearer the
page in Word and 13 further. Past that, the two directions are measured, not assumed:
OrangeOps' achievement lines, a0.08pt gap between them written as a tenth, and
SlateOrange's profile stand nearer the pagein Word with it (median 0.29 → 0.22pt and 0.48 → 0.40pt; without it, as on
2.5-dev);lineIsNotTheTallestgate stays): owed, it stood the lines belowModernInvoice's parties agrid step or two lower, and four other documents further from the page.
holdAParagraphsTopEdgeOnItsPage,leaveThePageAboveand a spacer opening a page now namewhat a block on the page above never took (
nameAHangLeftOver) before they forget the hang, pulland border below it — and the paragraph one forgets them before its early return for a paragraph
with no top edge to hold, which used to leave the hang to be named, falsely, on the next page.
Docs: the recipe's Spacers and Line height rows, the "A spacer is its height alone" paragraph and
the one on text running past a block's foot;
CHANGELOG.md(v2.5.0).Verification
./mvnw -B -ntp clean verify→ BUILD SUCCESS: render-docx 1318 run, 0 failures, 1skipped (+11), qa 1820, core 818.
DocxLineSurplusTest(7): the space below takes a taller paragraph's surplus; what it cannottake is named; a paragraph ending a page leaves it there; what a list item ending a page never
took is named there; the space below takes what a one-size paragraph's rounding adds; a paragraph
written at its tallest line owes nothing for what its rounding takes; a spacer of no height with
no space below it is named.
DocxContainerSpacingTest(+3): the spacer in the flow, opening acard, and ending a padded card (its padding below takes the tenth).
DocxSpaceAboveOnANewPageTest(+1): a spacer of no height opening a page holds the gap in its line, and the block after it
takes the tenth.
paragraph's surplus dropped (four), the shortfall's gate dropped so rounding is owed, the reset
moved back after the page-top return, rounding's surplus left, the page-top leftover forgotten
unnamed.
as on
2.5-dev). Word baseline (word-windows*.tsv, viascripts/docx-visual/word-fidelity.ps1 -Update): all 9 nearer the page in median —cv-panel0.83 → 0.46pt,cv-compact_monop900.91 → 0.36pt (its sidebar's foot from about +0.95pt to −0.05pt),
cv-nordic_clean0.23 → 0.16,cv-monogram_sidebar0.28 → 0.20,cv-orange_ops0.29 → 0.22,cv-slate_orange0.48 → 0.40;letter-panel0.16 → 0.14 in median, further in its p90 (0.21 → 0.29pt, below). LibreOffice onWindows (
libreoffice-windows*.tsv): 7 nearer,cv-orange_opsunchanged,letter-panel0.13 →0.19pt. LibreOffice on Linux (
libreoffice-linux*.tsv, from CI'sdocx-fidelityartifact): 7nearer —
cv-orange_ops0.26 → 0.18pt among them — andletter-panel0.13 → 0.19pt, as onWindows.
Notes for review
letter-panel's text now starts where the page sets its card; what is left is how far botheditors seat its body text off the page's baseline in an exact line — 0.12pt higher in Word, as
in LibreOffice — a separate defect.
now for these two sources too, left for their own change: a band's later layer and a layer
column resuming after another (
resumeHere); a band's foot; a composed table cell or a layercolumn, whose cell overhang nothing reads; and a block other than a paragraph, a panel, a table,
a row, a band or a spacer that the layout opens a page with — a list, a line pair, a picture —
which takes the hang from the page above and names it falsely.
Lane: shared-engine (DOCX backend) —
render-docxonly, no public API.