Repository navigation
fix(docx): end and turn a drawing's outline as the page strokes it - #901
Merged
Merged
Conversation
A drawn shape's outline was written as <a:ln w> with no cap and no join, which Word 16 and LibreOffice draw with flat ends and round corners, where the page ends a stroke butt and mitres it: a rectangle's 10pt frame came out with rounded corners, a star's points 4pt short, a triangle's apex 13pt short, and a path's or a line's round or square caps flat. DocxDrawings.Shape now carries the outline's cap and join, taken from a path's and a line's payload and the page's butt and mitre elsewhere, and the outline states them: cap="flat|rnd|sq", then <a:miter lim="1000000"/> (the page's limit of ten), <a:round/> or <a:bevel/>. Word draws each as the page does; LibreOffice reads no limit and bevels a corner sharper than 30 degrees. A drawn path's and a drawn line's report notes stop naming caps and joins; a line written as a paragraph border still names its caps. The Word export companion preview is re-rendered: its one outline gains its cap and join.
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's outline was written as
<a:ln w>with nocapand no join element. Word 16 and LibreOffice draw that with flat ends and round corners, while the page ends a stroke butt and mitres it unless the node says otherwise. Measured on one-drawing pages, editor ink against the page's:Only paths said so in the report. Rectangles, polygons and shape-container outlines lost their corners in silence.
What changed
DocxDrawings.Shapecarries the outline'slineCapandlineJoin, BUTT and MITER where nothing else is given.DocxDrawings.oftakes them from a path's and a line's payload (strokedWith). Every other outline keeps the page's own BUTT/MITER: rectangle, rounded rectangle, ellipse, polygon, shape-container outline and side border, none of which the PDF handlers stroke otherwise.outline(Shape)writes them:cap="flat|rnd|sq", then<a:miter lim="1000000"/>,<a:round/>or<a:bevel/>after the fill.render-pdfnever changes.<a:ln><a:noFill/></a:ln>.holding/inFront) and the drawings a table's cells hold go through the sameofandoutline.lim. With lim 2, 5, 8, 10 and 50 alike it mitred ratios up to 9.5 and bevelled 10.5 and over, as the page does.limtoo. It writes its own PDF miter limit of 3.86 (30°) and bevels a sharper corner, such as the triangle's 21° apex. That behaviour belongs to the editor; the recipe and the capability matrix say so.pathStyleLostnames only a gradient paint and a dash pattern;hasOpenEndsandjoinsSegmentsgo.PathNode.lineCap/lineJoinWRITTEN, andLineNode.lineCapREPORTED for a rule only.Verification
document.xml. With the newcapattributes and join elements stripped, each is byte-identical to2.5-dev.-Dgraphcompose.docxFidelity=libreoffice) measured the same lines aslibreoffice-windows.tsv, byte for byte. A line's position does not depend on an outline.assets/readme/examples/word-export-companion.docxis re-rendered: its one outline gains its cap and join, soCommittedAssetDriftTestpasses.DocxDrawingsTestassert the written outline exactly for a round/bevel path, a square/round path, a round-capped line, a stroked rectangle, a polygon container and an unstroked ellipse, plus a rectangular badge and a path composed in a table cell.DocxCarriedWithoutReportTestpins the notes that no longer name caps and joins, and the rule's that still does../mvnw -B -ntp clean verify→ BUILD SUCCESS (qa 1820).Lane: render-docx — DrawingML outline of drawn shapes; report notes follow