TTF_Quit(3)

✨ NAME ✨

TTF_Quit β€” deinitialize SDL_ttf πŸ’… like bestie it's time to say bye


πŸŽ€ HEADER FILE πŸŽ€

Defined in SDL3_ttf/SDL_ttf.h β€” that's where she lives, go say hi 🫢


🌸 SYNOPSIS 🌸

#include "SDL3_ttf/SDL_ttf.h"

void TTF_Quit(void);

πŸ’– DESCRIPTION πŸ’–

Okay so listen. You must call this when you're done with the library, because it's the thing that frees the internal resources. No TTF_Quit, no clean exit, and the library is just sitting there holding onto stuff like it's waiting for a text back 😭

But here's the cute part: it is safe to call this when the library isn't even initialized. It'll just return immediately. No drama, no crash, no nothing. She's unbothered fr fr ✨

And the way that this works is refcounted β€” once you have as many quit calls as you have had successful calls to TTF_Init, the library will actually deinitialize. So it's giving balance. It's giving equilibrium. It's giving "you called init three times, so call quit three times, periodt" πŸ‘‘

⚠️ Now the serious part, bestie, don't skip this one. This does not automatically close any fonts that are still open at the time of deinitialization. And it is possibly not safe to close them afterwards, because parts of the library will no longer be initialized to deal with it. So a well-written program should call TTF_CloseFont() on any open fonts before calling this function! Clean up your fonts first, then quit. That's the order. No cap 🚨

πŸ¦‹ THREAD SAFETY πŸ¦‹

It is safe to call this function from any thread. Multithreaded girlies, you are so valid πŸ§šπŸ’œ


🌈 AVAILABILITY 🌈

This function is available since SDL_ttf 3.0.0. Vintage but iconic ⭐


and that's the whole page, you ate that πŸ’– this little manual moment came to you from SDL_ttf 3.2.2 β€” mwah, take care of your fonts and go be the main character of your own cleanup routine πŸŽ€βœ¨

πŸ“¦ where this page comes from