Files
docx/scripts/layout-probes/word-table-widths.pdf
Dolan e70b43dd8f feat(layout): size tables whose rows give a column different widths, and long words in tables, as Word does (#3655)
* feat(layout): even out table rows that give a column different widths, and size long words in tables, as Word does

Word's round-9 probes (word-watertight-stops.docx SP14, SP15 and SP17) show how it sizes
these tables, so the layout now follows them where it stopped:

- rows that give a column different widths, in a table with a width of its own in twips,
  laid out fixed or not: each column as wide as the widest a row gives it, then fitted to
  the table's width (SP14a, SP14b)
- a word longer than the page in a table with a width of its own: the column as wide as
  the word, past the margin (SP15a)
- a long word in a table wider than its cells: widened for the word, then in proportion
  (SP15b)
- a long word across columns given widths: shared among them, the others narrowed (SP15c)
- a long word across columns given no widths: shared in proportion to each column's
  widest word and widest line added together (SP17, U1e)

word-table-widths.ts is a probe for what these leave open.

* feat(layout): count a table in a cell as it is laid out in its own width

* feat(layout): keep stopping at uneven rows of a table whose rows skip grid columns

* feat(layout): size tables whose cells all have widths as Word's word-table-widths.docx shows

Word's PDF of word-table-widths.docx (TW1 to TW23) settles what round 9 left open:

- a table laid out fixed is sized by its cells' widths alone: fitted to its own width in
  twips, its columns' text narrowed in proportion (TW6, TW8) or the columns widened in
  proportion (TW4, TW10), and kept as its rows give it without one (TW2)
- a table whose cells all have widths is fitted to its own width in twips, rows that
  agree or not (TW3, TW5, TW7, TW9), and narrowed to the room without one (TW1)
- a cell across columns wider than they are widens the last of them (TW19)
- a long word across columns given widths is shared by their widest words and widths
  added up (TW16 to TW18), and the columns keep it when a table given no widths is
  narrowed around it (TW23)
- a word longer than a table given no width of its own, or a share of the width, stops,
  as Word breaks it (TW12, TW13); one with a width in twips grows (TW11, TW14, TW15)

Commits Word's PDF of the probe, and reads tables that start on the next page.

* style: format the table widths probe
2026-10-02 21:04:31 +01:00

35 KiB