@lightningjs/renderer
Version:
Lightning 3 Renderer
46 lines (45 loc) • 1.01 kB
TypeScript
import type { PeekableIterator } from './PeekableGenerator.js';
/**
* Minimal glyph info for performance-focused text shaping
*/
export interface SimpleGlyphInfo {
/**
* Whether the character was successfully mapped to a glyph
*/
mapped: boolean;
/**
* Unicode codepoint
*/
codepoint: number;
/**
* How much to advance horizontally after rendering this glyph
*/
xAdvance: number;
}
/**
* Minimal font shaper properties
*/
export interface FontShaperProps {
/**
* Font family name
*/
fontFamily: string;
/**
* Font size in pixels
*/
fontSize: number;
/**
* Letter spacing in pixels
*/
letterSpacing: number;
}
/**
* Functional font shaper interface
*/
export interface FontShaper {
shapeText: (props: FontShaperProps, codepoints: PeekableIterator<number>) => Generator<SimpleGlyphInfo, void>;
}
/**
* Create a simple SDF font shaper
*/
export declare const createSdfFontShaper: () => FontShaper;