TTF_OpenFontWithProperties(3)

✨ TTF_OpenFontWithProperties ✨

okay bestie, welcome to the TTF_OpenFontWithProperties(3) page, part of the SDL_ttf3 functions lineup πŸ’–


🌸 NAME 🌸

TTF_OpenFontWithProperties β€” create a font with the specified properties. that's it, that's the whole vibe πŸ’…


πŸŽ€ HEADER FILE πŸŽ€

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


✨ SYNOPSIS ✨

#include "SDL3_ttf/SDL_ttf.h"

TTF_Font * TTF_OpenFontWithProperties(SDL_PropertiesID props);

#define TTF_PROP_FONT_CREATE_FILENAME_STRING            SDL_ttf.font.create.filename"
#define TTF_PROP_FONT_CREATE_IOSTREAM_POINTER           SDL_ttf.font.create.iostream"
#define TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER     SDL_ttf.font.create.iostream.offset"
#define TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN SDL_ttf.font.create.iostream.autoclose"
#define TTF_PROP_FONT_CREATE_SIZE_FLOAT                 SDL_ttf.font.create.size"
#define TTF_PROP_FONT_CREATE_FACE_NUMBER                SDL_ttf.font.create.face"
#define TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER      SDL_ttf.font.create.hdpi"
#define TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER        SDL_ttf.font.create.vdpi"
#define TTF_PROP_FONT_CREATE_EXISTING_FONT              SDL_ttf.font.create.existing_font"

(and yes, those quotes at the end are literally in there, we don't ask questions, we copy verbatim πŸ™ˆ)


πŸ’– DESCRIPTION πŸ’–

so basically these are the supported properties, and every single one is a little slay in its own right 🌈

  • TTF_PROP_FONT_CREATE_FILENAME_STRING β€” the font file to open, if an SDL_IOStream isn't being used. This is required if TTF_PROP_FONT_CREATE_IOSTREAM_POINTER and TTF_PROP_FONT_CREATE_EXISTING_FONT aren't set. so like, pick one bestie, you can't have nothing πŸ’€
  • TTF_PROP_FONT_CREATE_IOSTREAM_POINTER β€” an SDL_IOStream containing the font to be opened. This should not be closed until the font is closed 🫢. This is required if TTF_PROP_FONT_CREATE_FILENAME_STRING and TTF_PROP_FONT_CREATE_EXISTING_FONT aren't set.
  • TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER β€” the offset in the iostream for the beginning of the font, defaults to 0. zero, nada, the start, periodt ✨
  • TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN β€” true if closing the font should also close the associated SDL_IOStream. very "we go down together" energy ngl πŸ’…
  • TTF_PROP_FONT_CREATE_SIZE_FLOAT β€” the point size of the font. 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 πŸ‘‘
  • TTF_PROP_FONT_CREATE_FACE_NUMBER β€” the face index of the font, if the font contains multiple font faces. main character picks their own face fr fr πŸŽ€
  • TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER β€” the horizontal DPI to use for font rendering, defaults to TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER if set, or 72 otherwise.
  • TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER β€” the vertical DPI to use for font rendering, defaults to TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER if set, or 72 otherwise. they're literally matching each other's outfits, iconic 🌸
  • TTF_PROP_FONT_CREATE_EXISTING_FONT β€” an optional TTF_Font that, if set, will be used as the font data source and the initial size and style of the new font. it's giving hand-me-downs but make it fashion πŸ’œ

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • props β€” the properties to use.

⭐ RETURN VALUE ⭐

returns a valid TTF_Font *, or NULL on failure 😭 β€” and if it fails, call SDL_GetError() for more information, she'll tell you what went wrong.


πŸ”₯ THREAD SAFETY πŸ”₯

It is safe to call this function from any thread. go off, multithreaded queen πŸ‘‘


🌈 AVAILABILITY 🌈

This function is available since SDL_ttf 3.0.0.


πŸ’« SEE ALSO πŸ’«


k that's the whole page bestie, go open some fonts and slay πŸ’–βœ¨

mwah, this was SDL_ttf version 3.2.2, brought to you by the SDL_ttf crew 🫢 see you in the next manpage, ily, bye!! πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from