API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classText
GPU-accelerated text node that rasterizes individual glyphs into a shared per-font-variant GlyphAtlas using the SDF (Signed Distance Field) technique and renders them through the `text-sdf` shader. Style mutations are applied automatically before the next draw — no manual `update()` call required. Mutating `text.style` any number of times in the same frame is cheap; the geometry is rebuilt at most once, on demand. ```ts const label = new Text('Hello', { fontSize: 24 }); scene.addChild(label); label.style.fillColor = new Color(255, 0, 0); // cheap — no atlas work label.style.outlineWidth = 0.08; // cheap — only shader uniforms // changes are picked up automatically on the next render pass ``` **FontFace-first:** load fonts via FontFactory before constructing the node, then pass the loaded `FontFace` via the `font` style option. The label renders immediately with the correct glyphs — no async waiting needed. ```ts const face = await loader.load(FontFactory, 'roboto.woff2', { family: 'Roboto' }); const label = new Text('Score: 0', { font: face, fontSize: 24 }); scene.addChild(label); // renders immediately with Roboto ``` Enable colour-glyph (emoji) mode via `colorGlyphs: true` in the constructor options. Colour-glyph nodes use the `text-color` shader instead of `text-sdf`.
import { Text } from '@codexo/exojs' GPU-accelerated text node that rasterizes individual glyphs into a shared per-font-variant GlyphAtlas using the SDF (Signed Distance Field) technique and renders them through the `text-sdf` shader.
Style mutations are applied automatically before the next draw — no manual `update()` call required. Mutating `text.style` any number of times in the same frame is cheap; the geometry is rebuilt at most once, on demand.
```ts const label = new Text('Hello', { fontSize: 24 }); scene.addChild(label);
label.style.fillColor = new Color(255, 0, 0); // cheap — no atlas work label.style.outlineWidth = 0.08; // cheap — only shader uniforms // changes are picked up automatically on the next render pass ```
**FontFace-first:** load fonts via FontFactory before constructing the node, then pass the loaded `FontFace` via the `font` style option. The label renders immediately with the correct glyphs — no async waiting needed.
```ts const face = await loader.load(FontFactory, 'roboto.woff2', { family: 'Roboto' }); const label = new Text('Score: 0', { font: face, fontSize: 24 }); scene.addChild(label); // renders immediately with Roboto ```
Enable colour-glyph (emoji) mode via `colorGlyphs: true` in the constructor options. Colour-glyph nodes use the `text-color` shader instead of `text-sdf`.
new(text: string, style?: TextStyleOptions | TextStyle, layout?: LayoutOptions, options: object): Text _invalidateBoundsCascade(): void _invalidateChildrenTransform(): void _invalidateSubtreeTransform(): void addFilter(filter: Filter): this clearFilters(): this collidesWith(target: Collidable): CollisionResponse | null contains(x: number, y: number): boolean destroy(): void getBounds(): Rectangle getGlobalTransform(): Matrix getLocalBounds(): Rectangle getNormals(): Vector[] getTransform(): Matrix intersectsWith(target: Collidable): boolean invalidateCache(): this inView(view: View): boolean move(x: number, y: number): this project(axis: Vector, result: Interval): Interval removeFilter(filter: Filter): this render(backend: RenderBackend): this rotate(degrees: number): this setAnchor(x: number, y: number): this setBlendMode(blendMode: BlendModes): this setOrigin(x: number, y: number): this setPosition(x: number, y: number): this setRotation(degrees: number): this setScale(x: number, y: number): this setSkew(x: number, y: number): this setTint(color: Color): this syncDirty(): void update(_dt: number): void updateBounds(): this updateParentTransform(): this updateTransform(): this setInternalSpriteFactory(factory: object | null): void clip: boolean clipShape: Rectangle | Geometry | null collisionType: CollisionType cursor: string | null draggable: boolean flags: Flags<SceneNodeTransformFlags> preserveDrawOrder: boolean anchor: ObservableVector atlas: GlyphAtlas | null atlasMode: AtlasMode blendMode: BlendModes cacheAsBitmap: boolean colorGlyphs: boolean cullable: boolean filters: readonly Filter[] interactive: boolean isAlignedBox: boolean layout: LayoutOptions mask: MaskSource origin: ObservableVector pageQuads: readonly TextPageQuads[] parent: Container | null pixelSnapMode: PixelSnapMode position: ObservableVector rotation: number scale: ObservableVector sdfRadius: number skewX: number skewY: number style: TextStyle text: string textBounds: TextSize tint: Color visible: boolean x: number y: number zIndex: number onDrag: Signal<[InteractionEvent]> onDragEnd: Signal<[InteractionEvent]> onDragStart: Signal<[InteractionEvent]> onPointerDown: Signal<[InteractionEvent]> onPointerMove: Signal<[InteractionEvent]> onPointerOut: Signal<[InteractionEvent]> onPointerOver: Signal<[InteractionEvent]> onPointerTap: Signal<[InteractionEvent]> onPointerUp: Signal<[InteractionEvent]>