/** * Adapter between @chenglou/pretext `PreparedTextWithSegments` and the * Knuth-Plass item stream, plus reconstruction of VDT lines from the * optimal breakpoint sequence. */ import type { PreparedTextWithSegments } from '@chenglou/pretext'; import type { VDTLine } from '../vdt.js'; import type { TextAlign } from '../types.js'; import type { KPItem } from './types.js'; export declare function pretextSegmentsToItems(prepared: PreparedTextWithSegments, /** Width of the hyphen a soft-hyphen break prints, in the text's font * (pretext 1.0 keeps its own, which may be U+2010's, to itself). */ hyphenWidth: number, normalSpaceWidth: number, maxStretchRatio: number, minShrinkRatio: number, /** Add a break after an em or en dash set closed between words (see * `MeasureBlockOptions.breakAfterDashes`). Pretext keeps such a dash a * text segment of its own, or at the end of one, between two others with * no space in between, where Knuth–Plass had no break at all. */ breakAfterDashes?: boolean, /** Add a break after a hyphen the text carries between two letters * ("meta-" | "analyses"), priced like a syllable, as the rich path does. * Pretext ends a text segment on such a hyphen and breaks there when it * sets lines one by one. Up to postext 1.4, Knuth–Plass on justified * plain text never broke there: ragged text always asks for it, and * justified text with `MeasureBlockOptions.breakAfterHyphens`. */ hardHyphens?: boolean, /** Letters a compound needs on each side of its hyphen for that break: * 2 keeps a line from ending on a lone letter ("e-" | "mail"). Justified * text that asks for the break with `breakAfterHyphens` takes 2; ragged * text, which pretext's line-by-line breaker gave every such break, and * compounds the dictionary leaves whole take 1. */ hardHyphenMinLetters?: number, /** Width of the middle dot in the text's font: a break inside a Catalan * `l·l` prints the hyphen in its place (`il-` | `lusió`), so the line * ending there is that much narrower. A function gives the room the * dot takes in the piece the line ends on (a document shaped in its * own language, #770: a face may set the dot after an `l` otherwise * than alone). */ geminateDotWidth?: number | ((piece: string) => number)): KPItem[]; export declare function reconstructPretextLines(items: KPItem[], breaks: number[], prepared: PreparedTextWithSegments, /** See `pretextSegmentsToItems`. */ hyphenWidth: number, lineHeightPx: number, lineWidthFn: (lineIndex: number) => number, lineIndentFn: (lineIndex: number) => number, normalSpaceWidth: number, textAlign: TextAlign, /** `KPOptions.trackingPerChar` the breaks were found with: each line * takes the tracking the breaker counted on (`VDTLine.letterSpacing`). */ trackingPerChar?: number, /** How far below its top each line has its baseline * (`lineBaselineOffset`); 0.8 of the line height by default. */ baselineOffsetPx?: number, /** See `pretextSegmentsToItems`. */ geminateDotWidth?: number | ((piece: string) => number)): VDTLine[]; //# sourceMappingURL=pretextAdapter.d.ts.map