ttfGetTextSize function

bool ttfGetTextSize(
  1. Pointer<TtfText> text,
  2. Pointer<Int32> w,
  3. Pointer<Int32> h
)

Get the size of a text object.

The size of the text may change when the font or font style and size change.

\param text the TTF_Text to query. \param w a pointer filled in with the width of the text, in pixels, may be NULL. \param h a pointer filled in with the height of the text, in pixels, may be NULL. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should be called on the thread that created the text.

\since This function is available since SDL_ttf 3.0.0.

extern SDL_DECLSPEC bool SDLCALL TTF_GetTextSize(TTF_Text *text, int *w, int *h)

Implementation

bool ttfGetTextSize(Pointer<TtfText> text, Pointer<Int32> w, Pointer<Int32> h) {
  final ttfGetTextSizeLookupFunction = libSdl3Ttf.lookupFunction<
      Uint8 Function(Pointer<TtfText> text, Pointer<Int32> w, Pointer<Int32> h),
      int Function(Pointer<TtfText> text, Pointer<Int32> w,
          Pointer<Int32> h)>('TTF_GetTextSize');
  return ttfGetTextSizeLookupFunction(text, w, h) == 1;
}