Header file for SDL_ttf library.
More...
|
#define | SDL_TTF_VERSION |
| This is the version number macro for the current SDL_ttf version.
|
|
#define | SDL_TTF_VERSION_ATLEAST(X, Y, Z) |
| This macro will evaluate to true if compiled with SDL_ttf at least X.Y.Z.
|
|
#define | SDL_FONT_WEIGHT_THIN TTF_FONT_WEIGHT_THIN |
| Thin (100) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_EXTRA_LIGHT TTF_FONT_WEIGHT_EXTRA_LIGHT |
| ExtraLight (200) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_LIGHT TTF_FONT_WEIGHT_LIGHT |
| Light (300) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_NORMAL TTF_FONT_WEIGHT_NORMAL |
| Normal (400) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_MEDIUM TTF_FONT_WEIGHT_MEDIUM |
| Medium (500) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_SEMI_BOLD TTF_FONT_WEIGHT_SEMI_BOLD |
| SemiBold (600) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_BOLD TTF_FONT_WEIGHT_BOLD |
| Bold (700) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_EXTRA_BOLD TTF_FONT_WEIGHT_EXTRA_BOLD |
| ExtraBold (800) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_BLACK TTF_FONT_WEIGHT_BLACK |
| Black (900) named font weight value.
|
|
#define | SDL_FONT_WEIGHT_EXTRA_BLACK TTF_FONT_WEIGHT_EXTRA_BLACK |
| ExtraBlack (950) named font weight value.
|
|
|
using | SDL::HintingFlags = TTF_HintingFlags |
| Hinting flags for TTF (TrueType Fonts)
|
|
constexpr HintingFlags | SDL::HINTING_INVALID = TTF_HINTING_INVALID |
| INVALID.
|
|
constexpr HintingFlags | SDL::HINTING_NORMAL |
| Normal hinting applies standard grid-fitting.
|
|
constexpr HintingFlags | SDL::HINTING_LIGHT = TTF_HINTING_LIGHT |
| Light hinting applies subtle adjustments to improve rendering.
|
|
constexpr HintingFlags | SDL::HINTING_MONO = TTF_HINTING_MONO |
| Monochrome hinting adjusts the font for better rendering at lower resolutions.
|
|
constexpr HintingFlags | SDL::HINTING_NONE = TTF_HINTING_NONE |
| No hinting, the font is rendered without any grid-fitting.
|
|
constexpr HintingFlags | SDL::HINTING_LIGHT_SUBPIXEL = TTF_HINTING_LIGHT_SUBPIXEL |
| Light hinting with subpixel rendering for more precise font edges.
|
|
|
using | SDL::Direction = TTF_Direction |
| Direction flags.
|
|
constexpr Direction | SDL::DIRECTION_INVALID = TTF_DIRECTION_INVALID |
| INVALID.
|
|
constexpr Direction | SDL::DIRECTION_LTR = TTF_DIRECTION_LTR |
| Left to Right.
|
|
constexpr Direction | SDL::DIRECTION_RTL = TTF_DIRECTION_RTL |
| Right to Left.
|
|
constexpr Direction | SDL::DIRECTION_TTB = TTF_DIRECTION_TTB |
| Top to Bottom.
|
|
constexpr Direction | SDL::DIRECTION_BTT = TTF_DIRECTION_BTT |
| Bottom to Top.
|
|
This library is a wrapper around the excellent FreeType 2.0 library, available at: https://www.freetype.org/
◆ SDL_TTF_VERSION
Value:
SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
#define SDL_VERSIONNUM(major, minor, patch)
This macro turns the version numbers into a numeric value.
Definition SDL3pp_version.h:59
◆ SDL_TTF_VERSION_ATLEAST
#define SDL_TTF_VERSION_ATLEAST |
( |
|
X, |
|
|
|
Y, |
|
|
|
Z |
|
) |
| |
Value: ((SDL_TTF_MAJOR_VERSION >= X) && \
(SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
(SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || \
SDL_TTF_MICRO_VERSION >= Z))
◆ Direction
◆ FontStyleFlags
◆ GPUAtlasDrawSequence
◆ GPUTextEngineWinding
- Since
- This enum is available since SDL_ttf 3.0.0.
◆ HintingFlags
This enum specifies the level of hinting to be applied to the font rendering. The hinting level determines how much the font's outlines are adjusted for better alignment on the pixel grid.
- Since
- This enum is available since SDL_ttf 3.0.0.
- See also
- FontBase.SetHinting
-
FontBase.GetHinting
◆ HorizontalAlignment
- Since
- This enum is available since SDL_ttf 3.0.0.
◆ ImageType
- Since
- This enum is available since SDL_ttf 3.0.0.
◆ SubString
◆ SubStringFlags
- Since
- This datatype is available since SDL_ttf 3.0.0.
- See also
- SubString
◆ TextData
- Since
- This struct is available since SDL_ttf 3.0.0.
◆ Copy()
Font SDL::FontBase::Copy |
( |
| ) |
const |
|
inline |
The copy will be distinct from the original, but will share the font file and have the same size and style as the original.
- Returns
- a valid Font on success.
- Exceptions
-
- Thread safety:
- This function should be called on the thread that created the original font.
- Since
- This function is available since SDL_ttf 3.0.0.
◆ CreateGPUTextEngine()
TextEngine SDL::CreateGPUTextEngine |
( |
SDL_GPUDevice * |
device | ) |
|
|
inline |
◆ CreateGPUTextEngineWithProperties()
These are the supported properties:
prop::GpuTextEngine.DEVICE
: the SDL_GPUDevice to use for creating textures and drawing text.
prop::GpuTextEngine.ATLAS_TEXTURE_SIZE
: the size of the texture atlas
- Parameters
-
props | the properties to use. |
- Returns
- a TextEngineBase object or nullptr on failure; call GetError() for more information.
- Thread safety:
- This function should be called on the thread that created the device.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- CreateGPUTextEngine
-
Text
-
TextBase.GetGPUDrawData
◆ CreateRendererTextEngine()
◆ CreateRendererTextEngineWithProperties()
These are the supported properties:
prop::RendererTextEngine.RENDERER
: the renderer to use for creating textures and drawing text
prop::RendererTextEngine.ATLAS_TEXTURE_SIZE
: the size of the texture atlas
- Parameters
-
props | the properties to use. |
- Returns
- a TextEngineBase object or nullptr on failure; call GetError() for more information.
- Thread safety:
- This function should be called on the thread that created the renderer.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- CreateRendererTextEngine
-
Text
-
TextBase.DrawRenderer
◆ CreateSurfaceTextEngine()
- Returns
- a TextEngine object or nullptr on failure; call GetError() for more information.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- Text
-
TextBase.DrawSurface
◆ GetFreeTypeVersion()
void SDL::GetFreeTypeVersion |
( |
int * |
major, |
|
|
int * |
minor, |
|
|
int * |
patch |
|
) |
| |
|
inline |
Either Init() or InitSubSystem() should with with INIT_TTF be called before calling this function.
- Parameters
-
major | to be filled in with the major version number. Can be nullptr. |
minor | to be filled in with the minor version number. Can be nullptr. |
patch | to be filled in with the param version number. Can be nullptr. |
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- Init
-
InitSubSystem
◆ GetHarfBuzzVersion()
void SDL::GetHarfBuzzVersion |
( |
int * |
major, |
|
|
int * |
minor, |
|
|
int * |
patch |
|
) |
| |
|
inline |
If HarfBuzz is not available, the version reported is 0.0.0.
- Parameters
-
major | to be filled in with the major version number. Can be nullptr. |
minor | to be filled in with the minor version number. Can be nullptr. |
patch | to be filled in with the param version number. Can be nullptr. |
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
◆ InitSubSystem()
You must successfully call this function before it is safe to call any other function in this library.
It is safe to call this more than once, and each successful InitSubSystem() call should be paired with a matching QuitSubSystem(TtfInitFlag) call.
- Parameters
-
- Exceptions
-
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- QuitSubSystem(TtfInitFlag)
◆ QuitSubSystem()
You must call this when done with the library, to free internal resources. It is safe to call this when the library isn't initialized, as it will just return immediately.
Once you have as many quit calls as you have had successful calls to InitSubSystem(TtfInitFlag), the library will actually deinitialize.
Please note that this does not automatically close any fonts that are still open at the time of deinitialization, and it is possibly not safe to close them afterwards, as parts of the library will no longer be initialized to deal with it.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
◆ StringToTag()
- Parameters
-
string | the 4 character string to convert. |
- Returns
- the 32-bit representation of the string.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- TagToString
◆ TagToString()
void SDL::TagToString |
( |
Uint32 |
tag, |
|
|
char * |
string, |
|
|
size_t |
size |
|
) |
| |
|
inline |
- Parameters
-
tag | the 32-bit tag to convert. |
string | a pointer filled in with the 4 character representation of the tag. |
size | the size of the buffer pointed at by string, should be at least 4. |
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- TagToString
◆ TTF_Version()
- Returns
- SDL_ttf version.
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
◆ WasInit()
This reports the number of times the library has been initialized by a call to InitSubSystem(TtfInitFlag), without a paired deinitialization request from QuitSubSystem(TtfInitFlag).
In short: if it's greater than zero, the library is currently initialized and ready to work. If zero, it is not initialized.
Despite the return value being a signed integer, this function should not return a negative number.
- Returns
- the current number of initialization calls, that need to eventually be paired with this many calls to QuitSubSystem(TtfInitFlag).
- Thread safety:
- It is safe to call this function from any thread.
- Since
- This function is available since SDL_ttf 3.0.0.
- See also
- InitSubSystem(TtfInitFlag)
-
QuitSubSystem(TtfInitFlag)
◆ GPU_TEXTENGINE_WINDING_CLOCKWISE
Initial value:=
TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE
◆ GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE
Initial value:=
TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE
◆ GPU_TEXTENGINE_WINDING_INVALID
Initial value:=
TTF_GPU_TEXTENGINE_WINDING_INVALID
◆ HINTING_NORMAL
◆ HORIZONTAL_ALIGN_CENTER
Initial value:=
TTF_HORIZONTAL_ALIGN_CENTER
◆ HORIZONTAL_ALIGN_INVALID
Initial value:=
TTF_HORIZONTAL_ALIGN_INVALID
◆ HORIZONTAL_ALIGN_LEFT
Initial value:=
TTF_HORIZONTAL_ALIGN_LEFT
◆ HORIZONTAL_ALIGN_RIGHT
Initial value:=
TTF_HORIZONTAL_ALIGN_RIGHT
◆ IMAGE_ALPHA
◆ IMAGE_COLOR
◆ STYLE_STRIKETHROUGH
Initial value:=
TTF_STYLE_STRIKETHROUGH
◆ STYLE_UNDERLINE
◆ SUBSTRING_DIRECTION_MASK
Initial value:=
TTF_SUBSTRING_DIRECTION_MASK
◆ SUBSTRING_TEXT_END
◆ SUBSTRING_TEXT_START
Initial value:=
TTF_SUBSTRING_TEXT_START