Repository navigation
fix(docx): take a drawn shape's picture frame from the space around its line - #824
Merged
Merged
Conversation
… LibreOffice baseline from CI
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 drawn shape is written as a picture larger than its ink by a transparent frame on every side (
DocxShapePictures.EDGE, 0.25pt), so antialiased edges are not cut.A paragraph holding only such pictures, whose picture leaves the text's height, is written with its line at least the pictures' reach (
makeRoomForPictures). It is not held exact (holdPicturesInTheLinetakes lines with text only). Word then makes the line as tall as the picture itself, frame included.MonogramSidebar's contact column is an icon paragraph over a text paragraph per contact. Each 22pt glyph is a 22.5pt picture. Every icon line stood half a point taller than the page's, and every contact half a point lower than the one above: 0.63, 1.11, 1.59, 2.21, 2.69pt. The education and skills columns under them inherited the 2.8pt. Those are all 17 of the document's lines more than 2pt off in Word.What changed
PictureReachcarriesboxAboveandboxBelow: how far the picture's own edges reach past the page's line, frame included. A drawn shape's frame isEDGE; an image's or an SVG icon's is 0, so for them the two are its ink's reach.takeThePicturesEdgesFromAroundapplies to a line of the paragraph's own that holds only pictures, written at least their reach, where a drawn shape has a frame. Word grows that line to the pictures' box, edge to edge. The export takes exactly that growth: from the paragraph's space above as far as the box passes the line's top, the rest from the space above what follows (hangingBelow), asholdPicturesInTheLinetakes a held line's ink.word-windows,libreoffice-windowsandlibreoffice-linuxare rewritten forMonogramSidebar, the one document this moves. The Linux one is taken from this PR's CI run (docx-fidelity-37076030391), where the median goes from 3.57 to 2.90pt as on Windows.CHANGELOG.md, and the Line height row ofdocs/recipes/docx-export.md.Verification
Template corpus, re-measured in full. Only
MonogramSidebarchanges, in both editors.LibreOffice's lines past 2pt are its 2.8pt header offset on the sidebar CVs, which this change does not touch.
New test class,
DocxPictureLineEdgeTest, two tests.The take fails the first test when taken out: without it the paragraphs keep 80 and 160.
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 822 tests, qa 1814.Known limits
Lane: shared-engine (render-docx). No public API change.