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 anSDL_IOStreamisn't being used. This is required ifTTF_PROP_FONT_CREATE_IOSTREAM_POINTERandTTF_PROP_FONT_CREATE_EXISTING_FONTaren't set. so like, pick one bestie, you can't have nothing πTTF_PROP_FONT_CREATE_IOSTREAM_POINTERβ anSDL_IOStreamcontaining the font to be opened. This should not be closed until the font is closed π«Ά. This is required ifTTF_PROP_FONT_CREATE_FILENAME_STRINGandTTF_PROP_FONT_CREATE_EXISTING_FONTaren't set.TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBERβ the offset in the iostream for the beginning of the font, defaults to0. zero, nada, the start, periodt β¨TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEANβtrueif closing the font should also close the associatedSDL_IOStream. very "we go down together" energy ngl πTTF_PROP_FONT_CREATE_SIZE_FLOATβ the point size of the font. Some.fonfonts 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 toTTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBERif set, or72otherwise.TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBERβ the vertical DPI to use for font rendering, defaults toTTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBERif set, or72otherwise. they're literally matching each other's outfits, iconic πΈTTF_PROP_FONT_CREATE_EXISTING_FONTβ an optionalTTF_Fontthat, 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 π«
(3)TTF_CloseFont(3)
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
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms