import type { CjkLineBreakLevel } from '../../measure/cjkClasses.js'; import type { LetteringStyle, LetteringText } from './types.js'; /** How one character of the prepared text is set. */ export interface CharStyle { bold: boolean; italic: boolean; script?: 'sup' | 'sub'; /** Vertical text: a run set in one cell (`tcy`), upright or sideways; * `orientId` tells two `:tcy` runs side by side apart. */ orient?: 'tcy' | 'upright' | 'sideways'; orientId?: number; /** Ruby (furigana) over this character (`:ruby[漢字]{…}`): the reading * of its run; characters of one ruby share `id`. A group ruby is one * reading over the whole run, which never breaks. */ ruby?: { id: number; text: string; group: boolean; }; } /** Directional isolate controls (UAX #9): LRI, RLI, PDI. The text of a * `:ltr[…]` / `:rtl[…]` run is wrapped in them, so the design-text bidi * sets it as an isolate; they print nothing and are taken out of the * lines once laid out. */ export declare const LRI = "\u2066"; export declare const RLI = "\u2067"; export declare const PDI = "\u2069"; /** Whether a character is a bidi isolate control. */ export declare const isIsolateControl: (ch: string) => boolean; /** The text of a balloon ready to shape. `text` holds `\n` at forced * breaks; `style` and `source` are per UTF-16 unit of `text`. */ export interface PreparedText { text: string; style: CharStyle[]; /** Source offset of each unit (-1: none known). */ source: number[]; } /** Whether a language sets `。` and drops it at the end of a balloon by * default (Japanese and Chinese manga practice). */ export declare function dropsFinalStopByDefault(locale: string): boolean; /** Read the item's text into styled characters with source offsets. */ export declare function readLetteringText(text: LetteringText, sourceMap: readonly number[] | undefined): PreparedText; /** Options of {@link prepareText} beyond the style. */ export interface PrepareOptions { locale: string; vertical: boolean; } /** * The house rules of SPEC D3.1 applied to a read text: * - whitespace runs set as one space, lines trimmed; * - an ellipsis written as dots made one `…` (two, `……`, in Chinese); * - `doubleDash`: an em dash becomes `--`; * - `dropFinalStop`: a final `。` (or `.`) dropped; * - emphasis printed bold italic (bold only where the script has no * italics: Arabic, CJK); * - `uppercase`: capitals for the cased letters only (scripts without case * stay as they are), with the locale's rules (Turkish i). */ export declare function prepareText(read: PreparedText, style: LetteringStyle, opts: PrepareOptions): PreparedText; /** A place a line may break: the line ends at `end`, the next starts at * `next` (after the spaces). `penalty` grows with how badly the break * parts a word or a phrase; `forced` breaks must be taken. */ export interface BreakPoint { end: number; next: number; penalty: number; forced: boolean; /** Chinese text: the break falls inside a word of the runtime's * segmenter, or between two characters of a word its dictionary does * not know (#728). Never set in Japanese text, whose breaks go by * phrases. */ inWord?: true; } /** The legal breaks of a prepared text (the text's end included, as a * forced break). */ export declare function breakPoints(p: PreparedText, level: CjkLineBreakLevel, japanese: boolean): BreakPoint[]; /** Design-text markup of `p[a, b)`: the characters escaped, each run of * one style wrapped in its markers (bold, italic, scripts, orientation), * closed at the end of the range. */ export declare function markupOf(p: PreparedText, a: number, b: number): string; /** Whether any character of `p[a, b)` is set in a style other than the * plain one. */ export declare function hasMarks(p: PreparedText, a?: number, b?: number): boolean; //# sourceMappingURL=text.d.ts.map