TTF_SetFontStyle(3)
π TTF_SetFontStyle(3) β the SDL_ttf3 glow-up page π
okay so bestie, you found it: TTF_SetFontStyle, one of the SDL_ttf3 FUNCTIONS. It lives in SDL3_ttf/SDL_ttf.h and it's literally the "give my font a whole new personality" button. Let's get into it π¦
β¨ NAME β¨
TTF_SetFontStyle β set a font's current style. that's it, that's the whole vibe. π
π HEADER FILE π
Defined in SDL3_ttf/SDL_ttf.h β that's the file you gotta have, no cap.
πΈ SYNOPSIS πΈ
#include "SDL3_ttf/SDL_ttf.h"
void TTF_SetFontStyle(TTF_Font *font, TTF_FontStyleFlags style);
two params, one function, zero drama. slay. β¨
π DESCRIPTION π
So here's the tea: this updates any TTF_Text objects using this font, and it clears already-generated glyphs, if any, from the cache. meaning: your text gets a fresh new look, and the old cached glyphs get evicted like they overstayed their welcome. π
The font styles are a set of bit flags, OR'd together (so you stack them with |, like accessories β the more the better π
):
TTF_STYLE_NORMAL(is zero β yes, the "no style" option is literally zero, iconic)TTF_STYLE_BOLDTTF_STYLE_ITALICTTF_STYLE_UNDERLINETTF_STYLE_STRIKETHROUGH
π«Ά FUNCTION PARAMETERS π«Ά
fontβ the font to set a new style on. your main character. πstyleβ the new style values to set, OR'd together. mix and match, go feral.
π₯ THREAD SAFETY π₯
This function should be called on the thread that created the font. like, don't be calling it from some random other thread, that's not the move. keep it in the family. π
β AVAILABILITY β
This function is available since SDL_ttf 3.0.0. so it's been here for a minute, you're not early, you're right on time. π
π SEE ALSO π
β’(3), TTF_GetFontStyle(3)
go read TTF_GetFontStyle(3) if you wanna check what style a font is currently serving. iykyk. π¦
okay bestie that's the whole page, and it was all from SDL_ttf, version 3.2.2 β so if it's broken, blame the version, not me. mwah, go style something pretty πβ¨π
π¦ 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