mirror of
https://github.com/dolanmiu/docx.git
synced 2026-12-01 16:55:59 +01:00
* feat(layout): lay out compatibility modes, suppressTopSpacing, booklets and HTML divisions where round 25 settled them, as Word does Word's PDFs of round 25 (word-stops-compat2-15, -14, -12, -top-spacing2, -booklet2, -divisions and -fe-layout2, committed in scripts/layout-probes/stops2 with their documents) settle most of what the earlier batch left open: - Compatibility modes 14 and 12: a page break at the end of a paragraph and distributed lines as in mode 15 or as justified ones, no ligatures without enableOpenTypeFeatures, a tab past the end at its stop with the rest of the paragraph on that line, gaps beside drawings and frames down to 50 and 100 points, indented tables, tables in cells and tables widened for a long word, floating tables with their text at their place; in 12 and 11, East Asian text of no language broken only at its spaces, and a text box's outline taking no room in its line. - suppressTopSpacing: at least a height X leaves out X less 9.6 points, whatever the line's height; a paragraph's later line, the space before a section's first paragraph and a table's cells are followed, multiple spacing and a line below a border left as they are. - Folded booklets laid out as the section's pages; paragraphs in HTML divisions laid out from the web settings. - useFELayout stops only at East Asian text beside other text with automatic spacing on. It keeps stopping, narrowed, where Word hasn't shown its way, and word-stops-compat3.ts writes probes for those. * fix(layout): measure an older mode's narrow gap beside a drawing within the paragraph's indents The stop at gaps beside drawings narrower than Word 2010 was seen putting text in measured the whole gap, so a gap a paragraph's left indent covers, which takes no text anyway, stopped the layout, and one an indent narrows passed by its whole width. It now measures the room the indents leave in each gap. * fix(layout): measure an older mode's gaps of a first line's row with its first line indent When a paragraph's first line indent leaves the first gap beside a drawing no room, its first line may go in a later gap of the row, which the stop at narrow gaps measured without the indent. Those gaps are now measured with it, so the layout stops where the indent would leave less room than Word was seen putting text in. Which gap Word indents then hasn't been seen, so the lines are laid out as before. * fix(layout): measure only the gap that takes a first line with its first line indent The last fix measured every later gap of a first line's row with the first line indent, so a gap that takes the second line, after a first gap the first line fits in, was measured narrower than its room and could stop the layout. Only the first gap the indent leaves room in, which the first line goes in, is measured with it now. * fix(layout): let no hanging indent widen an older mode's gap beside a drawing A first line indent less than none moved the room the stop at narrow gaps measured left of the gap, into the drawing's room, so a gap of 80 points beside a drawing passed as 105. The stop now measures no further left than the gap itself. Where Word starts a first line that hangs past a drawing's edge hasn't been seen, so the lines are laid out as before. * docs(layout): say a tab line's reach is from where the paragraph's lines start, and test both sides of it The comment called the 941.4 points Word was seen keeping text after a tab on its line "past the margin", though a line's positions, as its tab stops, are from where the paragraph's lines start: CN5a's line ran to 18827 twips from there, past the margin's 9026. The test now checks a line just within it as well as one past it. * fix(layout): count only frames beside a line's row in an older mode's narrow gaps A frame anywhere on the page whose edge was where a gap's is made the gap one beside a frame, and its stricter least width, though the frame was lower or higher on the page. Only frames beside the line's row count now.