chore: follow the general comments style

This commit is contained in:
Ilia Mashkov
2026-04-17 12:14:55 +03:00
parent 0ebf75b24e
commit cfaff46d59
56 changed files with 1600 additions and 499 deletions
@@ -10,16 +10,29 @@ import {
* sequences and combining characters each produce exactly one entry.
*/
export interface LayoutLine {
/** Full text of this line as returned by pretext. */
/**
* Full text of this line as returned by pretext.
*/
text: string;
/** Rendered width of this line in pixels. */
/**
* Rendered width of this line in pixels.
*/
width: number;
/**
* Individual character metadata for this line
*/
chars: Array<{
/** The grapheme cluster string (may be >1 code unit for emoji, etc.). */
/**
* The grapheme cluster string (may be >1 code unit for emoji, etc.).
*/
char: string;
/** X offset from the start of the line, in pixels. */
/**
* X offset from the start of the line, in pixels.
*/
x: number;
/** Advance width of this grapheme, in pixels. */
/**
* Advance width of this grapheme, in pixels.
*/
width: number;
}>;
}
@@ -28,9 +41,13 @@ export interface LayoutLine {
* Aggregated output of a single-font layout pass.
*/
export interface LayoutResult {
/** Per-line grapheme data. Empty when input text is empty. */
/**
* Per-line grapheme data. Empty when input text is empty.
*/
lines: LayoutLine[];
/** Total height in pixels. Equals `lines.length * lineHeight` (pretext guarantee). */
/**
* Total height in pixels. Equals `lines.length * lineHeight` (pretext guarantee).
*/
totalHeight: number;
}
@@ -65,7 +82,9 @@ export class TextLayoutEngine {
*/
#segmenter: Intl.Segmenter;
/** @param locale BCP 47 language tag passed to Intl.Segmenter. Defaults to the runtime locale. */
/**
* @param locale BCP 47 language tag passed to Intl.Segmenter. Defaults to the runtime locale.
*/
constructor(locale?: string) {
this.#segmenter = new Intl.Segmenter(locale, { granularity: 'grapheme' });
}