Typeface.measure

Measure space the given text would span. Uses dots as the unit.

If availableSpace is specified, assumes text wrapping. Text wrapping is only performed on whitespace characters.

  1. Vector2 measure(Vector2 availableSpace, String text, bool wrap)
    interface Typeface
    final
    measure
    (
    alias chunkWords = defaultWordChunks
    String
    )
    (,
    String text
    ,
    bool wrap = true
    )
  2. Vector2 measure(String text)
  3. void measure(TextRuler ruler, String text, bool wrap)

Parameters

chunkWords

Algorithm to use to break words when wrapping text; separators must be preserved as separate words.

availableSpace Vector2

Amount of available space the text can take up (dots), used to wrap text.

text String

Text to measure.

wrap bool

Toggle text wrapping. Defaults to on, unless using the single argument overload.

Return Value

Type: Vector2

Vector2 representing the text size, if TextRuler is not specified as an argument.

Meta