/** * The ligatures of a tracked text, as the measurer sees them (#663, #770). * * A tracked word is measured at its natural width, the ligatures of the * face counted, plus the tracking times its letters. A browser sets no * optional ligature under a letter-spacing, on the canvas or in a box, so * the word painted with the spacing alone is wider than its place: Chrome * 154 at 40 px, `first` 4.56 px in Newsreader and 2.76 px in Source Serif * 4, `office` 7 px in EB Garamond. The canvas paints such a word in * pieces (`canvas-backend/trackedText.ts`): each ligature alone under no * letter-spacing, the letters between them tracked, every piece where the * natural shaping puts it and the tracking of every letter before it * further on. This module finds the same pieces with the engine's own * measurer, for an output that has no painting context to ask (the HTML). * * Which letters: two neighbours whose width under a letter-spacing, the * spacing taken off, is not their natural width are a ligature, and a * third joins them the same way (f + f + i). A face whose ligature is as * wide as its letters (Geist's `fi`) shows nothing here, and needs * nothing: set apart under the letter-spacing its letters stand where the * layout counted them. * * A form by the neighbours is no ligature. Under a letter-spacing the * browser takes the contextual alternates of a face away with its * ligatures, and two neighbours with such forms read as a ligature to the * probe above (Playpen Sans: `FO`, `OR`, most pairs). A zero width * non-joiner between the two tells: it dissolves a ligature and leaves a * form by the neighbours (`canvas-backend/trackedText.ts` has the widths * measured). Two neighbours as wide across a non-joiner as without one * are left in the letters around them: the HTML sets a word with such * forms whole, at the letter-spacing that ends it where it was measured, * as the canvas paints it in a document shaped in its own language. Only * such a document asks here. * * In the language measured in (`getMeasureLanguage`): a face ligates * otherwise under a language (no `fi` in Turkish). */ /** One piece of a tracked text set apart from the rest. */ export interface LigaturePiece { text: string; /** Where the piece starts in the text's natural shaping, px from its * start, the kerning before it counted. */ offset: number; /** Its natural width, px: alone, under no letter-spacing. */ width: number; /** Its letters (graphemes): each takes the tracking once. */ letters: number; /** A ligature: set under no letter-spacing. */ ligature: boolean; } /** * The pieces a tracked `text` (a word, or any text set as one run) is set * in, in `font` and the language measured in, or null when it is set * whole: the browser shapes it the same under a letter-spacing, the * canvas measures none, or the text holds a joining letter or a * right-to-left one. */ export declare function trackedLigaturePieces(text: string, font: string): readonly LigaturePiece[] | null; //# sourceMappingURL=trackedLigatures.d.ts.map