Repository navigation
fix(docx): let a line of pictures alone be as tall as its pictures where they fill the page's line - #814
Merged
Conversation
…ere they fill the page's line
…d, and measure a face no font holds as unknown An internal link's runs are not among the paragraph's own, so getText() missed their text and set it at a point; holdsOnlyPictures reads every run for a letter, break, tab, symbol or field. A face the measured fonts do not hold measures 0 instead of failing an export written without a layout.
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,
SlateOrange's sidebar ran lower the further down it went: 36 of its 87 lines were more than 2pt off, p90 4.99pt.Each skill is a table row: a 12.4pt icon in a paragraph of its own, no text in it, beside its label. That paragraph is composed in a table cell, so the layout lays out no line for it. It is written with no line height, and Word sizes the line itself. The line is its tallest run, and the paragraph's mark is a run. Set in the icon cell's style at 10.5pt, the mark's depth below the baseline went under the icon. Each row came out 0.2pt taller and the tenth 2.5pt low, with everything in the sidebar under them.
What changed
letThePicturesSetTheLine, at the end ofwriteParagraphRuns. A paragraph that holds only pictures and has no exact or least line has its mark and every run set at 1pt (ONE_POINT_IN_HALF_POINTS). Word then makes the line the pictures' height.holdsOnlyPictures): no letter, break, tab, symbol or field. An internal link's runs are not among the paragraph's own, sogetText()cannot see their text.PICTURE_FILLS_ITS_LINE, 0.5pt).styleLineHeight).VioletGrid's bullet dots had their lines cut to the dots, and every bullet stood 5.8pt high in Word. That is why the rule is scoped.word-windowsis rewritten forSlateOrange, the one document this moves.CHANGELOG.md, and the Line height row ofdocs/recipes/docx-export.md.Verification
Template corpus, re-measured in full against
2.5-dev's baselines. Every row of both editors' measurement was compared, not only the gate's regression check. The figures are the gate's own: before is the committed baseline, which2.5-dev's output re-measured to byte for byte.SlateOrangeNo other document changes in Word. No document changes in LibreOffice.
The cause, measured before the code. In the exported DOCX the ten icon paragraphs were set by hand, once with a 1pt mark and runs and once with an exact 12.4pt line. Converted in Word, both gave 8 lines past 2pt, and "Time Management" went from +2.50pt to +0.58 by line origin. The exact line is not used: Word stands a picture on a baseline four fifths down an exact line, and cuts its top on screen.
New tests,
DocxPictureLineTest:Each rule fails its own test when taken out.
getText()in place ofholdsOnlyPictures, the link test fails.styleLineHeight, the unknown-face test throws.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 785 tests, qa 1813.Known limits
SlateOrange's lines are still past 2pt in Word:SlateOrangestands about 3pt low throughout, from its masthead down. That is a separate cause.Lane: shared-engine (render-docx). No public API change.