Repository navigation
fix(docx): set a layer across where its offset moves it - #923
Merged
Merged
Conversation
A stack of one layer is written as its contents, and its layer stood at the stack's left edge however far its offset moved it. A band held each layer in to its box, but only inward, so a layer the page sets left of the stack stood at the stack's edge. Measured in Word and LibreOffice, text moved 40pt in, and text set 20pt into the margin, stood at the margin in both. holdIn now holds a block to its box on both sides, past an edge by an indent below zero, with no room to spare added there. A layer moved whole keeps the page's measure. A stack's one layer is held the same way through placeAcross. In a table cell, whose text starts no further left than the cell's own, a block stands left only as far as the indents round it give, and the rest is named. An offset down or up moves a stack's one layer without making room for it, which Word's flow cannot do. It is named (layer offset), as is one moved across in a table cell, or in a table's composed cell, where it is written where the stack starts. Not where a band or a column sets the next block at the page's distance, which holds the offset.
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 layer's offset moves it on the page, and the DOCX export lost it without a word in two places.
Measured in Word 16 and LibreOffice on Windows, on a 400×600pt page with 72pt margins:
position(text, 40, 10)position(text, -20, 5)After the change, a stack's one layer of three lines moved 40pt in stands at x 112 in both editors.
Its lines break at the page's words.
stack's left edge.
holdIn), but only inward: a layer the page sets left ofthe stack was held at the stack's edge.
The one layer's offset down also moves it: the page sets the text 10pt lower than the stack starts.
The stack makes no room for it, so the page lays the text over what follows. Word's flow cannot
lay one line over another, and that loss was unsaid too.
What changed
holdInholds a block to its box on both sides. Where the page sets it past an edge, itstands out past it as far, by an indent below zero.
applyInsetalready writes a paragraph's indents below zero outside a table cell, and atable's
w:tblIndtoo.break at the page's words.
not lean on widened the three-line layer by 12.8pt, and it took two lines in both editors.
as far as the indents round it give. The rest is named (
layer offset), unless the block onlydraws. Its right side stays at the edge, as before: a line the page sets past it gets its room
from the paragraph itself (
letTheLineStandOut).writeContainerBody: a stack of one layer holds its layer throughplaceAcross, as italready holds an alignment's child. In a table cell the moved layer would run past the cell's
right edge, so it is written where the stack starts.
reportTheLayerMovednames the one layer, by more than half a point, in three cases:offset as given.
It skips a layer that only draws. It also skips the vertical case where a band or a column sets
the next block at the page's distance below what is above it, since that distance holds the
offset.
Docs:
layersentries ofDocxNodeFieldLedgerTestfor the stack and the shape container;Verification
identical.
set left of its stack.
invoice-payments, belongs to the masthead's accent bar, which isdrawn.
word-export-companion.docxwas regenerated. It differs from the committed one onlyin
docProps/core.xml, the export's time.DocxLayerOffsetTest(new, 14 tests):right-aligned one at the edge is not pushed past it;
the rest named; 24pt round it and not named; a drawing not named; one layer moved across,
written at the stack's edge and named;
which changes an indent by less than half a point.
./mvnw -B -ntp clean verify: BUILD SUCCESS (core 821, render-docx 1819, examples 93, qa 1820).The knowledge pack's
--checkpasses.Lane: render-docx (semantic backend). DOCX output changes only where a layer's box stands past
its stack's edge, or a stack's one layer is moved across. The report gains notes only where an
offset is not written.