Files
docx/scripts
Dolan edbb770e3f feat(layout): lay out past what it would stop at with a best guess, when asked (#3672)
* feat(layout): lay out past what it would stop at with a best guess, on request

Decision D6 of the watertight report: an opt-in best guess past the stops.
estimatePageNumbersWith({ guess: true }), and layoutDocument(doc, { guess: true }),
lay out past each stop with the best guess the layout has, and say where they
guessed: the estimate's guesses give why and the page it was laying out then,
and each page of layoutDocument's result says what was guessed at on it.

Every stop goes through one path. In paginate, a stop is stopAt(reason): it
throws without a guess, and with one notes the guess on the page and goes on
with what the layout has. What the reader marks on a block, section or the
document is laid out as it was read; a line marked by the line breaker as it
was broken; text in a font or with a character the measurer doesn't know as
the measurer measures it, the most similar font in the width tables. In the
reader, read with a guess, what it can't read is left out of its paragraph,
which keeps why, unless the place it stops at gives a better guess: a date as
written, a run's formatting ignored, a ruby's base, a content control bound to
custom XML as written. A stop added later gets one of those paths, or, written
as throw new Unsupported in paginate, or as a block with nothing read in it, a
clear no guess. Off by default, so the default stays watertight, and the
default layout of every committed probe and Word-saved demo is unchanged.

* test(layout): check the guesses against Word's PDFs, and cover their last branches

scripts/layout-probes/guess-lines.ts lays out a document saved from Word with a guess, and finds each line from the first page it guessed on among the lines of Word's PDF. The docs say which floating drawing stops still have no guess.
2026-10-02 23:49:42 +01:00
..