mirror of
https://github.com/dolanmiu/docx.git
synced 2026-12-01 16:55:59 +01:00
* feat(layout): lay out a document grid as Word does Word's PDFs of word-grid, word-grid2 and word-grid3 (scripts/layout-probes) showed how Word lays out a section's document grid (w:docGrid): each line takes as many of the grid's lines as its own height needs, with multiple and at-least spacing on them and the room below its text allowed below the page; a grid of lines and characters adds its charSpace after each character and a quarter of a character between East Asian characters and Latin letters; and a grid that snaps to characters puts them in cells of each column. The layout follows them, and stops where Word's PDFs didn't show what it does. A section whose text runs across the page with a direction of its own no longer stops. * feat(layout): lay out text that runs down the page as Word does Word's PDF of word-vertical.docx (scripts/layout-probes) showed that Word lays out a section whose text runs down the page as a page turned on its side: each line from the top margin to the bottom one, the lines across the page from the right (tbRl, btLr) or the left (tbRlV, tbLrV), ideographs an em down the line and Latin text on its side, and a header that doesn't push the lines (word-grid3.docx VH1). The layout follows it, and layoutDocument gives each line where it is on the page, with textRunsDown on the page. It stops at what Word's PDFs didn't show down the page. * fix(layout): stop at a grid that snaps to characters on text that runs down the page A grid that snaps to characters measures its cells across a column of the page, where the lines of text that runs down the page run along its height, and Word's PDFs showed only a grid of lines and characters there (word-vertical.docx V3). * docs(layout): name the reader of word-grid3's PDF, word-grid.py word-grid.py reads the H probes of word-grid3 too, as the probes' README says; there is no word-grid3.py. * fix(layout): read V10 and V11's lines from the left in word-vertical.py tbRlV and tbLrV put their lines across the page from the left, so the reader printed them in reverse. It now also takes each page's direction from the probe on it, as its words don't show it, and leaves out the header and footer of a page of text down it.
27 KiB
27 KiB