API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
interfaceAtlasPage
@codexo/exojs / rendering / stable
A single texture page within a GlyphAtlas. Glyphs are packed into the page using a shelf-bin algorithm. In `'sdf'` mode the page owns a `DataTexture` (`r8`) filled with the single-channel distance field GlyphSdf computes. In `'color'` mode a Canvas 2D context preserves full glyph colours for emoji.
5
props
8
methods
0
events
Import
import { AtlasPage } from '@codexo/exojs'A single texture page within a GlyphAtlas. Glyphs are packed into the page using a shelf-bin algorithm.
In `'sdf'` mode the page owns a `DataTexture` (`r8`) filled with the single-channel distance field GlyphSdf computes. In `'color'` mode a Canvas 2D context preserves full glyph colours for emoji.
Methods8
destroy(): voidRelease the page's GPU resource. Only for pages whose owner is a single node. The pages of a GlyphAtlas outlive every node that drew from them and are reset, never destroyed.
fillSolid(slotX: number, slotY: number, w: number, h: number): voidFill a slot with fully opaque ink - the deepest inside value in 'sdf' mode, opaque white in 'color' mode - so a quad sampling it renders as a solid rectangle whichever fragment stage draws it.
insert(w: number, h: number): null | { x: number; y: number }measureGlyph(char: string, state: CanvasTextState): TextMetricsrasterize(char: string, slotX: number, slotY: number, ascent: number, bbLeft: number, state: CanvasTextState): voidRasterize a white glyph into the canvas at the given padded slot origin (canvas mode only).
reset(): voiduploadDirtyRegion(): voidwriteSdf(data: Uint8ClampedArray, slotX: number, slotY: number, srcW: number, srcH: number): voidCopy R8 SDF data into the page buffer at the given slot origin. Only valid in 'sdf' mode. data is a Uint8ClampedArray of single-channel SDF values as produced by GlyphSdf.draw. Each value is one byte (0 = far outside the glyph, 255 = deep inside, ~128 = glyph edge).
Properties5
index: numberheight: numberPage height in atlas texels.
width: numberPage width in atlas texels - the denominator of every uvLeft/uvRight addressing it.
Source