Repository navigation
fix(docx): start a body panel's text the whole padding in, its left border centred on its edge - #842
Merged
Merged
Conversation
…order centred on its edge Both Word and LibreOffice start a body table's text at its indent and centre its left border on its edge, as the page centres the panel's. The export took half the left border off the cell's margin and the indent and made the table that much wider, for an editor that keeps the border inside the cell: every line in ModernInvoice's header panel, behind a 4pt accent, stood 2pt left of the page's in both. In the body, the left margin is now the whole padding, the indent the text's place, and the table no wider on its left. Lines more than 2pt off across fall from 12 to 4 in Word; nothing moves down.
…he Linux build that reads it otherwise Word 16 and LibreOffice on Windows start a body table's text at its indent; the LibreOffice build on the Linux CI reads the indent as the table's edge, its text a margin further in, so these panels, a padding right of the page's there already, stand the border's width further. The Linux baseline is this branch's CI measure. A test pins that a panel in a cell keeps the padding less half its border as its left margin.
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
A panel — a filled or bordered container — is a one-cell table. Its cell's margins were the padding less half of each border, and the table half a border wider on each side, on the model that an editor keeps a cell's border inside the cell.
For a panel in the body, Word and LibreOffice on Windows measured otherwise. On
ModernInvoice's header panel, behind a 4pt left accent:Word 16 and LibreOffice on Windows (build bce0998) both start a body table's text at its indent and centre its left border on its edge, so half the border taken off the margin and the indent stood every line in the panel 2pt left of the page's. The same held for
ModernProposalandClassicInvoice(2pt),NordicCleanandModernReceipt(1.5pt), andEditorialProposalandNorthlineProposal(up to 0.55pt).What changed
writePanelPiece, for a panel in the body (currentCell == null) only:w:tblInd) is the padding in, where the text starts, no longer less half the left border;A panel in a cell keeps its geometry, including #838's trim. So does the right side, which nothing has measured otherwise. Javadoc of
writePanelandinsideTheBorders, the recipe's panel section, the capability matrix's panel row and CHANGELOG are updated.Verification
scripts/docx-visual/word-fidelity.ps1 -Update(Word 16.0.20430) → BUILD SUCCESS.ModernInvoice,ModernProposal: −2.04 → 0.00).ObsidianInvoiceitems (up to 0.36pt) andModernReceipt's status chip (+7.60 → +9.16).ObsidianInvoiceup to 0.30pt, the chip 1.50pt), nothing down.ModernInvoice+12.05,NordicClean+8.60,ModernReceipt+14.60), and stand the border's width further (+16.10, +11.60, +17.60): 78 lines further, none nearer, past 2pt across still 301. The baseline is this PR's CI artifact. The two readings cannot both be met by one indent; Word is the reference, and Windows LibreOffice agrees with it. Whether writing an explicit compatibility mode makes that build read the indent as Word does is untested and its own change.ObsidianInvoice's items are a table inside a panel with a 0.625pt border all round. That table's text box was already narrower than the page's (left +0.34, right −0.27 in Word), and the panel's content now moves half that border right with everything else in it.ModernReceipt's status chip moves with its panel's content. It stood 7.6pt right before, because the chip's padding is not in the file, which the export reports. That is its own fix.DocxContainerPaintTest.aBorderStraddlesThePanelsEdgeAsOnThePage: a 3pt accent and 14pt padding give a left margin of 280 twips (was 250), an indent of 280 (was 250), and a table as wide as the panel and the slack (was 1.5pt wider).DocxPanelInsetTest.aPaddedPanelsTextIsHeldInByTheCellNotByAnIndent: the left margin is 14pt (was 12.5).DocxContainerPaintTest.aNestedPanelIsPlacedByItsBordersOuterEdge: a panel in a cell keeps the padding less half its border as its left margin (applying the body's rule in a cell fails it, and fix(docx): keep a panel hung by its left border inside its cell, so Word does not widen the cell #838's test)../mvnw -B -ntp clean verify -pl :graph-compose-core,:graph-compose-render-pdf,:graph-compose-render-docx,:graph-compose-render-pptx,:graph-compose-templates,:graph-compose-testing,:graph-compose-qa,:graph-compose-coverage -am→ BUILD SUCCESS (qa 1820 tests).CommittedAssetDriftTest→ 3/3 green.Notes
Lane: shared-engine (render-docx).