TTF_GetTextFont(3)

πŸ’– TTF_GetTextFont(3) πŸ’–

okay bestie so this one lives in the SDL_ttf3 FUNCTIONS corner of the SDL_ttf manual and it's literally the chillest little getter β€” it tells you which font your text object is currently serving looks with. main character energy, zero drama. ✨


🌸 NAME 🌸

TTF_GetTextFont</ppurple> β€” get the font used by a text object. that's it, that's the job. πŸŽ€


πŸ¦‹ HEADER FILE πŸ¦‹

defined in SDL3_ttf/SDL_ttf.h

iykyk, you gotta have that header on deck. πŸ’…


✨ SYNOPSIS ✨

#include "SDL3_ttf/SDL_ttf.h"

TTF_Font * TTF_GetTextFont(TTF_Text *text);

πŸ“ FUNCTION PARAMETERS πŸ“

  • text β€” the TTF_Text to query. like, which text object are we asking about, bestie? that one. 🫢

🌈 RETURN VALUE 🌈

returns a TTF_Font * β€” the TTF_Font used by the text on success, or NULL on failure.

and if it fails? not me getting a NULL with no explanation 😭 call SDL_GetError() for more information, she'll tell you what went wrong.


🧚 THREAD SAFETY 🧚

this function should be called on the thread that created the text.

no cap. text objects are not about to be passed around between threads, that's giving chaos. keep it on the thread that birthed it. πŸ‘‘


⭐ AVAILABILITY ⭐

this function is available since SDL_ttf 3.0.0. vintage but make it iconic. πŸ’œ


πŸ’€ SEE ALSO πŸ’€

  • TTF_SetTextFont(3) β€” the setter, the other half of this duo, the enemies-to-lovers arc fr fr. πŸ”₯

slay, you now know how to peek at a text object's font. this page came to you from the SDL_ttf manual, version SDL_ttf 3.2.2 β€” mwah, go forth and get those fonts. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from