Font.measureText

Wraps TTF_MeasureUTF8 (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)
    class Font
    const @trusted
    static if(sdlTTFSupport >= SDLTTFSupport.v2_0_18)
    TextMeasurement
    measureText
    (
    string text
    ,)
  2. TextMeasurement measureText(wstring text, uint measureWidth)

Parameters

text string

string 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