API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classGlyphAtlas
A per-font-variant glyph atlas with automatic multi-page growth. In `'sdf'` mode (default) each atlas page is a single-channel R8 `DataTexture` populated by GlyphSdf. One `GlyphSdf` instance is kept per raster font size so the atlas can mix sizes efficiently. In `'color'` mode pages are RGBA canvas textures that preserve full glyph colour data for emoji and colour fonts. **Pixel ratio.** An atlas rasterizes at `pixelRatio` device pixels per logical pixel: a glyph asked for at logical size 9 in a ratio-3 atlas is rendered from a 27px font, and every raster-derived number it hands back is divided by the ratio again so the caller keeps working in logical units. The ratio is part of the atlas's identity (GlyphAtlasPool) - it has to be, because the pool is process-wide and two applications at different densities must not share one set of pages. The LOGICAL metrics layout consumes (advance, kerning) come from the ratio-independent GlyphMetrics instead, so the same string lays out identically at every ratio.
import { GlyphAtlas } from '@codexo/exojs'A per-font-variant glyph atlas with automatic multi-page growth.
In `'sdf'` mode (default) each atlas page is a single-channel R8 `DataTexture` populated by GlyphSdf. One `GlyphSdf` instance is kept per raster font size so the atlas can mix sizes efficiently.
In `'color'` mode pages are RGBA canvas textures that preserve full glyph colour data for emoji and colour fonts.
**Pixel ratio.** An atlas rasterizes at `pixelRatio` device pixels per logical pixel: a glyph asked for at logical size 9 in a ratio-3 atlas is rendered from a 27px font, and every raster-derived number it hands back is divided by the ratio again so the caller keeps working in logical units. The ratio is part of the atlas's identity (GlyphAtlasPool) - it has to be, because the pool is process-wide and two applications at different densities must not share one set of pages. The LOGICAL metrics layout consumes (advance, kerning) come from the ratio-independent GlyphMetrics instead, so the same string lays out identically at every ratio.
new(font: FontVariantKeyEverything that decides which glyphs a text run is drawn from. Named rather than positional because the four values are all strings and three of them default t…, pageSize: number, mode: AtlasModeAtlas rendering mode. Determines texture format and rasterization strategy. `'sdf'` uses a single-channel R8 DataTexture with EDT-based rasterization. `'color'…, sdfRadius: number, pixelRatio: number, metrics?: GlyphMetricsThe LOGICAL typographic metrics of one font variant - advances and kerning, in logical pixels, at the logical font size. This is the half of a glyph that layou…): GlyphAtlasclear(): voidgetGlyph(char: string, size: number): GlyphInfoCached glyph data stored in an atlas page after rasterization.getKerning(prev: string, next: string, fontSize: number): numberpixelRatio: numbersdfRadius: number