TTF_SetFontLanguage(3)

✨ TTF_SetFontLanguage ✨

okay bestie, welcome to the TTF_SetFontLanguage(3) page β€” it lives in the SDL_ttf3 FUNCTIONS family and it's literally the little switch that tells a font what language it should be text-shaping in 🌸


πŸŽ€ NAME πŸŽ€

TTF_SetFontLanguage β€” set the language that's gonna be used for text shaping by a font πŸ’…


πŸ“ HEADER FILE πŸ“

defined in SDL3_ttf/SDL_ttf.h β€” that's the one you're including, no cap 🫢


✨ SYNOPSIS ✨

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_SetFontLanguage(TTF_Font *font, const char *language_bcp47);

πŸ’– DESCRIPTION πŸ’–

so here's the tea πŸ“ β€” if SDL_ttf was not built with HarfBuzz support, this function just returns false. that's it, that's the whole vibe, no HarfBuzz no language shaping, sorry babe 😭

and also β€” this updates any TTF_Text objects that are using this font. so like, every text already chillin' with that font gets the memo too πŸ‘‘


🌸 FUNCTION PARAMETERS 🌸

  • font β€” the font you're specifying a language for. the main character here πŸ’…
  • language_bcp47 β€” a null-terminated string containing the desired language's BCP47 code ✨ or null to reset the value back to nothing 🧚

⭐ RETURN VALUE ⭐

returns true on success or false on failure πŸ’€ and if it fails, go call SDL_GetError() for more info, she'll tell you everything you need to know πŸ™ˆ


πŸ¦‹ THREAD SAFETY πŸ¦‹

this one has rules, bestie β€” call it on the thread that created the font. same thread, no exceptions, that's the vibe check πŸ‘‘


🌈 AVAILABILITY 🌈

this function is available since SDL-ttf 3.0.0 ⭐


and that's the whole page, you ate it fr fr πŸ’– this lil gem came to you from SDL_ttf 3.2.2 β€” go forth and shape some text, bestie πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from