A Ctrl/Cmd+wheel notch eases in over several frames and a pinch changes
the scale every frame: each frame was a new size, so its pages were
hinted afresh (a new hinting instance per face and every glyph hinted
again, about 1.5 ms more per page) and the hint caches filled with sizes
nobody rests on, which could clear the one the zoom ends at.
While a pointer zoom changes the scale, pages are now drawn unhinted;
the hinting is part of the page's texture key, so the first frame at
rest draws the page hinted, also at the size the last zoom frame drew.
A zoom that leaves the scale as it is (at 10 % or 500 %, or over the
ribbon) keeps the pages hinted, and other scale changes (Zoom dialog,
slider, a fit zoom following the window) are drawn hinted at once.
Rounding sizes into buckets was considered instead: steps between
eased frames are far larger than any bucket fine enough to keep the
glyphs on the pixel grid at the size the zoom ends at.
Tests: an easing Ctrl+wheel zoom draws every in-between size unhinted
and the page hinted the frame it stops; the decision for a gesture,
the zoom limits and other scale changes; the page key holds the
hinting.
CodeRabbit review on PR #3115: an xlink:href like "./Object 1/" (some
ODF producers write the object folder with a trailing slash) doubled
the slash before content.xml, so the zip lookup missed and the fix
silently fell back to the undecodable replacement image again.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
After Tab moves the keyboard to the dialog's next control, each box takes
it back with one input-method reset, then none, and the next key reaches it
(review).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
To find the offset from its anchor paragraph, a dropped object was
first laid out at the paragraph's top. Near the bottom of a page that
pushed the paragraph onto the next page, so the object ended up about
a page below the drop point, cut off at the page edge.
Now it is first placed where it was dropped, and the paragraph's
position is read from that layout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A bare `run` built its document with Document::new() (Letter) and never went
through file.new, so it skipped the system region's paper. It now runs
file.new, as `run --template` already did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Word's text watermark is a VML WordArt shape (`PowerPlusWaterMarkObject`)
whose `v:textpath fitshape` stretches the text over the shape's box (its
`style` width and height), centred on the margins and, when diagonal,
turned by `rotation:315`. WordCraft ignored the box: it drew the text
70 % of the page diagonal wide (half of it on screen), centred on the
page and along the page diagonal (55° on A4, not 45°). A "BROUILLON"
watermark in a 515 x 104 pt box came out about 1.4 times as large as in
Word.
- doc: `Watermark::size`, the shape's box (`None`: Word's default, half
the page diagonal across, as high as the text's length makes it);
`Watermark::frame` gives the box for a page, shared by the writer and
the renderers.
- docx: the box is read from the shape's style and written back; a box
equal to the default for the document's page reads as `None`, so a
watermark made by Design > Watermark keeps following the page.
- pdf, render: the text's advance spans the box's width, its em the
box's height, the em's foot (the font's win descent below the
baseline) on the box's bottom; the box centred on the margins,
turned 45° counterclockwise when diagonal.
Checked against Word for Microsoft 365 (ink bounds, pt, left top right
bottom; fonts here: Liberation Sans for Arial and Calibri, Liberation
Serif for Times New Roman):
BROUILLON, Calibri, 515.4 x 104.1, 315°:
Word 93.6 222.7 489.1 619.2; before 60.5 110.4 535.7 732.5;
after 90.7 214.1 495.8 618.7
SPECIMEN, Arial, 400 x 100, 315°:
Word 136.3 261.6 455.0 580.3; before 66.7 108.5 539.0 727.7;
after 137.8 255.4 454.6 573.1
HXH, Arial, 300 x 100, flat: Word 158.9 378.2 436.3 449.8;
before 105.1 353.8 490.1 489.6; after 158.9 380.2 435.8 449.3
HXH, Times New Roman, 300 x 100, flat: Word 149.8 383.0 445.0 449.3;
after 151.2 383.5 443.5 449.3
COPIE, Calibri, 300 x 80, flat: Word 153.1 387.8 441.1 440.2;
before 96.0 373.9 500.2 469.0; after 152.2 387.4 443.5 444.5
Tests: a watermark with a box of its own is written and read back with
it, Word's default box reads back as none; in the PDF, the text of a
300 x 80 pt watermark is 80 pt high, stretched across, starting at the
box's left edge on the margins' centre line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fills every entry the Polish reference catalog has that Dutch was missing
(main moved on since the PR was written). Wording fixes, chosen by a native
Dutch speaker while using the interface:
- Review tab: Controleren; the Proofing group/options page: Taalcontrole
(its button already reads "Spelling en grammatica")
- AutoSave: Automatisch opslaan
- Quick Access Toolbar: Sneltoegangslijst everywhere (was three different names)
- Hide Ink (two-line label): Inkt verbergen (word order)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paragraph, cell and table borders were dashed, but not with Word's
patterns: dots were one width on and two off (Word: one and one),
dashes four on and two off (Word: three and one), and dash-dot was
drawn as plain dashes.
- layout: borders use their own strokes (`Stroke::BorderDotted`,
`BorderDashed`, `BorderDotDash`); `Stroke::dashes` gives every
pattern in line widths. Underlines and the other dotted lines keep
theirs.
- pdf, render: lines are stroked with `Stroke::dashes`.
Checked against Word for Microsoft 365 (ink along each border, on
synthetic documents): borders 0.5, 1 and 2.25 pt wide, dotted / dashed
/ dotDash, are 1-1, 3-1 and 3-1-1-1 widths in Word; before 1-2, 4-2 and
4-2; after as Word (2.25 pt dashes: 6.72 on / 2.28 off in both).
Test: in the PDF, a dotted 1 pt border is dashed 1 / 1, a dashed 2 pt
border 6 / 2, a dash-dot 1 pt border 3 / 1 / 1 / 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A left tab past the right indent, or a right, centre or decimal tab whose text
doesn't fit, wrapped whenever any cluster was before it on the line, so a
bookmark before the tab was left on a line of its own. It now wraps only when
something that takes room is before it.
Test: a_bookmark_before_a_left_tab_past_the_right_indent_is_not_a_line.
A left tab whose stop is past the right indent wraps to start the next line.
When that line can't reach the stop either, the tab went past the line's end,
its text didn't fit after it, and the tab was left on a line of its own. As
before the wrap, it now takes no room there and its text starts at the indent.
Test: left_tab_past_the_right_indent_does_not_add_a_line.
A TOC entry whose text just fits showed its page number at the left of a line of its own,
without the leader. Two cases ended the line after the tab and started the next one with its
text at the indent:
- the text after a right, centre or decimal tab didn't fit;
- the text ended past the last stop, and the next default stop was past the right indent
(the tab was left at the end of the line with no width).
Like Word and LibreOffice, the line now breaks before such a tab: the tab starts the next line
and goes to the first stop there, so a TOC page number ends at its stop after a leader.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Character scale (`w:w`, Format > Font > Advanced > Scale) widens or
narrows the letters themselves. WordCraft multiplied the advances but
drew each glyph at its natural width, so text at 200 % looked letter-
spaced (pdftotext even split it into words) and text at 50 % overlapped.
- layout: `Draw::Glyphs` carries `x_scale` (1 = 100 %), the run's scale
for its text and its line-end hyphen (whose advance is scaled too);
list labels, tab leaders, ruby, equations and shape text keep 1.
- pdf: a scaled run is drawn under a horizontal scale from its first pen
position, the positions brought back so each glyph lands where the
layout put it; the text and its extraction are unchanged.
- render: each glyph's outline is stretched across from its pen
position.
Checked against Word for Microsoft 365, "HIHIH" in Arial 20 pt
(Liberation Sans here), right end of the word (pdftotext) and ink:
200 % Word 179.78, ink 73.92..176.52; before: split in three words,
ink to 163.68; after 179.74, ink 74.04..176.52
150 % Word 152.19; after 152.52
50 % Word 97.76; after 98.07
100 % unchanged
Test: in the PDF, letters at 200 % are drawn twice as wide and as high,
at pen positions twice as far apart; at 100 % unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A floating object's frame was clamped to at least 1 pt on each side.
Word keeps the size: a 0.25 pt high rectangle (a cut mark, a rule drawn
as a filled shape) is 0.25 pt high, and a `line` shape 0 pt high is a
horizontal line. WordCraft drew the rectangle 1 pt high from its top
edge (its middle 0.375 pt too low) and the flat line from its start
down to 1 pt below its end, a slanted stroke.
- layout: `float_rect` keeps sizes from 0 pt (not finite: 0); the
PDF and raster shape outlines already draw a flat line and skip an
empty rectangle.
Checked against Word for Microsoft 365 (page-anchored, no outline
unless said; ink top..bottom in pt, 2400 dpi):
0.25 pt rectangle Word 99.99..100.26 before 99.99..101.01 after 99.99..100.26
0.5 pt rectangle Word 120.00..120.51 before 120.00..120.99 after 120.00..120.51
0.75 pt rectangle Word 140.01..140.76 before 140.01..141.00 after 140.01..140.76
1 and 2 pt unchanged, as Word
flat line, 0.25 pt Word 219.87..220.14 before 219.87..221.13 after 219.87..220.11
flat line, 1 pt Word 239.49..240.51 before 239.49..241.50 after 239.49..240.51
upright line, 0 wide, 0.25 pt: Word 299.88..300.12 across, before
299.88..301.14, after 299.88..300.12
Test: rectangles of 0.25, 0.5, 1 and 2 pt, a flat line and an upright
line keep their sizes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The extension check counted bytes back from the end of the name and
sliced there, which panics when that offset falls inside a character:
(file.rename {"name": "abecde"} with a combining accent, .docm)
byte index 3 is not a char boundary; it is inside 'e' (bytes 2..4)
Splitting at the name's own last dot asks the same question without an
arithmetic offset, and reads the same for every name. Covered for a name
with no extension and one with the document's, both multi-byte.
`file.rename` appended the document's extension unconditionally, so
`{"name": "renamed.docx"}` produced `renamed.docx.docx`. The Rename field in
the ribbon edits the stem, which is why it was written that way, but a script
or an agent passes a whole file name.
A name that already ends in the document's extension is now taken as the whole
file name, whatever its case. Anything else still gets the extension: a name
that merely holds a dot (`Report.2026` -> `Report.2026.docm`), and the
extension on its own (`.docm` -> `.docm.docm`), which is a stem rather than a
file name.
Fix: #2983
File › Print put "Print" between the printer settings and the page
settings, styled like every other button there, so the page's one action
was hard to find and didn't read as an immediate action.
The button now comes first in the settings column, above the printer and
the settings it prints with, as Word has it, and wears the accent the app
gives a dialog's primary button (the file browser's Open and Save, OK and
Save in dialogs): the first thing seen, and plainly the action. It still
prints through `ui.print`, and it is still disabled while a native print
job is busy.
* Fix#1974: the caret and clicks land between the letters of a ligature
The glyph's advance is shared evenly among its letters (mirrored in
right-to-left text); ligature letters keep their character spacing.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Fix#1974: a long word never wraps inside a ligature
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Fix#1974: a hyphenation point never splits a ligature
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* #1974: ligature tests use a bundled font that draws fi and ffi as ligatures
They assumed the installed default-font stand-in draws ligatures; Liberation Sans (Linux) draws
none, so they failed there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Dmitrii Khlapov <19991457+dkhlapov@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
* gap 19: RTF import compares heading and code run formatting with the file's stylesheet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* gap 19: review round 1: a style chain with formatting words is complete; unnumbered entries are Normal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Dmitrii Khlapov <19991457+dkhlapov@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
* Content controls: typed text takes the control's formatting, in any language
Text typed in place of a content control's placeholder takes the
control's own run properties (w:sdtPr/w:rPr, ECMA-376 §17.5.2.27), as
in Word: in a protected form filled in Word for Mac, all 17 entered
values carry the style their control's rPr names. WordCraft kept that
rPr only as XML to write back and gave typed text the placeholder's
formatting minus the placeholder style.
It also knew the placeholder style only by its English id,
PlaceholderText. German Word writes Platzhaltertext (the name stays
"Placeholder Text"), so in forms from German Word every entry stayed
grey, on screen and in the saved file, and restoring a placeholder
added a second Placeholder Text style. The style is now found by its
built-in name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Content controls: typing drops a showing placeholder's own style
A control without run properties that shows its placeholder: text typed
over it drops the placeholder run's character style whatever its id
and name. Word localizes only the placeholder style's id, but another
program may localize its name too, and the name lookup then misses it.
Restoring a placeholder and new controls keep the name lookup.
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>
* Restrict Editing: forms protection keeps a form's content controls
With Filling in forms enforced (w:edit="forms"), Word greys out the
Developer tab's control buttons and Properties, and a field's shortcut
menu offers no Remove Content Control: only the fields' content can be
filled in. WordCraft refused these only outside the fillable fields, so
with the caret in one it removed the control (its content left as
plain, no longer fillable text), inserted new controls inside it, and
renamed it; only lock changes were refused.
Under forms protection, inserting any content control, Properties
(every setting) and Remove Content Control are now refused before they
run. Typing, Toggle Check Box, Choose List Item and Set Date still fill
the fields. Other protection modes are unchanged.
Observed in Word for Mac 16.113 on a protected real-world form
(72 content controls: rich text, check boxes, date pickers); the same
form filled in WordCraft opens in Word still protected, with its values,
ticks and dates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Restrict Editing: parity row states what forms protection refuses
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Restrict Editing: correct the comment on content-control property edits in forms mode
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>
* Fix Paragraph::sentence_at at the first character of a sentence
Found while testing crates/doc/src/para.rs:1397-1427
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* sentence_at: a terminator followed directly by text doesn't end the sentence at the caret
"Hello.World" at offset 6 gave an empty (6,6) range; only treat the caret as just past a
sentence end when the character at the caret is a space.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
The test checked that the description is there, so a Figure written twice
would still pass. It now also counts the alt text entries.
Suggested by the CodeRabbit review of this PR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A rotated inline group is drawn inside one rotation. Its tag was chosen for
the whole group: an artifact as soon as one member was decorative, so a
picture next to it lost its Figure and alt text; otherwise one Figure with
the first picture's alt text. The group is still turned as a whole, and each
picture in it is now tagged on its own: decorative ones as artifacts, the
others as Figures with their own alt text.
Found by the CodeRabbit review of this PR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found while testing crates/formats/src/markdown.rs:160-161,463 and crates/formats/src/model.rs:111 (ListInfo)
Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
Found while testing crates/formats/src/html.rs (export, around line 1744; paragraph text writer)
Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
A shape with a description (Alt Text) was exported as an artifact like any
other shape, so screen readers skipped it and the description was lost: an
arrow or an icon drawn with shapes that means something was invisible to them.
A shape that has a description, is not marked decorative and shows no text is
now a Figure with its description, inline (rotated too) and floating. Shapes
without a description and decorative shapes stay artifacts. A text box keeps
its frame as an artifact and its text read as paragraphs: its description would
replace the text, so it isn't used. The rule lives in `shape_figure_alt`.
Draw::Figure's `kind` becomes an Option (None for a shape), and Placed::Shape
carries the description for floating shapes.
Not covered: a group's own description (its members are placed one by one),
and shapes inside a Drawing Canvas.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A picture marked decorative (Alt Text > Mark as decorative, `adec:decorative`
in DOCX) was still exported as content:
- tagged PDF: a Figure with its alt text, or with "picture" when it had none,
inline and floating alike. PDF/UA expects decorative content to be an
artifact, so screen readers skip it. Draw::Image now carries the mark, and
the exporter tags a decorative picture (inline, rotated or floating) as an
artifact instead of a Figure.
- HTML and Markdown (and ODT, which reads the same model): the description,
which the document keeps when a picture is marked decorative, was written
as its alt text. A decorative picture now exports with an empty alt text
(alt="" in HTML), the WCAG way to say "skip this".
Pictures not marked decorative are unchanged. Charts and diagrams are left as
figures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The side bar used the light theme's bright blue in both themes. It now
reads a token, `nav`: the same blue in light mode and a muted indigo in
dark mode. White text on it stays above 4.5:1 (tested).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A hand-typed caption is matched to its label in any case, but `\a` (no
label and number) stripped the label case-sensitively, so "figure 4: Lower"
was listed whole. Found by a local CodeRabbit review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Nnsfu3QGqjD1aFZbBgUWP