Font.measureText

Wraps TTF_MeasureUNICODE (from SDL_ttf 2.0.18) to calculate the maximum number of characters from a text that can be rendered given a maximum fitting width

  1. TextMeasurement measureText(string text, uint measureWidth)
  2. TextMeasurement measureText(wstring text, uint measureWidth)
    class Font
    const @trusted
    static if(sdlTTFSupport >= SDLTTFSupport.v2_0_18)
    TextMeasurement
    measureText
    (
    wstring text
    ,)

Parameters

text wstring

wstring of characters to measure

measureWidth uint

maximum fitting width

Return Value

named tuple of extent (calculated width) and count (number of characters)

Throws

dsdl.SDLException if unable to measure text

Meta