Repository navigation
fix(docx): set a shape container's stacked lines in from its outline, hold an empty row cell to a hairline, and stand inline shapes where the page puts them - #816
Merged
Conversation
…m a space before it
DemchaAV
force-pushed
the
fix/docx-midnight-navy
branch
from
October 2, 2026 08:57
cd5233a to
10f642d
Compare
… hold an empty row cell to a hairline, and stand inline shapes where the page puts them
DemchaAV
force-pushed
the
fix/docx-midnight-navy
branch
from
October 2, 2026 09:36
10f642d to
39f64d1
Compare
…he room no text gives back, and set in only layers written one under another Word condenses a letter in tenths of a point and LibreOffice not at all for a letter in a run of its own, so a run's room is spread over its letters in tenths. The last cell's width counts the room of every shape no text beside it gives back, skips right-to-left lines, and leaves the child's margins outside a placed column. A shape container's layers are set in as one only where each starts at or below the one before, or the two are a stack of lines. The Linux LibreOffice baseline is CI's measurement of this branch.
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
In Word,
MidnightNavy's sidebar was off by up to 25pt: 30 of its 86 lines were more than 2pt off, p90 19.86pt. Three causes stacked in one column, two of them partly cancelling:layerSetIn), so the initials were written from the ring's top. They stood 9.6pt high, and the name and everything under the ring 19.3pt.writeCellBodygave that cell the paragraph a cell must end with, bare, and Word set it a line of the document's font. Each row came out 2.1pt taller than the page's, and the ten rows took the column from −19pt to +2pt.DocxShapePictures.EDGE, a quarter point), and a ring's half stroke more. Each picture pushed the next dot 0.5pt or more further along than the page puts it. The fifth broke onto a second line, and each language row stood 9.7pt taller.What changed
layerSetIn: several paragraph layers are set in as one.holdStackedLines.writeCellBody: a cell left with nothing in it holds a hairline. The paragraph aw:tcmust end with is written at an exact 2 twips (holdToHairline), not at Word's own line. A cell holding a table still ends with a paragraph, as before.giveBackWidth: the text beside a shape gives back the room its picture takes past its box.DocxShapePictures.widthBeforeItsBox). The text after it gives back the room on the right (widthAfterItsBox). Each side is the ink's overhang plus an edge.giveTheLastCellItsInk: a row's last cell is widened to the shape ending its line.roomNotGivenBack).word-windows,libreoffice-windowsandlibreoffice-linuxare rewritten for the documents this moves. The Linux one is CI's measurement of this branch (run 36990734127), unedited.CHANGELOG.md, and the shape container paragraph ofdocs/recipes/docx-export.md.Verification
Template corpus, re-measured in full against the baselines of test(qa): measure a DOCX fidelity line from its first letter, not from a space before it #815. That PR measures a line from its first letter, which this change needs: otherwise a hairline cell beside a label measured the label 3.5pt off.
MidnightNavyCharcoalGoldMidnightNavyNo other document changes in either editor.
CharcoalGold's six newly found lines are dates and role titles. Which of the changes finds them is not pinned down.In Word the dots stand where the page puts them.
Two LibreOffice lines are further from the page, and their baseline is rewritten.
MidnightNavystands about 2.7pt low, from the top of the sheet.The causes, measured before the code.
New tests:
DocxOverlayBandTest.aShapeContainersStackedLinesStandWhereTheOutlineSetsThem. Two initials in a 76pt ring are written from where the ring sets the first. The paragraph under the ring stands the ring's foot under the last. Both are read off the layout.DocxOverlayBandTest.aCellOfDrawingAloneHoldsAHairline.MidnightNavy's skill row is held in a layer as the template holds it. The meter's cell writes no run and ends at an exact 2 twips.DocxInlinePictureTest.theTextBesideADotGivesBackTheRoomItsPictureTakesPastItsBox. The four spaces between two dots, and the text after the last, are set closer by whole tenths. Text whose room comes to less than a tenth a letter is left alone.DocxInlinePictureTest.aLineBreakAfterADotKeepsItsLetters.DocxInlinePictureTest.textWithNoShapeBesideItKeepsItsSpacing: text beside a picture keeps its spacing.DocxInlinePictureTest.aRowsLastCellIsWidenedToTheRingEndingItsLine. Five rings against each other, none of their edges given back, widen their column by more than a point a ring. Rings with spaces between them and room to spare keep their column.Each rule fails its own test when taken out.
giveBackWidthtaken out fails the dot test.giveTheLastCellItsInktaken out fails the column test.Full reactor gate:
./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 -amgives BUILD SUCCESS. render-docx runs 791 tests, qa 1814.Known limits
MidnightNavyabout 2.7pt low throughout, andSlateOrange3pt. Several other sidebar CVs show the same:CharcoalGold,MonogramSidebar,NavySidebar,ProfessionalSidebarandSidebarPortrait. That is one investigation of its own.Lane: shared-engine (render-docx). No public API change.