Repository navigation
fix(docx): set a panel's layer where its alignment sets it - #924
Merged
Merged
Conversation
A filled or outlined rectangle with text, composed in a table cell, is written as a panel, a table of one cell. Its cell was always centred and its layers written from the cell's left. Measured in Word and LibreOffice, a label at the top-left of a 100x60 panel stood 22.5pt low, and one at the bottom-right stood in the middle at the left. The cell now sets what it writes at the top, the middle or the foot, as its first written layer is set, and each paragraph layer is held in across to its box, its width read off the lines its table laid out for it, set at its alignment's share and moved by its offset. What the cell cannot set is named (layer offset): a layer after the first, which it writes under the ones before it; an offset down or up; a box past the shape's side; and a layer set across by a box the layout does not give.
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 filled or outlined rectangle or rounded rectangle with text, composed in a table cell, is
written as a panel: a table of one cell (
writtenAsAPanel→writePanel). Its cell was alwayswritten
vAlign=center("the page centres a shape's layers in it"), and its layers were writtenfrom the cell's left, whatever their
LayerAlign.Measured in Word 16 and LibreOffice on Windows, in a 100×60pt panel in a table cell:
TOP_LEFTBOTTOM_RIGHTNeither was named. The 1pt that is left over is Word's own: the paragraph above the table,
"Before", stands 0.9pt higher too.
What changed
verticalOfItsLayers: the panel's cell sets what it writes at the top, the middle or thefoot, where its first written layer is set. Top is Word's default and is not written.
composedLabelOfand what follows) takes only a label centred top tobottom, so it still sees a centred cell.
holdInItsPanel: each written layer is held in across throughholdIn, from the shape'sroom as written (its outline less the padding written as the cell's margins).
firstTextBox), and set at thealignment's share, as the engine does (
LayerStackGeometry.horizontalOffset), plus its offset.left as it was. A centred or right-aligned paragraph is as wide as the shape.
writeChildrentakes the shape and holds each child in turn, restoring the insets after it.reportTheLayersOfItsPanelnames (layer offset) what the cell cannot set where the pagedoes:
height or at another;
named where
holdInholds it);paragraph whose lines are not found.
notes on composed content do.
layersentry ofDocxNodeFieldLedgerTestfor the shape container;Verification
identical. A scan finds 123 shape containers composed in table cells:
CENTER, all written exactly as before;DocxPanelLayerAlignTest(new, 12 tests):./mvnw -B -ntp clean verify: BUILD SUCCESS (core 821, render-docx 1831, examples 93, qa 1820).The knowledge pack's
--checkpasses.The page sets a shape container's padding outside its outline, and its layers in the outline. The
panel writes the padding inside the outline, as the cell's margins. With padding, what the panel
writes therefore stands that far inside the outline, at either side. This is unchanged here.
Lane: render-docx (semantic backend). DOCX output changes only for a shape written as a panel
in a table cell whose written layer is set at its top or foot, or whose paragraph stands across
where its own alignment does not set it.