API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
interfaceTextStyleOptions
@codexo/exojs / rendering / stable
Construction-time options for a TextStyle. All properties are optional; defaults match the TextStyle constructor.
24
props
0
methods
0
events
Import
import { TextStyleOptions } from '@codexo/exojs'Construction-time options for a TextStyle. All properties are optional; defaults match the TextStyle constructor.
Properties24
Rule colour. null (the default) takes the fill, gradient included, so a gradient-filled label gets a gradient-filled rule.
decorationOffset?: numberExtra downward offset in pixels applied to both rules, on top of the position the font's metrics put them at. Defaults to 0.
decorationThickness?: numberRule thickness in pixels. 0 (the default) derives it from the font size.
font?: FontFaceA pre-constructed FontFace to use as the font for this node. When passed to Text, the face is automatically registered with document.fonts. Load the face via FontFactory before constructing the node so glyphs render immediately. Takes precedence over fontFamily when both are set. ts const face = await loader.load(Asset.type('font', 'roboto.woff2', { family: 'Roboto' })); const label = new Text('Score: 0', { font: face, fontSize: 24 });
fontFamily?: stringfontSize?: numberCSS font-variant-caps. Defaults to 'normal'.
CSS font-weight. Defaults to 'normal' so that single-weight custom fonts render without browser-synthesised bold artefacts. Set explicitly to 'bold' for display / title text that intentionally requires bold.
Multi-stop fill gradient. When set it overrides fillColor for the glyph interior; null disables it. The ramp spans the ink extent (getLocalBounds()), not the advance box.
leading?: numberExtra pixel gap between lines, added on top of lineHeight.
lineHeight?: numberMultiplier of fontSize for the distance between lines. Default 1.2 - not a pixel value.
outlineWidth?: numberOutline width in SDF units (0..0.5). 0 disables the outline.
shadowAlpha?: numberShadow opacity (0..1). 0 disables the shadow.
shadowBlur?: numberShadow blur softness (0..1). Larger values soften the shadow edge.
Drop-shadow color.
shadowOffsetX?: numberHorizontal shadow offset in pixels.
shadowOffsetY?: numberVertical shadow offset in pixels.
strikethrough?: booleanDraw a rule through each line. Defaults to false.
Case mapping applied before layout. Defaults to 'none'. The mapping is Unicode-aware and never touches the node's text: reading it back gives the string that was assigned, so a transformed label stays editable and a caret still lands where the reader clicked. 'capitalize' uppercases the first grapheme cluster of each word and leaves the rest of the word alone, matching CSS. Word boundaries and the case mapping both follow locale when LayoutOptions.locale sets one.
underline?: booleanDraw a rule under each line. Defaults to false.
Source