TTF_GetFontProperties(3)

πŸ’– TTF_GetFontProperties(3) πŸ’–

okay bestie, this one's from the SDL_ttf3 FUNCTIONS lineup, and it's lowkey the little key that unlocks a font's whole property bag. let's get into it 🫢


✨ NAME ✨

TTF_GetFontProperties β€” get the properties associated with a font. that's it, that's the whole job, and she does it flawlessly πŸ’…


🌸 HEADER FILE 🌸

she lives in SDL3_ttf/SDL_ttf.h, bestie. don't forget to include her or the compiler will be like "who??" 😭


πŸŽ€ SYNOPSIS πŸŽ€

#include "SDL3_ttf/SDL_ttf.h"

SDL_PropertiesID TTF_GetFontProperties(TTF_Font *font);

#define TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER           SDL_ttf.font.outline.line_cap"
#define TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER          SDL_ttf.font.outline.line_join"
#define TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER        SDL_ttf.font.outline.miter_limit"

look at those three #defines just sitting there, being all iconic πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

so SDL hands you the following read-write properties, and ngl they're all about outlines. here's the full lineup, no skips:

  • TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER : the FT_Stroker_LineCap value used when setting the font outline, and she defaults to FT_STROKER_LINECAP_ROUND.
  • TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER : the FT_Stroker_LineJoin value used when setting the font outline, defaults to FT_STROKER_LINEJOIN_ROUND.
  • TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER : the FT_Fixed miter limit used when setting the font outline, defaults to 0.

that's the whole vibe check. three properties, all read-write, all yours πŸ’–


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • font β€” the font to query. she's the main character here, obviously.

🌈 RETURN VALUE 🌈

returns a valid property ID on success, or 0 on failure. and if you get that 0, do not just sit there β€” call SDL_GetError() for more information, bestie, the error message is right there waiting for you πŸ™ˆ


⭐ THREAD SAFETY ⭐

it is safe to call this function from any thread. yes, ANY thread. she's that flexible, no cap 🧚


πŸ‘‘ AVAILABILITY πŸ‘‘

this function has been available since SDL_ttf 3.0.0. og status fr fr.


🌸 little reminder: those three properties are read-write, so you're not just peeking β€” you can set them too. handle with care, queen πŸ’…

and that's the page!! this gorgeous little writeup came to you courtesy of SDL_ttf 3.2.2 β€” mwah, drink water, and go query some fonts πŸ“πŸ’–βœ¨

πŸ“¦ where this page comes from