Interface: ShapeTextOptions
Defined in: text/utilities/shape-text.ts:11
Options for shapeText. Mirrors the shape-relevant subset of
TextEcsComponent.
Properties
horizontalAlign?
optionalhorizontalAlign?:"left"|"right"|"center"|"justify"
Defined in: text/utilities/shape-text.ts:30
Horizontal alignment of each line within maxWidth. Defaults to
'left'. Irrelevant, and ignored, when maxWidth is unset - with no
container to align against, every unwrapped line is already exactly as
wide as the block itself.
horizontalAlignPivot?
optionalhorizontalAlignPivot?:number
Defined in: text/utilities/shape-text.ts:64
Where the shaped block's local origin (x = 0, the point every glyph
offset is ultimately relative to) sits within the horizontalAlign
box, as a fraction of maxWidth from the box's left edge - 0 (the
default) means the origin is the box's left edge, 0.5 means it sits
at the box's horizontal center, and 1 at its right edge. Irrelevant
when maxWidth is unset, for the same reason horizontalAlign is (see
its own doc comment).
This exists because a caller that positions the shaped block by a
center (or right) pivot - rather than a left edge - would otherwise get
horizontalAlign's alignment box measured from the wrong point: e.g. a
'center'-aligned single line under a center pivot would end up
offset by half its own alignment box, since x = 0 would land at the
box's center rather than its left edge. Defaults to 0 because that's
the shape every existing caller before this field was added already
assumed.
letterSpacing?
optionalletterSpacing?:number
Defined in: text/utilities/shape-text.ts:19
Extra spacing between glyphs, in world units, added to each glyph's
advance. Defaults to 0.
lineHeight?
optionallineHeight?:number
Defined in: text/utilities/shape-text.ts:22
Multiplier on the font's authored line height. Defaults to 1.
maxWidth?
optionalmaxWidth?:number
Defined in: text/utilities/shape-text.ts:44
Wraps at word boundaries when a line would exceed this width, in world
units. undefined (the default) never wraps.
size
size:
number
Defined in: text/utilities/shape-text.ts:13
Font size, in world units - the rendered em height.
verticalAlign?
optionalverticalAlign?:"middle"|"top"|"bottom"|"baseline"|"capline"
Defined in: text/utilities/shape-text.ts:38
Vertical alignment of the shaped block's visible ink relative to its
anchor (the origin every glyph offset is relative to) - see
TextDefaultedOptions.verticalAlign for the precise semantics.
Defaults to 'top'.