import { SourcedFragment, SourcedRun } from "./text-layout.cjs"; import { Alignment, Box, ContentCellBorders, ContentImageBlock, ContentRun, ContentTable, ContentTableCell, ContentTableRow, LayoutFont, LayoutFrame, LayoutMetadata, MathFontMetrics, MathMlNode, PageSize, StyledRun, TextMeasurer, WrappedLine } from "document-schema.js"; import { LayoutDocument, LayoutImageAsset, LayoutItem, LayoutPage, LayoutText } from "pdf-codec"; //#region src/layout/shared.d.ts declare function stampFrame(node: { frames?: LayoutFrame[]; }, pageIndex: number, box: Box): void; declare function textBoxForFragment(item: LayoutText, textWidthPt: number, ascentPt: number, descentPt: number): Box; declare function stampFragmentFrame(runs: readonly ContentRun[], fragment: SourcedFragment, pageIndex: number, item: LayoutText, measurer: TextMeasurer, line: { readonly ascentPt: number; readonly descentPt: number; }): void; declare function packagePagesOf(pages: readonly LayoutPage[]): PageSize[]; declare function layoutDocumentOf(metadata: LayoutMetadata, pages: LayoutPage[], images: Record): LayoutDocument; declare const NOMINAL_TEXT_SIZE_PT = 18; declare function formulaSizePtForFrame(mathml: readonly MathMlNode[], frame: Box, mathMetricsAt: (sizePt: number) => MathFontMetrics): number; declare const HEADING_STYLES: Record; declare function headingStyleFor(styleId: string | undefined): { bold: boolean; sizePt: number; } | undefined; declare function runFont(run: ContentRun, headingBold?: boolean): LayoutFont; declare function toStyledRuns(runs: readonly ContentRun[], fontScale?: number, headingStyle?: { bold: boolean; sizePt: number; }): SourcedRun[]; declare function effectiveStyledRuns(runs: readonly ContentRun[], fontScale?: number, headingStyle?: { bold: boolean; sizePt: number; }): SourcedRun[]; declare function lineNaturalHeightPt(line: WrappedLine, measurer: TextMeasurer, fallback: StyledRun): number; declare function alignmentOffsetPt(alignment: Alignment | undefined, contentWidthPt: number, lineWidthPt: number): number; declare function justifyLineGapsPt(line: WrappedLine, targetWidthPt: number, measurer: TextMeasurer): readonly number[]; declare function pushCellBorderLines(borders: ContentCellBorders, frameYDown: Box, pageHeightPt: number, sourcePath: string | undefined, out: LayoutItem[]): void; declare function registerImage(block: ContentImageBlock, images: Record): string; /** The sum of `span` consecutive entries of `columnWidthsPt` from `startIndex`, stopping at the end of the array: a span reaching past the last entry (a spreadsheet merge running off the edge of the printed band, or a table whose declared grid is narrower than a cell claims) contributes only the entries that exist. */ declare function sumColumnWidthsPt(columnWidthsPt: readonly number[], startIndex: number, span: number): number; /** One anchor cell of a laid-out table row: the cell itself, its left edge measured from the table's left edge, and its width, both already scaled. */ interface TableAnchorBox { readonly cell: ContentTableCell; readonly xOffsetPt: number; readonly widthPt: number; } /** One table row paired with the boxes of the anchor cells that are laid out in it. */ interface TableRowAnchorBoxes { readonly row: ContentTableRow; readonly anchors: readonly TableAnchorBox[]; } /** * Pairs each row of `table` with the boxes of its anchor cells. Only anchors are boxed: a position a merged region covers is part of that region's own anchor cell, so laying it out as well would draw a second, empty cell over the region. An anchor's column is its position in the row, and its width is the sum of the column widths it spans, all multiplied by `scale`. */ declare function tableAnchorBoxes(table: ContentTable, scale: number): TableRowAnchorBoxes[]; declare function estimateRowHeightPt(anchors: readonly TableAnchorBox[], measurer: TextMeasurer): number; //#endregion export { HEADING_STYLES, NOMINAL_TEXT_SIZE_PT, TableAnchorBox, TableRowAnchorBoxes, alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, formulaSizePtForFrame, headingStyleFor, justifyLineGapsPt, layoutDocumentOf, lineNaturalHeightPt, packagePagesOf, pushCellBorderLines, registerImage, runFont, stampFragmentFrame, stampFrame, sumColumnWidthsPt, tableAnchorBoxes, textBoxForFragment, toStyledRuns };