Repository navigation
fix(docx): wrap a list without hangingIndent where the page does, its marker a space ahead - #839
Merged
Merged
Conversation
… marker a space ahead The page sets such an item's first line as the marker, a space and the text, and every wrapped line after the spaces covering the marker; the Word list's levels were a stated 9pt column with a tab. The top level of a placed list that does not nest now takes the width of those spaces in the list's style as its indent and hanging, w:suff="space", the level in the list's face and size. An item that wraps is measured at Word's half-point size, less a point and never short of its widest line, so it breaks at the page's words. Lines more than 2pt off across fall from 72 to 49 in Word and from 77 to 54 in LibreOffice; nothing moves down.
…ps its level's column Word and LibreOffice take each side of w:ind on its own: an item that wraps now carries only its right indent and follows its level when an editor changes it; measured, no line moves in either editor. The tests pin the prefix column against the stated 9pt and the item's own column; the Linux LibreOffice baseline is this branch's CI measure (358 to 335 past 2pt across).
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 list without
hangingIndentis laid out with its marker inside the item's text: the first line is the marker, a space and the text, and every wrapped line starts after the spaces that cover the marker and that space (ParagraphWrapping's continuation prefix). The DOCX export makes it a Word list whose levels are a stated 9pt column with a tab after the marker, so Word wrapped the lines at 9pt whatever the page did:ModernInvoice's andClassicInvoice's notes (and their long variants): wrapped lines 2.6pt left of the page's;MidnightNavy's bullets 3.7pt right,SlateOrange's 2.6pt right.What changed
numberingFor/prefixColumn. The top level of a Word list the layout placed, withouthangingIndent, that does not nest, with a visible marker of text, takes as its indent and hanging the width of the spaces covering the marker and its space, in the list's style (spacesCovering, the same count the layout takes).w:suff="space"), so the first line reads marker, space, text as on the page. The lite schema has no type forw:suff;followTheMarkerWithASpacewrites it through anXmlCursor, beforew:lvlTextas the schema orders it.measureTheItemAtWordsSize. In that column an item has exactly the page's measure, and Word sets a size the page gives to the tenth at the half point. An item that wraps gets a right indent that grows or shrinks its measure in the same proportion, less a point, asmeasureAtWordsSizedoes a paragraph's.w:indis its right side alone: Word and LibreOffice take each side ofw:indon its own, so the item keeps its level's column and follows the level when an editor changes it (measured: writing the column on the item as well moves no line in either editor).DocxLayoutMetrics.itemLines, which replacesitemLineCounts.docs/recipes/docx-export.md(what a list becomes), capability matrix (list row), CHANGELOG.Verification
scripts/docx-visual/word-fidelity.ps1 -Update(Word 16.0.20430) → BUILD SUCCESS.MidnightNavy+3.70 → +0.10;SlateOrange+2.64 → 0.00.TerracottaRail(+0.30 → +0.06) andNavySidebar(−0.18 → +0.06) nearer.MidnightNavy(84 of 86) andOrangeOps(106 of 108), their items now breaking as the page does.MidnightNavyfinds four lines more.MidnightNavyandOrangeOps.TerracottaRail's 8.6pt items, set at 8.5, took a word onto a line the page breaks it from, and the column under them rose 11.5pt in Word; with it, nothing moves down.DocxListNumberingTest, three new:DocxListLevels); two assert the prefix column (not 180, as wide as it hangs) and the space.w:suff;nests()only (the leaf tree reads 234 twips);./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 after regeneratingassets/readme/examples/word-export-companion.docx, whose list now carries the column and the space (onlyword/numbering.xmland the timestamp differ).Notes
"• "to the half point, not the column. The corpus puts every first line's marker within 0.1pt; the text after it is not measured.Lane: shared-engine (render-docx).