fix(docx): hold a line of text and its icon at the page's height, taking the icon's reach from the gaps around it - #794
Merged
Merged
Conversation
…ing the icon's reach from the gaps around it
…ing, and seat the line however little
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,
TimelineMinimal's contact lines each stood 0.9pt taller than on the page, and the page under them stood 4.4pt low. Each line is a 10.5pt icon lowered beside smaller text.makeRoomForPictureswrote the line "at least" the picture's reach, and Word grew it to its own natural height.What changed
holdPicturesInTheLine. Where a picture passes its text, a paragraph of one line of text written in its own Word paragraph keeps an exact line at the page's height of it (ParagraphLine.lineHeight).seatInTheLinesets the text on the page's baseline, and the pictures move with it. The seat is applied however small it is.w:before, and the Word line starts that much higher, which the seat is computed from. Room below goes tohangingBelow, which the next paragraph or table takes off its space.INK_ROOM_POINTS(half a point) past the ink on either side, taken the same way as far as the space above goes. Word rounds the picture's position and the text's seat to half points each, and without the room an icon as tall as its line lost 0.2 to 0.4pt at an edge.seatShift) moves the pictures with the text, and counts towards their reach.PictureReach. It now carriespageLine, andabove/below: signed distances from the ink to the page's line, where Word puts the ink.makeRoomForPicturesas before:CHANGELOG.md,docs/recipes/docx-export.md(the Line height row and the "Pictures and icons in a line" section) and the inline-images row ofdocs/architecture/backend-capability-matrix.mdare updated.Verification
./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 (1791 + 127 tests).extract-api --checkpass.DocxInlinePictureTest(new tests). An icon line sits between two lines of text 3pt apart, so the room it takes above and below can be read from the space written above it and above the line after it:TimelineMinimal: the line ends 1.85pt lower, and the next line's space is that much shorter.PictureReachunit tests cover signed reach and how several pictures combine.2.5-dev, lines more than 2pt off:TimelineMinimal67 → 0 (median 4.1 → 1.4pt);MerchantInvoice27 → 1;CharcoalGold28 → 0;SidebarPortrait20 → 0;MintEditorial14 → 0.TimelineMinimalmedian 10.5 → 1.4pt;MerchantInvoice8.4 → 0.2pt.TimelineMinimalshows its full height, as before.Known limits
w:positionon a picture and stands it on the baseline, a lowered icon in such a line stands higher than its text and loses what passes the line's top. Its text had drifted up to 11pt before. No exact geometry seats the icon for LibreOffice withinTimelineMinimal's 3pt gaps.NavySidebar, LibreOffice's contact lines now step as the page's, which uncovers a constant 3.6pt offset of the sidebar that was there before.Lane: shared-engine (render-docx). No public API change.