Name | Type | Description |
---|---|---|
text |
string |
the text that was measured |
style |
PIXI.TextStyle |
the style that was measured |
width |
number |
the measured width of the text |
height |
number |
the measured height of the text |
lines |
array |
an array of the lines of text broken by new lines and wrapping if specified in style |
lineWidths |
array |
an array of the line widths for each line matched to |
lineHeight |
number |
the measured line height for this style |
maxLineWidth |
number |
the maximum line width for all measured lines |
fontProperties |
Object |
the font properties object from TextMetrics.measureFont |
Classes
Methods
-
Convienience function for logging each line added during the wordWrap method
Name Type Default Description line
string The line of text to add
newLine
boolean true Add new line character to end
Returns:
Type Description string A formatted line -
Gets & sets the widths of calculated characters in a cache object
Name Type Description key
string The key
letterSpacing
number The letter spacing
cache
object The cache
context
CanvasRenderingContext2D The canvas context
Returns:
Type Description number The from cache. -
PIXI.TextMetrics.measureFont (font)PIXI.TextMetrics~FontMetrics static
-
Calculates the ascent, descent and fontSize of a given font-style
Name Type Description font
string String representing the style of the font
Returns:
Type Description PIXI.TextMetrics~FontMetrics Font properties object -
PIXI.TextMetrics.measureText (text, style, wordWrap, canvas)PIXI.TextMetrics static
-
Measures the supplied string of text and returns a Rectangle.
Name Type Description text
string the text to measure.
style
PIXI.TextStyle the text style to use for measuring
wordWrap
boolean optional optional override for if word-wrap should be applied to the text.
canvas
HTMLCanvasElement optional optional specification of the canvas to use for measuring.
Returns:
Type Description PIXI.TextMetrics measured width and height of the text.