Style.measureText

Measure space given text will use.

  1. Vector2 measureText(Vector2 availableSpace, string text, bool wrap)
    class Style
    deprecated const
    measureText
    (,
    string text
    ,
    bool wrap = true
    )
    in (availableSpace.x.isFinite && availableSpace.y.isFinite, format!"Text space given must be finite: %s"(availableSpace))
    out (r; r.x.isFinite && r.y.isFinite, format!"Resulting text space must be finite: %s"(r))
  2. Rectangle measureText(Rectangle availableSpace, string text, bool wrap)

Parameters

availableSpace Vector2

Space available for drawing.

text string

Text to draw.

wrap bool

If true (default), the text will be wrapped to match available space, unless the space is empty.

Return Value

Type: Vector2

If availableSpace is a vector, returns the result as a vector.

If availableSpace is a rectangle, returns a rectangle of the size of the result, offset to the position of the given rectangle.

Meta