TTF_SetFontKerning(3)

πŸ’– TTF_SetFontKerning(3) πŸ’–

okay bestie, welcome to the SDL_ttf3 FUNCTIONS corner of the group chat ✨ this one lives in the SDL_ttf manual, and it's literally the switch that decides whether your font gets to do kerning or not. sit down, hydrate, let's go 🫢


✨ NAME ✨

TTF_SetFontKerning β€” set if kerning is enabled for a font. that's it, that's the whole vibe πŸ’…


🌸 HEADER FILE 🌸

it's defined in SDL3_ttf/SDL_ttf.h β€” yeah, you gotta include the header, no cap πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include "SDL3_ttf/SDL_ttf.h"

void TTF_SetFontKerning(TTF_Font *font, bool enabled);

look at her. two arguments. returns nothing. absolutely iconic ✨


πŸ’œ DESCRIPTION πŸ’œ

so here's the tea: newly-opened fonts default to allowing kerning. that's the out-of-the-box behaviour, no setup required, she comes ready πŸŽ€

and ngl, that default is generally a good policy β€” unless you have a strong reason to disable it, because kerning tends to produce better rendering. like, lowkey it just makes your text look right.

to prove the point: with kerning disabled, some fonts might render the word kerning as something that looks like keming. yeah. 😭 the letters just crash into each other. we do not want that.

also important bestie: this updates any TTF_Text objects using this font. so it's not just future text β€” existing text objects get the memo too πŸ”₯


🌈 FUNCTION PARAMETERS 🌈

  • font β€” the font to set kerning on. that's the one you're touching πŸ’–
  • enabled β€” true to enable kerning, false to disable. binary choice, main character energy πŸ‘‘

πŸ‘‘ THREAD SAFETY πŸ‘‘

this function should be called on the thread that created the font. that's the rule, bestie β€” don't be out here calling it from some random thread, iykyk πŸ™ˆ


⭐ AVAILABILITY ⭐

this function is available since SDL_ttf 3.0.0 ✨ so if you're on 3.0.0 or later, you're slaying. if you're not, you're not πŸ’€


πŸ’… SEE ALSO πŸ’…

like, obviously go read TTF_GetFontKerning(3) β€” that's the one that tells you what you set. and β€’(3), whatever she is, she's invited too πŸ¦‹


and that's the whole page, bestie!! no notes, she ate πŸ’– this was SDL_ttf version 3.2.2, brought to you by the SDL_ttf manual herself β€” now go kern some letters responsibly, mwah πŸŽ€βœ¨πŸ«Ά

πŸ“¦ where this page comes from