/** * Classical Arabic verse (#378, arabic-typography §6.1): a `:::verse` poem, * each bayt on one line in two hemistichs — the ṣadr on the start side * (the right in Arabic), the ʿajuz on the end side, a gap between them. * Every hemistich of a poem is set to one common width, so the hemistichs * of every bayt start and end on the same verticals and the rhyme letters * of the ʿajuz line up down the poem. * * - The common width: `width` on the fence, else the widest hemistich of * the poem's two-hemistich lines, at most half the measure less the gap. * - Each hemistich is brought to it with kashidas first (verse elongates * more than prose: twice the body's longest elongation at a join), then * its word spaces. A hemistich of one word that cannot fill it leaves the * rest to the gap, so its ends still sit on the verticals. * - A hemistich wider than the common width tightens its word spaces to * `bodyText.minWordSpacing`; if it still does not fit, the bayt is set * staggered: the ṣadr flush with the start side on its own line, the * ʿajuz flush with the end side on the next. A hemistich wider than the * measure is broken over lines there, which only a narrow column calls * for. * - A line of one hemistich (no `||`) is centred on the poem. * - The poem is centred in the measure (`align="start"`: flush with the * start side). `gap` sets the gap (default 2 em); `ornament` prints a * mark in its middle (٭, ✻), which is no character of the text. * * The poem is a paragraph whose lines carry final segment widths (the * block is set flush left): every renderer paints it as measured, the gap * a `space` segment flagged `labelTab`. Lines are in the flow frame, so a * mirrored page turns the whole poem. The hemistichs are measured as * paragraphs of their own in the poem's direction: each has its own bidi * order, joined here in the order of that direction. */ import type { ContentBlock } from '../parse/index.js'; import type { DirectiveAttrs } from '../parse/types.js'; import type { MeasuredBlock, MeasurementCache } from '../measure/index.js'; import { type KashidaOptions } from '../measure/kashida.js'; import type { BlockStyle } from './styles.js'; /** A poem's settings read from its fence. */ export interface VerseSettings { gapPx: number; /** Fixed hemistich width (`width`), px. */ widthPx?: number; align: 'center' | 'start'; ornament?: string; } /** `2em`, `12mm`, `1.5` (ems) as px at `fontSizePx`; undefined when it is * not a length. */ export declare function lengthAttr(value: string | undefined, dpi: number, fontSizePx: number): number | undefined; /** The settings of a poem's fence (`gap`, `width`, `align`, `ornament`). */ export declare function verseSettings(attrs: DirectiveAttrs, dpi: number, fontSizePx: number): VerseSettings; interface VerseLayoutInput { contentBlock: ContentBlock; style: BlockStyle; /** The measure, px. */ measureMaxWidth: number; dpi: number; minWordSpacing: number; /** The body's kashida options for this style, when it takes kashidas. */ kashida?: KashidaOptions; /** The poem's direction and its frame's. */ direction: 'ltr' | 'rtl'; frameDirection: 'ltr' | 'rtl'; cache?: MeasurementCache; } /** Lay a poem out (see the module comment). */ export declare function measureVerse(input: VerseLayoutInput): MeasuredBlock; export {}; //# sourceMappingURL=verse.d.ts.map