import type { CjkLineBreakLevel } from '../../measure/cjkClasses.js'; import type { CjkRegion } from '../../types.js'; import type { VDTDesignTextBlock } from '../../vdt.js'; import { type PreparedText } from './text.js'; import type { LetteringStyle, Rect } from './types.js'; /** Settings of one shaping. */ export interface ShapeOptions { locale: string; vertical: boolean; dpi: number; /** Target aspect (text block width / height; height / width when * vertical) overriding the style's (reshaping). */ aspect?: number; cjkLineBreak?: CjkLineBreakLevel; cjkRegion?: CjkRegion; mirrored?: boolean; /** Longest line (column) allowed, px, below the style's own cap: a * balloon reshaped to fit a short or narrow panel. */ maxLength?: number; } /** A shaped text: its design text block laid out with the top left corner * of its box at (0, 0), the ink of every line, and how it was chosen. */ export interface ShapedText { block: VDTDesignTextBlock; /** Ruby readings over (beside) their bases, same frame as `block`. */ rubies?: VDTDesignTextBlock[]; vertical: boolean; /** Ranges of the prepared text per line (column). */ lines: { start: number; end: number; width: number; }[]; /** Ink box of every line (column), relative to the block's origin. */ ink: Rect[]; inkBox: Rect; em: number; lineHeightPx: number; /** Aspect of the text block as scored. */ aspect: number; score: number; /** What its breaks cost (their penalties and orphan lines, weighted as * in the score): how well it parts the text, whatever its shape. */ breakCost: number; /** How many of its breaks part a Chinese word (`BreakPoint.inWord`, * #728). */ wordCuts: number; } /** Default target aspects of a text block. */ export declare const DEFAULT_ASPECT_HORIZONTAL = 1.8; export declare const DEFAULT_ASPECT_VERTICAL = 1.3; /** The CJK line-break level of a locale when the book names none: the * strictest Japanese one (no column opens with a small kana or ー; balloon * columns are short, and break at phrases anyway), GB/T for Chinese. */ export declare function defaultCjkLineBreak(locale: string): CjkLineBreakLevel; /** The fraction of the widest line a line `i` of `n` takes in an oval * block: the chord of a superellipse at the line's middle, the ends kept * off zero. */ export declare function ovalProfile(i: number, n: number): number; /** The writing mode a style sets its text in on a panel. */ export declare function styleIsVertical(style: LetteringStyle, panelVertical: boolean): boolean; /** * Shape a prepared text and set it: the best line set for the style's * aspect (or `opts.aspect`), laid out as a design text block at (0, 0). * Lengths are page px. */ export declare function shapeText(p: PreparedText, style: LetteringStyle, opts: ShapeOptions): ShapedText; /** The `count` best shapings (distinct line sets), best first. */ export declare function shapeTextCandidates(p: PreparedText, style: LetteringStyle, opts: ShapeOptions, count: number): ShapedText[]; /** The ink box of every line (column) of a laid-out block. */ export declare function inkOf(block: VDTDesignTextBlock, em: number, vertical: boolean): Rect[]; /** A copy of a block moved by (dx, dy): horizontal baselines are page * coordinates, vertical ones are measured from the box. */ export declare function translateBlock(block: VDTDesignTextBlock, dx: number, dy: number): VDTDesignTextBlock; //# sourceMappingURL=shape-text.d.ts.map