/** * Unrounded natural line heights for the paginated export (issue #850). * * Chromium lays a `line-height: normal` line out at the font's natural line height — ascent + * descent + line gap from its metrics — but first rounds that to a whole CSS pixel (0.75 pt). The * converter relies on `normal` for single spacing and on `calc(1lh * m)` for Word's `auto` * multiples, so every line inherits the rounding: 11 pt Carlito advances 18 px instead of * 17.90 px, and the error accumulates down the page and moves page breaks. An explicit length keeps * Chromium's 1/64-pixel layout precision, so this pass replaces each `normal` with the same font's * natural height measured where rounding is negligible. */ /** * Give every element under `root` whose computed `line-height` is `normal` an explicit line height * equal to its own font's unrounded natural line height (including any fallback font its own text * needs). Elements are collected before any is * changed, because an explicit value on a parent would otherwise be inherited by children that * should keep sizing their lines from their own font. Returns how many elements changed. * * The paginator runs this on its staging tree, so every paginated surface lays lines out alike. A * caller that needs the heights earlier (the export measures text before it paginates) may run it * first: a resolved height is no longer `normal`, so the paginator's pass leaves it alone. */ export declare function applyUnroundedNormalLineHeights(root: Element): number; /** * Give mixed ordinary text one shared ascent, descent and spacing floor per visual line (#1565). * Word's line is its text's largest ascent plus largest descent, and an automatic multiple of that. * A generated list marker only raises its own line's ascent: Word adds neither its descent nor a * multiple of it. A break's direction mark sizes only a line that holds nothing else, so an empty * line made by `w:br` takes the break's own font. */ export declare function prepareMixedLineHeights(root: HTMLElement, checkpoint?: () => void): number; /** Only our empty zero-width metric boxes may bypass ordinary inline layout guards. */ export declare function isMixedLineMetric(element: HTMLElement): boolean; /** * How far below the top of its line Word puts a grid run's natural line: it centres the text in its grid * lines (#1551), as the run's line box does. Zero for a run the grid pass has not sized. */ export declare function gridTextOffset(run: CSSStyleDeclaration): number; /** * Word places an exact-spaced line's baseline at 80% of its height, independent of font size * (issue #882; fixtures/exact-line-spacing/word.json). Move each run by its own font's offset, * retaining the converter's top alignment so mixed font sizes cannot enlarge the line boxes. */ export declare function alignExactLineBaselines(root: Element): void; /** * Exact line boxes still occupy their declared height when their glyphs extend outside them. * Word lets that ink enter the margins. Expand only the paint clip, after placement, for plain * inline text whose paragraph fits its band and whose ink cannot enter a running story or leave * the paper. Block geometry and pagination budgets remain unchanged. */ export declare function preserveExactLineInk(content: HTMLElement, topLimit: number, bottomLimit: number, paper: DOMRect): void; /** Read a rectangular paint clip: a pixel inset or an exact-row rectangle with zero-area spikes. */ export declare function insetClipBounds(value: string, box: DOMRect, scale: number): { top: number; right: number; bottom: number; left: number; } | null; /** Only inline ink in a fitting exact-spaced paragraph may use the expanded paint clip. */ export declare function isPreservedExactLineInk(element: HTMLElement, content: HTMLElement): boolean; /** * Measure each descendant's content bottom once for this layout snapshot (#1271, #1493). * Inline padding/borders can paint beyond a fitting line, including through zero-height * wrappers. Measure nested text/children without those decorations; atomic boxes keep * their full bounds, but a mixed line's metric box only sizes its line and paints nothing. * Unboxed generated content conservatively uses its boxed ancestor. */ export declare function measureLaidOutBottoms(band: HTMLElement): Map; /** * Put every exported baseline where Word puts it, to a fraction of a pixel (issue #942). * * Word sets a line's baseline its natural line height less the font's descent below the line's top: the * font's ascent, with any line gap above it. Chromium instead rounds the ascent and descent to whole pixels * and floors half the remaining leading, so the baseline lands up to a pixel off; for 11 pt Calibri and 12 pt * Arial it is one pixel high. Word also puts a font's line gap above the text where CSS splits it, which moves * Arial's baseline a little further. That offset is the same on every line of a paragraph, whatever its position, so * it is measured once per paragraph shape in a probe and taken back with relative positioning, which moves the * glyphs without changing any line box: pagination and line pitch are untouched. * * Each direct inline child of a paragraph is moved, composing with a `top` it already has. A child positioned * some other way, or holding an image, SVG, MathML or an absolutely positioned element (for which a relative child * would become the containing block), is left alone. Run once the page tree is final: the moved boxes count * toward a page band's overflow, which the export's clipping check must not see. * Returns how many children moved. */ export declare function alignBaselinesToWord(root: Element): number; //# sourceMappingURL=line-metrics.d.ts.map