TTF_GetFontStyle(3)

✨ TTF_GetFontStyle ✨

okay so bestie, welcome to TTF_GetFontStyle(3) πŸ’– this one lives in the SDL_ttf3 functions corner of the manual, and it's literally just "hey font, what style are you wearing rn?"


🌸 NAME 🌸

TTF_GetFontStyle β€” query a font's current style πŸŽ€


πŸ“ HEADER FILE πŸ“

Defined in SDL3_ttf/SDL_ttf.h β€” yeah, that's the one you gotta include, no cap 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#include "SDL3_ttf/SDL_ttf.h"

TTF_FontStyleFlags TTF_GetFontStyle(const TTF_Font *font);

πŸ’… DESCRIPTION πŸ’…

So the font styles? They're not one single vibe β€” they're a set of bit flags, all OR'd together ✨ like a little friend group of style options. Here's the whole squad:

  • TTF_STYLE_NORMAL (and lowkey important: it is zero β€” the "nothing extra going on" flag πŸ‘‘)
  • TTF_STYLE_BOLD
  • TTF_STYLE_ITALIC
  • TTF_STYLE_UNDERLINE
  • TTF_STYLE_STRIKETHROUGH

That's it, that's the list. The way that a font can be bold AND italic AND underlined at the same time? iconic. that's the OR'ing doing its thing πŸ’œ


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • font β€” the font we're querying, aka the main character we're asking about πŸ¦‹

⭐ RETURN VALUE ⭐

( TTF_FontStyleFlags ) β€” it hands you back the font's current style, as a set of bit flags ✨ so like, check the bits, queen πŸ‘‘


🧚 THREAD SAFETY 🧚

Good news bestie: it is safe to call this function from any thread. Go wild, no stress, fr fr 🫢


🌈 AVAILABILITY 🌈

This function has been around since SDL_ttf 3.0.0 πŸ’œ so unless you're time traveling, you're good.


πŸ‘‘ SEE ALSO πŸ‘‘

  • TTF_SetFontStyle(3) β€” the one that changes the style instead of just peeking at it 😌

not me writing a whole manpage for a getter πŸ’€ but honestly? knowing what style your font is currently serving is kind of essential. iykyk.

and that's a wrap, bestie πŸŽ€ this lil page came to you straight out of SDL_ttf 3.2.2, the SDL_ttf manual, for TTF_GetFontStyle(3). go forth and query your fonts, you absolute legend πŸ’…βœ¨

πŸ“¦ where this page comes from