/** * Whole-text clipping for exact-height table rows in the standalone PDF export (issue #1140). * * The converter clips an exact row's cell content with `overflow: hidden`, as Word clips it. Chromium's * PDF writer (Skia's SkPDFDevice) keeps a glyph in the text layer only when the glyph's bounds meet the * bounding rectangle of the clip it is drawn under. A line the row cuts through therefore extracted as * broken pieces: the letters whose ascenders reach the row survived and the rest of every word was dropped. * * A clip whose painted area is the row but whose bounding rectangle covers the hidden content keeps every * glyph in the text layer, once, in place. Only a path can be that shape: the visible rectangle plus * zero-area spikes. In CSS a clip path makes its element a stacking context, which moves the cell's text * to the end of the page's content stream; an SVG `clipPath` inside an inline SVG root does not. So the * content of an overflowing clip box moves into a `foreignObject` clipped that way. * * Geometry. Chromium paints an SVG root at a whole pixel of the page. The root is placed on the pixel at * or before the clip box (negative margins keep the cell's layout) and the `foreignObject` takes back the * fraction, so the content lays out and paints exactly where it did. The visible rectangle is the * whole-pixel rectangle Chromium snaps the `overflow: hidden` clip to. The clip box keeps an overflow clip * (for the PageMap measurer, which intersects every overflow-clipping ancestor) with a margin wide enough * not to bound the glyphs. Page boxes print at their own origin, so both grids are the page box's. * * Paint order. The SVG root paints its content atomically, so the cell's text moves to whatever paint * phase the root is in. Within a stacking context, text in a positioned box (the relative offsets that * `alignBaselinesToWord` and exact line spacing put on runs) paints after all in-flow content, in tree * order; other text paints with the in-flow content. The root takes `position: relative` when any of the * clip box's text painted in the positioned phase, so the cell paints where that text did; a cell whose * text is all in-flow keeps the in-flow slot. Inside the root (a stacking context of its own) a cell with * text in both phases gives its in-flow text an offset-free relative box, so the cell reads in tree order. * * Cost. The hidden glyphs are now drawn under the clip instead of being left out. They lie outside the * clip, but a PDF rasterizer can still tint the pixel row the clip edge crosses where a hidden glyph's * top touches that row (anti-aliased coverage, hinting). See docs/architecture/standalone_paginated_export.md. * * Left alone: a clip box of no height or width (it shows nothing), one that hides no glyph (see * `hidesText`), and one holding an absolutely or fixed * positioned element, for which the `foreignObject` would become the containing block and move it. */ /** The converter's clip box around an exact-height row cell's content (`ClipExactRowCells`). */ export declare const EXACT_ROW_CELL = "div[data-docx-exact-row-cell=\"true\"]"; /** * The vertical span, in client coordinates, that every exact-height row cell enclosing `element` * shows, or null when none does. An exact row clips by its height only: Word draws what lies * beside the text, such as a paragraph's left and right borders in the cell margin, in full. */ export declare function exactRowClipSpan(element: Element): { top: number; bottom: number; } | null; /** * Move every exact-row clip box that hides some of its text into an SVG clipped to the same visible * rectangle, so the clipped text stays whole in the PDF text layer. Run on the final page tree, after * the export's clipping check and the baseline offsets. Returns how many clip boxes moved. */ export declare function preserveClippedExactRowText(root: HTMLElement): number; //# sourceMappingURL=exact-row-text.d.ts.map