Function: shapeText()
shapeText(
text,fontAtlasData,options):ShapedText
Defined in: text/utilities/shape-text.ts:467
Shapes a (possibly multi-line, possibly wrapped) string into glyph quads.
Splits on whitespace into words, greedily wraps them into lines against
maxWidth (see wrapIntoLines), then positions each line
according to horizontalAlign/verticalAlign/lineHeight.
justify stretches the gaps between words to fill maxWidth exactly, on
every line except the last (a fully-justified last line of one or two
words reads as visibly, unintentionally stretched - most text engines
leave it left-aligned, and so does this one) and except lines with a
single word (nothing to stretch). It has no effect when maxWidth is
unset, since every line is then already exactly as wide as the block.
Code points not present in fontAtlasData.glyphs are silently skipped
(no glyph quad, no advance) rather than throwing - a missing glyph in
player-supplied or localized text is a content problem, not a programming
error.
Parameters
text
string
The string to shape.
fontAtlasData
The font atlas metrics to shape against.
options
Shaping options.
Returns
The shaped glyph quads and the block's bounds.