mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-27 03:47:09 -06:00
* #1290: read Word's VML text watermark from DOCX headers Word's Design › Watermark is a VML shape with a v:textpath in the headers. The reader dropped it, so screen and PDF showed no watermark. It now maps it to the document's watermark model (text, font, fill colour, semitransparent from v:fill opacity, diagonal when turned), which the renderers already draw. Only Word's watermark shape (PowerPlusWaterMarkObject id) or text centred on the page both ways counts; other header WordArt, body WordArt and shapes inside text boxes are left alone. Writing it back to DOCX is still missing (it was already lost on save). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #1290: write the watermark to DOCX as a VML text shape in the headers The DOCX writer dropped settings.watermark, so a watermark read from Word (or set in WordCraft) was lost on save. Every header part now starts its first paragraph with a VML shape (ECMA-376 Part 4) whose v:textpath carries the text, font, fill colour, semitransparency (v:fill opacity) and diagonal turn, centred on the margins behind the text, with the reader's PowerPlusWaterMarkObject id so it reads back as the watermark, not a shape. The shape type is our own: a straight path the text follows, fitted to the box. Slots the pages show with no header of their own or linked from an earlier section (default; first page with a title page; even pages with even/odd headers) get a header holding only the watermark; linked sections stay linked. A blank watermark isn't written. Check Compatibility no longer warns about watermarks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #1290: give the watermark's text path a top and a bottom edge so Word draws it With a single line as the shape type's path, Word loaded the watermark as WordArt (right text, size and turn) but drew nothing. Checked black-box in Word: diagonal, horizontal and header-less documents now show it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #1290: test the watermark through a Word-shaped file, table-only and even-page headers Read → write → read of a file with Word's watermark keeps the watermark, the headers' text and paragraphs and one shape per header; header WordArt that isn't a watermark doesn't become one. A header holding only a table gains no line; with odd and even pages an even header is added and later sections stay linked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * DOCX: read VML freeforms (v:shape with a path) as freeform shapes Legacy VML shapes with their own `path` (ECMA-376 Part 4), such as rule lines in headers, were dropped on open and lost on save. They are now read as freeforms: m/t/l/r/c/v/x/e commands in the coordsize/coordorigin space, nf/ns, v:fill and v:stroke opacity; arcs drawn straight, formula references read as 0. Saved as DrawingML custom geometry. Tests: header rule read and round-tripped; hostile paths and coordinate spaces stay finite and never panic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * DOCX: VML freeforms whose path uses formulas aren't drawn Formulas (@n, from v:formulas) aren't evaluated; reading them as 0 drew stray lines. Parity row states the fill-opacity limit (none at 0, otherwise opaque, as for DrawingML fills). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * DOCX: VML freeforms reuse the watermark's vml_fraction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #1290: move the VML freeform reader out of this PR The three VML freeform commits (b7a6cc7,d8fa665,945cbb4) aren't part of #1290; they go to their own pull request so this one stays on the watermark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>