API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classGlyphMetrics
The 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 layout consumes, and it is deliberately kept out of GlyphAtlas: an atlas is a RASTER resource whose identity includes a pixel density, while an advance is a property of the typeface and the font size alone. Splitting them is what makes the two invariants of HiDPI text hold by construction rather than by luck: - the same string lays out identically at every `pixelRatio`, because the numbers layout reads never went near a raster grid; - Text.measure answers without rasterizing anything, so a measurement cannot allocate an atlas, cannot claim atlas space, and cannot depend on which Application happens to exist. One instance per `family` x `fontStyle` x `fontVariant` x `fontWeight`, shared by every atlas of that variant regardless of mode, SDF radius or pixel ratio - see GlyphAtlasPool.getMetrics. Satisfies GlyphProvider so it can drive a measurement-only layout pass. The GlyphInfo it hands out carries a real `advance` and zero geometry: there is no tile, no page and no UV rectangle behind it, and a caller that needs those wants an atlas instead.
import { GlyphMetrics } from '@codexo/exojs'The 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 layout consumes, and it is deliberately kept out of GlyphAtlas: an atlas is a RASTER resource whose identity includes a pixel density, while an advance is a property of the typeface and the font size alone. Splitting them is what makes the two invariants of HiDPI text hold by construction rather than by luck:
- the same string lays out identically at every `pixelRatio`, because the numbers layout reads never went near a raster grid; - Text.measure answers without rasterizing anything, so a measurement cannot allocate an atlas, cannot claim atlas space, and cannot depend on which Application happens to exist.
One instance per `family` x `fontStyle` x `fontVariant` x `fontWeight`, shared by every atlas of that variant regardless of mode, SDF radius or pixel ratio - see GlyphAtlasPool.getMetrics.
Satisfies GlyphProvider so it can drive a measurement-only layout pass. The GlyphInfo it hands out carries a real `advance` and zero geometry: there is no tile, no page and no UV rectangle behind it, and a caller that needs those wants an atlas instead.
advance(char: string, fontSize: number): numberclear(): voidcssFont(size: number): stringgetGlyph(char: string, fontSize: number): GlyphInfoCached glyph data stored in an atlas page after rasterization.getKerning(prev: string, next: string, fontSize: number): number