Repository navigation
fix(docx): start a picture-marked list item's text where the page does, a tab past the marker and its gap - #835
Merged
Merged
Conversation
…s, a tab past the marker and its gap
…inux LibreOffice baseline from CI, and name the drawn-marker exception in the list docs
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 item whose marker is a picture — a dot, an icon — was written in DOCX as the picture, a space and the text. The page leaves the list's
markerGapafter the marker; a space is a little over 2pt.TealPulse's skills, highlights and certifications (a 3.2pt dot, a 9.2pt gap) stood 6.3 to 6.7pt left of the page's in both editors, andOrangeOps' 6pt in Word. These were the corpus's largest horizontal offsets by line count, made visible by the gate's new horizontal check (#834).markerGaphad been left out of DOCX for two reasons:Both have changed for a marker that is a picture alone. The export now has the layout, which places the marker and its text as two fragments. And Word draws a picture at the size it is written.
What changed
DocxLayoutMetrics.markerToText(list). It gives how far right of its marker a list's first item's text starts: the text fragment's x less the marker fragment's x. That is the marker's width and the gap, as the layout resolved them.DocxSemanticBackend.writeRichListLine. It writes a tab after a marker that is a picture alone, with a left tab stop that distance past the first line's start (tabTo). The start is the paragraph's left indent and first-line indent, the origin Word measures tab stops from in the body and in a cell. This applies only to a top-level item whose marker is the list's:writeListItems;writeNestedItemat depth 0, when the item's marker equals the list's.drawnWidth, more than 0.1pt clear). Otherwise the tab would run on to Word's next default stop, half an inch on. A dot withmarkerGap(0)keeps its space.ListBuilder.hangingIndent/markerGapJavadoc (core; no signature change),docs/recipes/docx-export.md, the capability-matrix rows for list hanging indent and inline shapes, and CHANGELOG say what DOCX now keeps.Verification
scripts/docx-visual/word-fidelity.ps1(Word 16.0.20430) → BUILD SUCCESS, baseline rewritten with-Update.TealPulse(28 lines) andOrangeOps(11 lines) moved, all across: from −6.72…−5.98pt to within 0.1pt.TealPulse's 28 lines moved from −6.6…−6.26 to within 0.08pt; nothing else moved. Lines past 2pt across: 130 → 102. Baseline rewritten. The Linux baseline is this PR's CI artifactdocx-fidelity-37159605087: the same 39 lines (TealPulse 28, OrangeOps 11) nearer across, none worse or lost; Linux lines past 2pt across 427 → 388.DocxListMarkerGapTest(new, 6 tests):DocxSemanticBackendTest.aDrawnListMarkerIsItsPicture…now expects the tab and checks its stop at the dot's width plus the default gap, where it pinned the space../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).CommittedAssetDriftTestinexamples→ 3/3 green.Notes
docs/recipes/lists.mdand the Javadoc ofDocxHangingIndentIsIgnoredTestnow name the exception.ListMarkerGeometry);ListBuilder.build()gives each the list's marker instance. A hand-builtListNodewhose first item draws a marker of its own could lend its offset to the others; the DSL builds no such list.Lane: shared-engine (render-docx), with a Javadoc correction in core.