TTF_SetFontHinting(3)

✨ TTF_SetFontHinting ✨

okay bestie, gather round, because this one is a lil function in the SDL_ttf 3 crew and it's giving "make my font look crunchy or smooth, your call" πŸ’…


πŸŽ€ NAME πŸŽ€

TTF_SetFontHinting β€” set a font's current hinter setting. that's it, that's the whole job, and she does it flawlessly 🫢


πŸ“ HEADER FILE πŸ“

she lives in SDL3_ttf/SDL_ttf.h, no cap.


🌸 SYNOPSIS 🌸

#include "SDL3_ttf/SDL_ttf.h"

void TTF_SetFontHinting(TTF_Font *font, TTF_HintingFlags hinting);

like. look at her. so simple. so powerful. ⭐


πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie: this function switches up the hinter setting on a font, and the moment you do it, two things go down:

  • it updates any TTF_Text objects that are using this font πŸ‘€
  • and it clears already-generated glyphs, if there were any, straight out of the cache 🧹✨

the hinter setting is a single value, and you pick ONE of these icons:

  • TTF_HINTING_NORMAL
  • TTF_HINTING_LIGHT
  • TTF_HINTING_MONO
  • TTF_HINTING_NONE
  • TTF_HINTING_LIGHT_SUBPIXEL β€” this one's the new girl, available in SDL_ttf 3.0.0 and later πŸ‘‘

πŸ”§ FUNCTION PARAMETERS πŸ”§

  • font β€” the font you're setting a new hinter setting on. your main character. πŸ’œ
  • hinting β€” the new hinter setting. the glow-up itself. ✨

🧡 THREAD SAFETY 🧡

bestie, listen to me. call this on the thread that created the font. do NOT be out here calling it from some random thread, i am begging πŸ™ˆ

🌈 AVAILABILITY 🌈

this function has been around since SDL_ttf 3.0.0. she's not new, she's just iconic. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

  • β€’(3)
  • TTF_GetFontHinting(3) β€” the lil sister that reads the setting back, obsessed with her fr fr

that's the whole page, you ate it, go forth and hint responsibly πŸ¦‹πŸ’–

β€” with love from the SDL_ttf manual, version 3.2.2, mwah πŸ’…πŸŽ€

πŸ“¦ where this page comes from