TTF_GetFontFamilyName(3)
π TTF_GetFontFamilyName π
okay bestie, welcome to the SDL_ttf3 FUNCTIONS section of the manual, we're talking about TTF_GetFontFamilyName(3) today and honestly? it's a lil guy with main character energy π
β¨ NAME β¨
TTF_GetFontFamilyName β asking a font what its family name is, like a vibe check but for typography πΈ
π HEADER FILE π
it lives in SDL3_ttf/SDL_ttf.h, no cap. that's the whole address, she doesn't have a secret second home π
π¦ SYNOPSIS π¦
#include "SDL3_ttf/SDL_ttf.h"
const char * TTF_GetFontFamilyName(const TTF_Font *font);
like. that's it. one line. one function. one dream β¨
π DESCRIPTION π
so here's the tea: the string you get back is dictated by the contents of the font file. like, the font file itself decided what it's called, and this function is just the messenger π«Ά
β οΈ okay this part MATTERS, listen up: the returned string points to internal storage. do NOT modify it, do NOT free it. it is not yours, it is the font's, and you will simply have to respect that boundary π
and it gets even more real β that string becomes invalid, along with the rest of the font, the moment font gets handed over to TTF_CloseFont(). so if you were planning to hold onto it after closing the fontβ¦ babe. no. that's a use-after-free and it's giving undefined behavior π grab what you need before you close her.
π FUNCTION PARAMETERS π
fontβ the font you're querying. the one you're asking about. the subject of the interrogation, if you will π
β RETURN VALUE β
it returns the font's family name. that's the whole thing. the family name. iconic behavior honestly π
π§΅ THREAD SAFETY π§΅
it is safe to call this function from any thread. go wild. thread it from wherever. she's chill like that π
ποΈ AVAILABILITY ποΈ
this function has been available since SDL_ttf 3.0.0, so if you're on anything older, bestie, you're on your own π
and that's the whole page!! no SEE ALSO, no warnings beyond the ones we already screamed about, just a cute lil getter doing cute lil getter things π
this was TTF_GetFontFamilyName(3) from the SDL_ttf manual, SDL_ttf 3.2.2 era β mwah, take care of your strings, don't free what isn't yours, and I'll see you in the next manpage πβ¨π
π¦ 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