TTF_GetTextSize(3)
β¨ TTF_GetTextSize β¨
okay so bestie, welcome to TTF_GetTextSize(3) β a lil function from the SDL_ttf3 FUNCTIONS crew, and she's here to tell you exactly how big your text object is. π
πΈ NAME πΈ
TTF_GetTextSize β get the size of a text object. that's it. that's the whole job. and she ate. π
π HEADER FILE π
defined in SDL3_ttf/SDL_ttf.h
π¦ SYNOPSIS π¦
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_GetTextSize(TTF_Text *text, int *w, int *h);
π DESCRIPTION π
so like. you ask her how big your text is, and she tells you. simple. iconic. no notes. β¨
but heads up: the size of the text may change when the font or font style and size change. so like, don't go caching that number forever and then acting shocked when it's wrong β that's on you, not her. π
π«Ά FUNCTION PARAMETERS π«Ά
textβ theTTF_Textto query. the main character of this whole operation, fr fr. πwβ a pointer that gets filled in with the width of the text, in pixels. and guess what? she may beNULL. lowkey flexible of her. πhβ a pointer that gets filled in with the height of the text, in pixels. also may beNULL. the way she lets you opt out of either oneβ¦ generous. π
π₯ RETURN VALUE π₯
returns true on success or false on failure. and if it fails? call SDL_GetError() for more information, bestie. she's not gonna ghost you with a mystery error, go read the message. π
π§ THREAD SAFETY π§
β οΈ this function should be called on the thread that created the text.
no cap. do NOT be out here calling her from a random other thread. the text has a home thread and that's where you visit her. periodt. π
π AVAILABILITY π
this function is available since SDL_ttf 3.0.0. so if you're on something olderβ¦ yeah, she doesn't exist yet. sorry babe. π
and that's the whole page!! go measure some text, you got this. mwah. πβ¨π
β xoxo, your fav manual page, brought to you by SDL_ttf 3.2.2, dated SDL_ttf. stay slaying, bestie. π«Άπ πΈ
π¦ where this page comes from
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms