TTF_OpenFontIO(3)

πŸ“¦
version 3.2.2 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

okay so bestie, welcome to TTF_OpenFontIO(3) from the SDL_ttf3 FUNCTIONS manual πŸ’–βœ¨ this one is literally about opening a font from an SDL_IOStream with a point size, and it’s giving β€œtiny but important” main character energy πŸ’…

✨ NAME ✨

TTF_OpenFontIO β€” create a font from an SDL_IOStream, using a specified point size πŸŽ€

πŸŽ€ HEADER FILE πŸŽ€

Defined in SDL3_ttf/SDL_ttf.h πŸ¦‹

πŸ¦‹ SYNOPSIS πŸ¦‹

#include "SDL3_ttf/SDL_ttf.h"

TTF_Font * TTF_OpenFontIO(SDL_IOStream *src, bool closeio, float ptsize);

πŸ’œ DESCRIPTION πŸ’œ

okay so here’s the tea β˜• some .fon fonts will have several sizes embedded in the file, so the point size becomes the index of choosing which size. If the value is too high, the last indexed size will be the default πŸ‘€

If closeio is true, src will be automatically closed once the font is closed. Otherwise you should keep src open until the font is closed β€” no cap, that part matters 🫢

When done with the returned TTF_Font, use TTF_CloseFont () to dispose of it 🧚

🌸 FUNCTION PARAMETERS 🌸

  • src β€” an SDL_IOStream to provide a font file's data πŸ“
  • closeio β€” true to close src when the font is closed, false to leave it open πŸ”“
  • ptsize β€” point size to use for the newly-opened font πŸ”’

⭐ RETURN VALUE ⭐

The return type is ( TTF_Font *) β€” yes, literally that β€” and it returns a valid TTF_Font , or NULL on failure; call SDL_GetError() for more information 😭

πŸ”₯ THREAD SAFETY πŸ”₯

It is safe to call this function from any thread πŸ’€βœ¨ no stress, bestie.

🌈 AVAILABILITY 🌈

This function is available since SDL_ttf 3.0.0 πŸ—“οΈπŸ’–

πŸ‘‘ SEE ALSO πŸ‘‘

  • β€’(3) β€” yep, that’s literally what the page says, I’m just the messenger πŸ™ˆ
  • TTF_CloseFont(3) β€” the cleanup bestie πŸ§ΌπŸ’…

cute little sign-off: this page comes from source SDL_ttf, version SDL_ttf 3.2.2, and the footer doesn’t list a date β€” so that’s the whole footer tea, bestie πŸ“πŸ«Ά mwah πŸ’‹

πŸ“¦ where this page comes from