the text that was measured
the style that was measured
the measured width of the text
the measured height of the text
an array of the lines of text broken by new lines and wrapping if specified in style
an array of the line widths for each line matched to lines
the measured line height for this style
the maximum line width for all measured lines
the font properties object from TextMetrics.measureFont
The font properties object from TextMetrics.measureFont.
The measured height of the text.
The measured line height for this style.
An array of the line widths for each line matched to lines
.
An array of lines of the text broken by new lines and wrapping is specified in style.
The maximum line width for all measured lines.
The style that was measured.
The text that was measured.
The measured width of the text.
Static
BASELINE_Baseline multiplier for calculate font metrics.
Static
BASELINE_Baseline symbol for calculate font metrics.
Static
HEIGHT_Height multiplier for setting height of canvas to calculate font metrics.
Static
METRICS_String used for calculate font metrics. These characters are all tall to help calculate the height required for text.
Static
Optional
_experimentalStatic
experimentalNew rendering behavior for letter-spacing which uses Chrome's new native API. This will lead to more accurate letter-spacing results because it does not try to manually draw each character. However, this Chrome API is experimental and may not serve all cases yet.
PIXI.TextMetrics.experimentalLetterSpacingSupported
Static
graphemeA Unicode "character", or "grapheme cluster", can be composed of multiple Unicode code points,
such as letters with diacritical marks (e.g. '\u0065\u0301'
, letter e with acute)
or emojis with modifiers (e.g. '\uD83E\uDDD1\u200D\uD83D\uDCBB'
, technologist).
The new Intl.Segmenter
API in ES2022 can split the string into grapheme clusters correctly. If it is not available,
PixiJS will fallback to use the iterator of String, which can only spilt the string into code points.
If you want to get full functionality in environments that don't support Intl.Segmenter
(such as Firefox),
you can use other libraries such as [grapheme-splitter]https://www.npmjs.com/package/grapheme-splitter
or [graphemer]https://www.npmjs.com/package/graphemer to create a polyfill. Since these libraries can be
relatively large in size to handle various Unicode grapheme clusters properly, PixiJS won't use them directly.
Static
experimentalChecking that we can use modern canvas 2D API.
Note: This is an unstable API, Chrome < 94 use textLetterSpacing
, later versions use letterSpacing
.
Static
canOverridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.
It allows one to determine whether a pair of characters should be broken by newlines For example certain characters in CJK langs or numbers. It must return a boolean.
The character
The next character
The token/word the characters are from
The index in the token of the char
The style attr break words
whether to break word or not
Static
canOverridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.
It allows one to customise which words should break Examples are if the token is CJK or numbers. It must return a boolean.
The token
The style attr break words
Whether to break word or not
Static
clearStatic
isDetermines if char is a breaking whitespace.
It allows one to determine whether char should be a breaking whitespace For example certain characters in CJK langs or numbers. It must return a boolean.
The character
Optional
_nextChar: stringThe next character
True if whitespace, False otherwise.
Static
measureStatic
measureMeasures the supplied string of text and returns a Rectangle.
Measured width and height of the text.
Static
wordOverridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.
It is called when a token (usually a word) has to be split into separate pieces in order to determine the point to break a word. It must return an array of characters.
The token to split
The characters of the token
TextMetrics.graphemeSegmenter
Generated using TypeDoc
The TextMetrics object represents the measurement of a block of text with a specified style.
Example
Memberof
PIXI