Using multiple fonts with SDL_TTF

In particular, for effects like bold, italics, smallcaps, etc. If you wanted to emphasize/style one word or a short substring of a sentence, is your only option to render them separately?

Unfortunately yes. SDL_TTF, I believe, renders the font to a bitmap in memory using libfreetype, then blits that to a surface. As far as I know there’s nothing you can pass to affect things on a sub-string level

Ok, thanks. I don’t have a lot of ideas that sound like they’ll work well but I’ll play around and see what I can come up with.

Your best option is to create glyphs for each of the fonts you want to use.
Doing so will give you a lot of benefits. You can change stuff like you want and also
you can get faster performance when it comes to text.
This video will give you the basis of what I am talking about.

Hope it helps

1 Like