5#include "SDL3pp_render.h"
6#include "SDL3pp_surface.h"
7#include "SDL3pp_version.h"
8#include "SDL3pp_video.h"
10#if !defined(SDL3PP_DISABLE_TTF) && !defined(SDL3PP_ENABLE_TTF) && \
11 __has_include(<SDL3_ttf/SDL_ttf.h>)
12#define SDL3PP_ENABLE_TTF
15#if defined(SDL3PP_ENABLE_TTF) || defined(SDL3PP_DOC)
17#include <SDL3_ttf/SDL_ttf.h>
59 constexpr explicit operator bool()
const {
return !!
value; }
92 constexpr explicit operator bool()
const {
return !!
value; }
128 constexpr explicit operator bool()
const {
return !!
value; }
164 constexpr explicit operator bool()
const {
return !!
value; }
183#define SDL_TTF_MAJOR_VERSION
185#define SDL_TTF_MINOR_VERSION
187#define SDL_TTF_MICRO_VERSION
194#define SDL_TTF_VERSION \
196 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
201#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
202 ((SDL_TTF_MAJOR_VERSION >= X) && \
203 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
204 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || \
205 SDL_TTF_MICRO_VERSION >= Z))
220inline int Version() {
return TTF_Version(); }
259inline void Quit() { TTF_Quit(); }
283inline int WasInit() {
return TTF_WasInit(); }
304 TTF_GetFreeTypeVersion(major, minor, patch);
322 TTF_GetHarfBuzzVersion(major, minor, patch);
349 TTF_STYLE_STRIKETHROUGH;
393 TTF_HORIZONTAL_ALIGN_INVALID;
396 TTF_HORIZONTAL_ALIGN_LEFT;
399 TTF_HORIZONTAL_ALIGN_CENTER;
402 TTF_HORIZONTAL_ALIGN_RIGHT;
458 constexpr Font(std::nullptr_t =
nullptr) noexcept
471 : m_resource(resource)
480 :
Font(other.release())
507 : m_resource(
CheckError(TTF_OpenFont(file, ptsize)))
535 : m_resource(
CheckError(TTF_OpenFontIO(src, closeio, ptsize)))
583 : m_resource(
CheckError(TTF_OpenFontWithProperties(props)))
588 ~Font() { TTF_CloseFont(m_resource); }
593 std::swap(m_resource, other.m_resource);
603 constexpr FontRaw get() const noexcept {
return m_resource; }
609 m_resource =
nullptr;
617 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
620 constexpr operator FontParam() const noexcept {
return {m_resource}; }
790 void SetSizeDPI(
float ptsize,
int hdpi,
int vdpi);
822 void GetDPI(
int* hdpi,
int* vdpi)
const;
985 void SetSDF(
bool enabled);
1000#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
1398 int* advance)
const;
1453 void GetStringSize(std::string_view text,
int* w,
int* h)
const;
1534 int* measured_width,
1535 size_t* measured_length)
const;
1604 int wrapLength)
const;
1705 int wrap_width)
const;
1803 int wrap_width)
const;
1903 int wrap_width)
const;
1949 :
Font(resource.value)
1997 return Font(std::move(file), ptsize);
2027 return Font(src, ptsize, closeio);
2077namespace prop::Font {
2079constexpr auto CREATE_FILENAME_STRING = TTF_PROP_FONT_CREATE_FILENAME_STRING;
2081constexpr auto CREATE_IOSTREAM_POINTER = TTF_PROP_FONT_CREATE_IOSTREAM_POINTER;
2083constexpr auto CREATE_IOSTREAM_OFFSET_NUMBER =
2084 TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER;
2086constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
2087 TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
2089constexpr auto CREATE_SIZE_FLOAT = TTF_PROP_FONT_CREATE_SIZE_FLOAT;
2091constexpr auto CREATE_FACE_NUMBER = TTF_PROP_FONT_CREATE_FACE_NUMBER;
2093constexpr auto CREATE_HORIZONTAL_DPI_NUMBER =
2094 TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER;
2096constexpr auto CREATE_VERTICAL_DPI_NUMBER =
2097 TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER;
2099#if SDL_TTF_VERSION_ATLEAST(3, 2, 3)
2101constexpr auto CREATE_EXISTING_FONT_POINTER =
2102 TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER;
2106constexpr auto OUTLINE_LINE_CAP_NUMBER = TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER;
2108constexpr auto OUTLINE_LINE_JOIN_NUMBER =
2109 TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER;
2111constexpr auto OUTLINE_MITER_LIMIT_NUMBER =
2112 TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER;
2164 return {
CheckError(TTF_GetFontProperties(font))};
2189 return TTF_GetFontGeneration(font);
2221 CheckError(TTF_AddFallbackFont(font, fallback));
2247 TTF_RemoveFallbackFont(font, fallback);
2323 CheckError(TTF_SetFontSizeDPI(font, ptsize, hdpi, vdpi));
2367 CheckError(TTF_GetFontDPI(font, hdpi, vdpi));
2401 TTF_SetFontStyle(font, style);
2431 return TTF_GetFontStyle(font);
2462 CheckError(TTF_SetFontOutline(font, outline));
2512 TTF_SetFontHinting(font, hinting);
2560 return TTF_GetFontHinting(font);
2614#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2632 TTF_FONT_WEIGHT_THIN;
2635 TTF_FONT_WEIGHT_EXTRA_LIGHT;
2638 TTF_FONT_WEIGHT_LIGHT;
2641 TTF_FONT_WEIGHT_NORMAL;
2644 TTF_FONT_WEIGHT_MEDIUM;
2647 TTF_FONT_WEIGHT_SEMI_BOLD;
2650 TTF_FONT_WEIGHT_BOLD;
2653 TTF_FONT_WEIGHT_EXTRA_BOLD;
2656 TTF_FONT_WEIGHT_BLACK;
2659 TTF_FONT_WEIGHT_EXTRA_BLACK;
2680 TTF_SetFontWrapAlignment(font, align);
2702 return TTF_GetFontWrapAlignment(font);
2775 TTF_SetFontLineSkip(font, lineskip);
2824 TTF_SetFontKerning(font, enabled);
2866 return TTF_FontIsFixedWidth(font);
2910 return TTF_GetFontFamilyName(font);
2936 return TTF_GetFontStyleName(font);
2963 CheckError(TTF_SetFontDirection(font, direction));
2986 return TTF_GetFontDirection(font);
3008 return TTF_StringToTag(
string);
3028 TTF_TagToString(tag,
string, size);
3122 CheckError(TTF_SetFontLanguage(font, language_bcp47));
3144 return TTF_FontHasGlyph(font, ch);
3169 return Surface{TTF_GetGlyphImage(font, ch, image_type)};
3199 return Surface(TTF_GetGlyphImageForIndex(font, glyph_index, image_type));
3244 CheckError(TTF_GetGlyphMetrics(font, ch, minx, maxx, miny, maxy, advance));
3273 if (
int r; TTF_GetGlyphKerning(font, previous_ch, ch, &r))
return r;
3301 CheckError(TTF_GetStringSize(font, text.data(), text.size(), w, h));
3333 std::string_view text,
3339 TTF_GetStringSizeWrapped(font, text.data(), text.size(), wrap_width, w, h));
3374 std::string_view text,
3376 int* measured_width,
3377 size_t* measured_length)
3389 int* measured_width,
3390 size_t* measured_length)
const
3393 m_resource, text, max_width, measured_width, measured_length);
3431 return Surface{TTF_RenderText_Solid(font, text.data(), text.size(), fg)};
3472 std::string_view text,
3476 return Surface(TTF_RenderText_Solid_Wrapped(
3477 font, text.data(), text.size(), fg, wrapLength));
3482 int wrapLength)
const
3516 return Surface(TTF_RenderGlyph_Solid(font, ch, fg));
3559 std::string_view text,
3563 return Surface(TTF_RenderText_Shaded(font, text.data(), text.size(), fg, bg));
3608 std::string_view text,
3613 return Surface(TTF_RenderText_Shaded_Wrapped(
3614 font, text.data(), text.size(), fg, bg, wrap_width));
3620 int wrap_width)
const
3659 return Surface(TTF_RenderGlyph_Shaded(font, ch, fg, bg));
3702 std::string_view text,
3705 return Surface(TTF_RenderText_Blended(font, text.data(), text.size(), fg));
3746 std::string_view text,
3750 return Surface(TTF_RenderText_Blended_Wrapped(
3751 font, text.data(), text.size(), fg, wrap_width));
3756 int wrap_width)
const
3790 return Surface(TTF_RenderGlyph_Blended(font, ch, fg));
3832 std::string_view text,
3836 return Surface(TTF_RenderText_LCD(font, text.data(), text.size(), fg, bg));
3880 std::string_view text,
3885 return Surface(TTF_RenderText_LCD_Wrapped(
3886 font, text.data(), text.size(), fg, bg, wrap_width));
3892 int wrap_width)
const
3931 return Surface(TTF_RenderGlyph_LCD(font, ch, fg, bg));
3949 TTF_SUBSTRING_DIRECTION_MASK;
3953 TTF_SUBSTRING_TEXT_START;
3963 TTF_SUBSTRING_TEXT_END;
3973 TTF_GPU_TEXTENGINE_WINDING_INVALID;
3976 TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE;
3979 TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE;
4018 : m_resource(resource)
4037 std::swap(m_resource, other.m_resource);
4052 auto r = m_resource;
4053 m_resource =
nullptr;
4061 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
4146 :
TextEngine(TTF_CreateRendererTextEngine(renderer))
4175 :
TextEngine(TTF_CreateRendererTextEngineWithProperties(props))
4217 :
TextEngine(TTF_CreateGPUTextEngine(device))
4246 :
TextEngine(TTF_CreateGPUTextEngineWithProperties(props))
4349 constexpr Text(std::nullptr_t =
nullptr) noexcept
4362 : m_resource(resource)
4371 :
Text(other.release())
4397 : m_resource(TTF_CreateText(engine, font, text.data(), text.size()))
4408 ~Text() { TTF_DestroyText(m_resource); }
4413 std::swap(m_resource, other.m_resource);
4428 auto r = m_resource;
4429 m_resource =
nullptr;
4437 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
4440 constexpr operator TextParam() const noexcept {
return {m_resource}; }
4494 void DrawRenderer(
FPoint p)
const;
4652 void SetScript(
Uint32 script);
4670 Uint32 GetScript()
const;
4688 void SetColor(
Color c);
4706 void SetColorFloat(
FColor c);
4768 void GetColorFloat(
float* r,
float* g,
float* b,
float* a)
const;
4784 FColor GetColorFloat()
const;
4804 void SetPosition(
Point p);
4822 void GetPosition(
int* x,
int* y)
const;
4839 Point GetPosition()
const;
4857 void SetWrapWidth(
int wrap_width);
4873 int GetWrapWidth()
const;
4896 void SetWrapWhitespaceVisible(
bool visible);
4911 bool IsWrapWhitespaceVisible()
const;
4930 void SetString(std::string_view
string);
4953 void InsertString(
int offset, std::string_view
string);
4972 void AppendString(std::string_view
string);
4996 void DeleteString(
int offset,
int length);
5015 void GetSize(
int* w,
int* h)
const;
5033 Point GetSize()
const;
5054 void GetSubString(
int offset,
SubString* substring)
const;
5101 void GetSubStringForLine(
int line,
SubString* substring)
const;
5116 return GetSubStringsForRange(0);
5188 void GetPreviousSubString(
const SubString& substring,
5228 const char*
GetText()
const {
return m_resource->text; }
5247 :
Text(resource.value)
5297 constexpr operator bool()
const {
return bool(m_text); }
5308 return m_subString.offset == other.m_subString.offset;
5384 CheckError(TTF_DrawSurfaceText(text, p.x, p.y, surface));
5410 TTF_DestroySurfaceTextEngine(engine);
5469namespace prop::RendererTextEngine {
5471#if SDL_TTF_VERSION_ATLEAST(3, 2, 3)
5473constexpr auto RENDERER_POINTER =
5474 TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER;
5476constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5477 TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER;
5505 CheckError(TTF_DrawRendererText(text, p.x, p.y));
5531 TTF_DestroyRendererTextEngine(engine);
5589namespace prop::GpuTextEngine {
5591#if SDL_TTF_VERSION_ATLEAST(3, 2, 3)
5593constexpr auto DEVICE_POINTER = TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER;
5595constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5596 TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER;
5630 return TTF_GetGPUTextDrawData(text);
5655 TTF_DestroyGPUTextEngine(engine);
5678 TTF_SetGPUTextEngineWinding(engine, winding);
5704 return TTF_GetGPUTextEngineWinding(engine);
5731 std::string_view text)
5733 return Text(engine, font, text);
5738 return Text(m_resource, font, text);
5755 return {
CheckError(TTF_GetTextProperties(text))};
5836 return TTF_SetTextFont(text, font);
5882 CheckError(TTF_SetTextDirection(text, direction));
5905 return TTF_GetTextDirection(text);
5959 return TTF_GetTextScript(text);
5983 CheckError(TTF_SetTextColor(text, c.r, c.g, c.b, c.a));
6007 CheckError(TTF_SetTextColorFloat(text, c.r, c.g, c.b, c.a));
6043 CheckError(TTF_GetTextColor(text, r, g, b, a));
6103 CheckError(TTF_GetTextColorFloat(text, r, g, b, a));
6159 CheckError(TTF_SetTextPosition(text, p.x, p.y));
6237 CheckError(TTF_SetTextWrapWidth(text, wrap_width));
6294 CheckError(TTF_SetTextWrapWhitespaceVisible(text, visible));
6317 return TTF_TextWrapWhitespaceVisible(text);
6345 CheckError(TTF_SetTextString(text,
string.data(),
string.size()));
6377 std::string_view
string)
6379 CheckError(TTF_InsertTextString(text, offset,
string.data(),
string.size()));
6407 CheckError(TTF_AppendTextString(text,
string.data(),
string.size()));
6440 CheckError(TTF_DeleteTextString(text, offset, length));
6523 CheckError(TTF_GetTextSubString(text, offset, substring));
6554 CheckError(TTF_GetTextSubStringForLine(text, line, substring));
6582 auto data = TTF_GetTextSubStringsForRange(text, offset, length, &count);
6613 CheckError(TTF_GetTextSubStringForPoint(text, p.x, p.y, substring));
6642 CheckError(TTF_GetPreviousTextSubString(text, &substring, previous));
6671 CheckError(TTF_GetNextTextSubString(text, &substring, next));
An exception that returns GetError()
Definition: SDL3pp_error.h:164
The internal structure containing font information.
Definition: SDL3pp_ttf.h:453
constexpr Font(Font &&other) noexcept
Move constructor.
Definition: SDL3pp_ttf.h:479
~Font()
Destructor.
Definition: SDL3pp_ttf.h:588
constexpr Font & operator=(const Font &other) noexcept=default
Assignment operator.
Font(IOStreamParam src, float ptsize, bool closeio=false)
Create a font from an IOStream, using a specified point size.
Definition: SDL3pp_ttf.h:534
Font(PropertiesParam props)
Create a font with the specified properties.
Definition: SDL3pp_ttf.h:582
Point GetStringSize(std::string_view text) const
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:1430
Font(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition: SDL3pp_ttf.h:506
constexpr Font(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_ttf.h:458
constexpr auto operator<=>(const Font &other) const noexcept=default
Comparison.
constexpr Font(const FontRaw resource) noexcept
Constructs from FontParam.
Definition: SDL3pp_ttf.h:470
constexpr FontRaw get() const noexcept
Retrieves underlying FontRaw.
Definition: SDL3pp_ttf.h:603
constexpr Font & operator=(Font &&other) noexcept
Assignment operator.
Definition: SDL3pp_ttf.h:591
constexpr Font(const Font &other)=delete
Copy constructor.
constexpr FontRaw release() noexcept
Retrieves underlying FontRaw and clear this.
Definition: SDL3pp_ttf.h:606
Point GetStringSizeWrapped(std::string_view text, int wrap_width) const
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:1476
Base class for SDL memory allocated array wrap.
Definition: SDL3pp_ownPtr.h:44
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
Iterator for substrings.
Definition: SDL3pp_ttf.h:5278
constexpr SubStringIterator()
Default constructor.
Definition: SDL3pp_ttf.h:5291
constexpr SubStringIterator & operator--()
Decrement operator.
Definition: SDL3pp_ttf.h:5327
constexpr const SubString & operator*() const
Retrieve SubString.
Definition: SDL3pp_ttf.h:5300
constexpr const SubString * operator->() const
Retrieve SubString.
Definition: SDL3pp_ttf.h:5303
constexpr bool operator==(const SubStringIterator &other) const
Comparison.
Definition: SDL3pp_ttf.h:5306
constexpr SubStringIterator operator--(int)
Decrement operator.
Definition: SDL3pp_ttf.h:5334
constexpr SubStringIterator operator++(int)
Increment operator.
Definition: SDL3pp_ttf.h:5319
constexpr SubStringIterator & operator++()
Increment operator.
Definition: SDL3pp_ttf.h:5312
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:201
A text engine used to create text objects.
Definition: SDL3pp_ttf.h:4000
constexpr TextEngineRaw release() noexcept
Retrieves underlying TextEngineRaw and clear this.
Definition: SDL3pp_ttf.h:4050
constexpr TextEngine(const TextEngine &other)=delete
Copy constructor.
virtual void Destroy()=0
frees up textEngine. Pure virtual
constexpr TextEngineRaw get() const noexcept
Retrieves underlying TextEngineRaw.
Definition: SDL3pp_ttf.h:4047
constexpr auto operator<=>(const TextEngine &other) const noexcept=default
Comparison.
constexpr TextEngine(const TextEngineRaw resource) noexcept
Constructs from TextEngineParam.
Definition: SDL3pp_ttf.h:4017
constexpr TextEngine & operator=(const TextEngine &other) noexcept=default
Assignment operator.
virtual ~TextEngine()=default
Destructor.
constexpr TextEngine & operator=(TextEngine &&other) noexcept
Assignment operator.
Definition: SDL3pp_ttf.h:4035
constexpr TextEngine(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_ttf.h:4005
constexpr TextEngine(TextEngine &&other) noexcept
Move constructor.
Definition: SDL3pp_ttf.h:4026
Text created with Text.Text()
Definition: SDL3pp_ttf.h:4344
const char * GetText() const
A copy of the UTF-8 string that this text object represents, useful for layout, debugging and retriev...
Definition: SDL3pp_ttf.h:5228
int GetNumLines() const
The number of lines in the text, 0 if it's empty.
Definition: SDL3pp_ttf.h:5231
SubStringIterator GetSubStringForPoint(Point p) const
Get the portion of a text string that is closest to a point.
constexpr TextRaw release() noexcept
Retrieves underlying TextRaw and clear this.
Definition: SDL3pp_ttf.h:4426
constexpr TextRaw get() const noexcept
Retrieves underlying TextRaw.
Definition: SDL3pp_ttf.h:4423
constexpr TextRaw operator->() noexcept
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:4405
SubStringIterator begin() const
Get iterator to first substring.
constexpr const TextRaw operator->() const noexcept
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:4402
constexpr auto operator<=>(const Text &other) const noexcept=default
Comparison.
SubStringIterator end() const
Get iterator to one past last substring.
~Text()
Destructor.
Definition: SDL3pp_ttf.h:4408
OwnArray< SubString * > GetSubStrings() const
Get all substrings of a text object.
Definition: SDL3pp_ttf.h:5114
Text(TextEngineParam engine, FontParam font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition: SDL3pp_ttf.h:4396
constexpr Text & operator=(Text &&other) noexcept
Assignment operator.
Definition: SDL3pp_ttf.h:4411
constexpr Text(const Text &other)=delete
Copy constructor.
SubStringIterator GetSubStringForLine(int line) const
Get iterator to substring of a text object that contains the given line.
constexpr Text(Text &&other) noexcept
Move constructor.
Definition: SDL3pp_ttf.h:4370
constexpr Text(const TextRaw resource) noexcept
Constructs from TextParam.
Definition: SDL3pp_ttf.h:4361
constexpr Text & operator=(const Text &other) noexcept=default
Assignment operator.
constexpr Text(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_ttf.h:4349
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
Color GetColor(Uint32 pixel, const PixelFormatDetails &format, PaletteConstParam palette={})
Get RGBA values from a pixel in the specified format.
Definition: SDL3pp_pixels.h:3055
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition: SDL3pp_pixels.h:83
Point GetPosition() const
Get the position of a text object.
Definition: SDL3pp_ttf.h:6213
FontRef GetFont() const
Get the font used by a text object.
Definition: SDL3pp_ttf.h:5863
void SetFontLanguage(FontParam font, StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3120
const char * GetFontFamilyName(FontParam font)
Query a font's family name.
Definition: SDL3pp_ttf.h:2908
constexpr FontStyleFlags STYLE_NORMAL
No special style.
Definition: SDL3pp_ttf.h:339
Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition: SDL3pp_ttf.h:3093
void SetFontLineSkip(FontParam font, int lineskip)
Set the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:2773
constexpr SubStringFlags SUBSTRING_LINE_END
This substring contains the end of line line_index
Definition: SDL3pp_ttf.h:3960
constexpr HintingFlags HINTING_LIGHT
Light hinting applies subtle adjustments to improve rendering.
Definition: SDL3pp_ttf.h:371
void DrawSurface(Point p, SurfaceParam surface) const
Draw text to an SDL surface.
Definition: SDL3pp_ttf.h:5387
constexpr HorizontalAlignment HORIZONTAL_ALIGN_CENTER
CENTER.
Definition: SDL3pp_ttf.h:398
PropertiesRef GetTextProperties(TextConstParam text)
Get the properties associated with a text object.
Definition: SDL3pp_ttf.h:5753
void GetTextSubString(TextConstParam text, int offset, SubString *substring)
Get the substring of a text object that surrounds a text offset.
Definition: SDL3pp_ttf.h:6519
void GetNextTextSubString(TextConstParam text, const SubString &substring, SubString *next)
Get the next substring in a text object.
Definition: SDL3pp_ttf.h:6667
void Destroy() final
Destroy a text engine created for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5413
void SetFontSDF(FontParam font, bool enabled)
Enable Signed Distance Field rendering for a font.
Definition: SDL3pp_ttf.h:2591
constexpr HorizontalAlignment HORIZONTAL_ALIGN_RIGHT
RIGHT.
Definition: SDL3pp_ttf.h:401
Surface RenderGlyph_Solid(FontParam font, Uint32 ch, ColorRaw fg)
Render a single 32-bit glyph at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3514
int GetFontHeight(FontParam font)
Query the total height of a font.
Definition: SDL3pp_ttf.h:2722
void Destroy() final
Destroy a text engine created for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5534
TTF_GPUAtlasDrawSequence GPUAtlasDrawSequence
Draw sequence returned by Text.GetGPUDrawData.
Definition: SDL3pp_ttf.h:4306
void GetPreviousSubString(const SubString &substring, SubString *previous) const
Get the previous substring in a text object.
Definition: SDL3pp_ttf.h:6645
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE
COUNTER_CLOCKWISE.
Definition: SDL3pp_ttf.h:3978
void MeasureString(FontParam font, std::string_view text, int max_width, int *measured_width, size_t *measured_length)
Calculate how much of a UTF-8 string will fit in a given width.
Definition: SDL3pp_ttf.h:3373
bool IsFixedWidth() const
Query whether a font is fixed-width.
Definition: SDL3pp_ttf.h:2869
TTF_Font * FontRaw
Alias to raw representation for Font.
Definition: SDL3pp_ttf.h:36
RendererTextEngine CreateRendererTextEngine(RendererParam renderer)
Create a text engine for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5434
constexpr SubStringFlags SUBSTRING_TEXT_START
This substring contains the beginning of the text.
Definition: SDL3pp_ttf.h:3952
const char * GetStyleName() const
Query a font's style name.
Definition: SDL3pp_ttf.h:2939
static Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition: SDL3pp_ttf.h:3098
Surface RenderText_Shaded(FontParam font, std::string_view text, Color fg, Color bg)
Render UTF-8 text at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3558
Surface RenderText_LCD(std::string_view text, Color fg, Color bg) const
Render UTF-8 text at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3839
HintingFlags GetFontHinting(FontParam font)
Query a font's current FreeType hinter setting.
Definition: SDL3pp_ttf.h:2558
void SetFontScript(FontParam font, Uint32 script)
Set the script to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3050
int GetFontWeight(FontParam font)
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition: SDL3pp_ttf.h:2627
void SetSizeDPI(float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2326
constexpr int FONT_WEIGHT_BLACK
Black (900) named font weight value.
Definition: SDL3pp_ttf.h:2655
void SetPosition(Point p)
Set the position of a text object.
Definition: SDL3pp_ttf.h:6162
void SetLanguage(StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3125
void RemoveFallback(FontParam fallback)
Remove a fallback font.
Definition: SDL3pp_ttf.h:2250
void SetTextScript(TextParam text, Uint32 script)
Set the script to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5930
void GetTextColorFloat(TextConstParam text, float *r, float *g, float *b, float *a)
Get the color of a text object.
Definition: SDL3pp_ttf.h:6097
int GetFontOutline(FontParam font)
Query a font's current outline.
Definition: SDL3pp_ttf.h:2482
void DestroyRendererTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5529
void DrawRenderer(FPoint p) const
Draw text to an SDL renderer.
Definition: SDL3pp_ttf.h:5508
constexpr SubStringFlags SUBSTRING_LINE_START
This substring contains the beginning of line line_index
Definition: SDL3pp_ttf.h:3957
void DestroyText(TextRaw text)
Destroy a text object created by a text engine.
Definition: SDL3pp_ttf.h:6711
void GetStringSize(FontParam font, std::string_view text, int *w, int *h)
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:3299
constexpr Direction DIRECTION_LTR
Left to Right.
Definition: SDL3pp_ttf.h:419
constexpr ImageType IMAGE_COLOR
The color channels have image data.
Definition: SDL3pp_ttf.h:439
bool SetFont(FontParam font)
Set the font used by a text object.
Definition: SDL3pp_ttf.h:5839
Direction GetFontDirection(FontParam font)
Get the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2984
Text CreateText(FontParam font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition: SDL3pp_ttf.h:5736
void DeleteTextString(TextParam text, int offset, int length)
Delete UTF-8 text from a text object.
Definition: SDL3pp_ttf.h:6438
OwnArray< SubString * > GetTextSubStringsForRange(TextConstParam text, int offset, int length)
Get the substrings of a text object that contain a range of text.
Definition: SDL3pp_ttf.h:6577
Uint32 StringToTag(StringParam string)
Convert from a 4 character string to a 32-bit tag.
Definition: SDL3pp_ttf.h:3006
HintingFlags GetHinting() const
Query a font's current FreeType hinter setting.
Definition: SDL3pp_ttf.h:2563
void GetTextSubStringForPoint(TextConstParam text, Point p, SubString *substring)
Get the portion of a text string that is closest to a point.
Definition: SDL3pp_ttf.h:6609
Surface GetGlyphImage(Uint32 ch, ImageType *image_type) const
Get the pixel image for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3172
void SetFontSizeDPI(FontParam font, float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2321
Uint32 SubStringFlags
Flags for SubString.
Definition: SDL3pp_ttf.h:3946
const char * GetFamilyName() const
Query a font's family name.
Definition: SDL3pp_ttf.h:2913
void ClearFallbacks()
Remove all fallback fonts.
Definition: SDL3pp_ttf.h:2272
void SetString(std::string_view string)
Set the UTF-8 text used by a text object.
Definition: SDL3pp_ttf.h:6348
Uint32 GetTextScript(TextConstParam text)
Get the script used for text shaping a text object.
Definition: SDL3pp_ttf.h:5957
Direction GetDirection() const
Get the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5908
TTF_HintingFlags HintingFlags
Hinting flags for TTF (TrueType Fonts)
Definition: SDL3pp_ttf.h:363
int GetWrapWidth() const
Get whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6267
Point GetSize() const
Get the size of a text object.
Definition: SDL3pp_ttf.h:6497
bool FontHasGlyph(FontParam font, Uint32 ch)
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3142
void SetStyle(FontStyleFlags style)
Set a font's current style.
Definition: SDL3pp_ttf.h:2404
RendererTextEngine CreateRendererTextEngineWithProperties(PropertiesParam props)
Create a text engine for drawing text on an SDL renderer, with the specified properties.
Definition: SDL3pp_ttf.h:5463
Surface GetGlyphImageForIndex(Uint32 glyph_index, ImageType *image_type) const
Get the pixel image for a character index.
Definition: SDL3pp_ttf.h:3202
void SetWrapWhitespaceVisible(bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition: SDL3pp_ttf.h:6297
void SetDirection(Direction direction)
Set the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5885
constexpr ImageType IMAGE_INVALID
INVALID.
Definition: SDL3pp_ttf.h:434
FontStyleFlags GetStyle() const
Query a font's current style.
Definition: SDL3pp_ttf.h:2434
Surface RenderText_Solid_Wrapped(std::string_view text, Color fg, int wrapLength) const
Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3480
void GetHarfBuzzVersion(int *major, int *minor, int *patch)
Query the version of the HarfBuzz library in use.
Definition: SDL3pp_ttf.h:320
void SetOutline(int outline)
Set a font's current outline.
Definition: SDL3pp_ttf.h:2465
Surface RenderText_Blended_Wrapped(std::string_view text, Color fg, int wrap_width) const
Render word-wrapped UTF-8 text at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3754
constexpr HintingFlags HINTING_INVALID
INVALID.
Definition: SDL3pp_ttf.h:365
int GetHeight() const
Query the total height of a font.
Definition: SDL3pp_ttf.h:2724
void GetTextPosition(TextConstParam text, int *x, int *y)
Get the position of a text object.
Definition: SDL3pp_ttf.h:6181
bool GetKerning() const
Query whether or not kerning is enabled for a font.
Definition: SDL3pp_ttf.h:2846
Surface RenderText_Solid(std::string_view text, Color fg) const
Render UTF-8 text at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3434
GPUTextEngine CreateGPUTextEngineWithProperties(PropertiesParam props)
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
Definition: SDL3pp_ttf.h:5584
void DestroySurfaceTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5408
int GetTextWrapWidth(TextConstParam text)
Get whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6260
int GetOutline() const
Query a font's current outline.
Definition: SDL3pp_ttf.h:2484
constexpr int FONT_WEIGHT_EXTRA_LIGHT
ExtraLight (200) named font weight value.
Definition: SDL3pp_ttf.h:2634
bool GetFontKerning(FontParam font)
Query whether or not kerning is enabled for a font.
Definition: SDL3pp_ttf.h:2844
void GetTextSubStringForLine(TextConstParam text, int line, SubString *substring)
Get the substring of a text object that contains the given line.
Definition: SDL3pp_ttf.h:6550
Uint32 FontStyleFlags
Font style flags for Font.
Definition: SDL3pp_ttf.h:337
void SetGPUWinding(GPUTextEngineWinding winding)
Sets the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engi...
Definition: SDL3pp_ttf.h:5681
void SetFontKerning(FontParam font, bool enabled)
Set if kerning is enabled for a font.
Definition: SDL3pp_ttf.h:2822
Font CopyFont(FontParam existing_font)
Create a copy of an existing font.
Definition: SDL3pp_ttf.h:2135
void GetGlyphMetrics(FontParam font, Uint32 ch, int *minx, int *maxx, int *miny, int *maxy, int *advance)
Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3236
void SetColor(Color c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5986
bool IsWrapWhitespaceVisible() const
Return whether whitespace is shown when wrapping a text object.
Definition: SDL3pp_ttf.h:6320
float GetSize() const
Get the size of a font.
Definition: SDL3pp_ttf.h:2348
int GetGlyphKerning(Uint32 previous_ch, Uint32 ch) const
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition: SDL3pp_ttf.h:3277
Surface RenderText_Blended(std::string_view text, Color fg) const
Render UTF-8 text at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3708
void InsertTextString(TextParam text, int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition: SDL3pp_ttf.h:6375
Surface RenderText_Solid(FontParam font, std::string_view text, Color fg)
Render UTF-8 text at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3429
bool TextWrapWhitespaceVisible(TextConstParam text)
Return whether whitespace is shown when wrapping a text object.
Definition: SDL3pp_ttf.h:6315
int GetFontLineSkip(FontParam font)
Query the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:2795
Surface RenderGlyph_Blended(Uint32 ch, ColorRaw fg) const
Render a single UNICODE codepoint at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3793
constexpr Direction DIRECTION_BTT
Bottom to Top.
Definition: SDL3pp_ttf.h:425
constexpr HintingFlags HINTING_MONO
Monochrome hinting adjusts the font for better rendering at lower resolutions.
Definition: SDL3pp_ttf.h:377
GPUTextEngine CreateGPUTextEngine(GPUDeviceParam device)
Create a text engine for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5555
void SetSDF(bool enabled)
Enable Signed Distance Field rendering for a font.
Definition: SDL3pp_ttf.h:2596
Font OpenFontWithProperties(PropertiesParam props)
Create a font with the specified properties.
Definition: SDL3pp_ttf.h:2072
constexpr int FONT_WEIGHT_EXTRA_BOLD
ExtraBold (800) named font weight value.
Definition: SDL3pp_ttf.h:2652
void GetFontDPI(FontParam font, int *hdpi, int *vdpi)
Get font target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2365
void SetScript(Uint32 script)
Set the script to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5935
void SetWrapWidth(int wrap_width)
Set whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6240
constexpr FontStyleFlags STYLE_ITALIC
Italic style.
Definition: SDL3pp_ttf.h:343
Uint32 GetFontGeneration(FontParam font)
Get the font generation.
Definition: SDL3pp_ttf.h:2187
void SetLineSkip(int lineskip)
Set the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:2778
void AppendTextString(TextParam text, std::string_view string)
Append UTF-8 text to a text object.
Definition: SDL3pp_ttf.h:6405
bool GetSDF() const
Query whether Signed Distance Field rendering is enabled for a font.
Definition: SDL3pp_ttf.h:2612
void SetKerning(bool enabled)
Set if kerning is enabled for a font.
Definition: SDL3pp_ttf.h:2827
float GetFontSize(FontParam font)
Get the size of a font.
Definition: SDL3pp_ttf.h:2346
bool IsScalable() const
Query whether a font is scalable or not.
Definition: SDL3pp_ttf.h:2890
void SetFontDirection(FontParam font, Direction direction)
Set the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2961
Uint32 GetFontScript(FontParam font)
Get the script used for text shaping a font.
Definition: SDL3pp_ttf.h:3075
Surface RenderText_LCD_Wrapped(std::string_view text, Color fg, Color bg, int wrap_width) const
Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3889
void GetFreeTypeVersion(int *major, int *minor, int *patch)
Query the version of the FreeType library in use.
Definition: SDL3pp_ttf.h:302
void TagToString(Uint32 tag, char *string, size_t size)
Convert from a 32-bit tag to a 4 character string.
Definition: SDL3pp_ttf.h:3026
TTF_GPUTextEngineWinding GPUTextEngineWinding
The winding order of the vertices returned by Text.GetGPUDrawData.
Definition: SDL3pp_ttf.h:3970
constexpr FontStyleFlags STYLE_BOLD
Bold style.
Definition: SDL3pp_ttf.h:341
constexpr FontStyleFlags STYLE_STRIKETHROUGH
Strikethrough text.
Definition: SDL3pp_ttf.h:348
constexpr int FONT_WEIGHT_THIN
Thin (100) named font weight value.
Definition: SDL3pp_ttf.h:2631
void GetNextSubString(const SubString &substring, SubString *next) const
Get the next substring in a text object.
Definition: SDL3pp_ttf.h:6674
bool FontIsScalable(FontParam font)
Query whether a font is scalable or not.
Definition: SDL3pp_ttf.h:2888
void SetColorFloat(FColor c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:6010
constexpr Direction DIRECTION_RTL
Right to Left.
Definition: SDL3pp_ttf.h:421
TTF_ImageType ImageType
The type of data in a glyph image.
Definition: SDL3pp_ttf.h:432
Direction GetDirection() const
Get the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2989
GPUTextEngineWinding GetGPUWinding() const
Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engin...
Definition: SDL3pp_ttf.h:5707
Uint32 GetGeneration() const
Get the font generation.
Definition: SDL3pp_ttf.h:2192
void SetFontSize(FontParam font, float ptsize)
Set a font's size dynamically.
Definition: SDL3pp_ttf.h:2291
int GetDescent() const
Query the offset from the baseline to the bottom of a font.
Definition: SDL3pp_ttf.h:2756
Surface RenderGlyph_Solid(Uint32 ch, ColorRaw fg) const
Render a single 32-bit glyph at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3519
TTF_TextEngine * TextEngineRaw
Alias to raw representation for TextEngine.
Definition: SDL3pp_ttf.h:72
int GetFontDescent(FontParam font)
Query the offset from the baseline to the bottom of a font.
Definition: SDL3pp_ttf.h:2754
void Update()
Update the layout of a text object.
Definition: SDL3pp_ttf.h:6697
void GetStringSizeWrapped(FontParam font, std::string_view text, int wrap_width, int *w, int *h)
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:3332
constexpr HintingFlags HINTING_NORMAL
Normal hinting applies standard grid-fitting.
Definition: SDL3pp_ttf.h:367
int GetGlyphKerning(FontParam font, Uint32 previous_ch, Uint32 ch)
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition: SDL3pp_ttf.h:3271
void MeasureString(std::string_view text, int max_width, int *measured_width, size_t *measured_length) const
Calculate how much of a UTF-8 string will fit in a given width.
Definition: SDL3pp_ttf.h:3387
constexpr HorizontalAlignment HORIZONTAL_ALIGN_INVALID
INVALID.
Definition: SDL3pp_ttf.h:392
TextEngineParam GetEngine() const
Get the text engine used by a text object.
Definition: SDL3pp_ttf.h:5808
void SetTextString(TextParam text, std::string_view string)
Set the UTF-8 text used by a text object.
Definition: SDL3pp_ttf.h:6343
void SetTextDirection(TextParam text, Direction direction)
Set the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5880
Surface RenderText_Shaded_Wrapped(FontParam font, std::string_view text, Color fg, Color bg, int wrap_width)
Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3607
void SetTextPosition(TextParam text, Point p)
Set the position of a text object.
Definition: SDL3pp_ttf.h:6157
bool HasGlyph(Uint32 ch) const
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3147
constexpr Direction DIRECTION_INVALID
INVALID.
Definition: SDL3pp_ttf.h:417
FontStyleFlags GetFontStyle(FontParam font)
Query a font's current style.
Definition: SDL3pp_ttf.h:2429
const char * GetFontStyleName(FontParam font)
Query a font's style name.
Definition: SDL3pp_ttf.h:2934
constexpr HintingFlags HINTING_NONE
No hinting, the font is rendered without any grid-fitting.
Definition: SDL3pp_ttf.h:380
TTF_SubString SubString
The representation of a substring within text.
Definition: SDL3pp_ttf.h:4320
constexpr int FONT_WEIGHT_BOLD
Bold (700) named font weight value.
Definition: SDL3pp_ttf.h:2649
Surface RenderGlyph_Shaded(Uint32 ch, ColorRaw fg, ColorRaw bg) const
Render a single UNICODE codepoint at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3662
constexpr ImageType IMAGE_ALPHA
The color channels are white.
Definition: SDL3pp_ttf.h:436
void SetWrapAlignment(HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:2683
void GetTextSize(TextConstParam text, int *w, int *h)
Get the size of a text object.
Definition: SDL3pp_ttf.h:6465
void SetTextWrapWhitespaceVisible(TextParam text, bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition: SDL3pp_ttf.h:6292
constexpr int FONT_WEIGHT_MEDIUM
Medium (500) named font weight value.
Definition: SDL3pp_ttf.h:2643
void ClearFallbackFonts(FontParam font)
Remove all fallback fonts.
Definition: SDL3pp_ttf.h:2270
void UpdateText(TextParam text)
Update the layout of a text object.
Definition: SDL3pp_ttf.h:6695
FontRef GetTextFont(TextConstParam text)
Get the font used by a text object.
Definition: SDL3pp_ttf.h:5858
Surface RenderText_Shaded_Wrapped(std::string_view text, Color fg, Color bg, int wrap_width) const
Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3617
void SetFontStyle(FontParam font, FontStyleFlags style)
Set a font's current style.
Definition: SDL3pp_ttf.h:2399
Surface RenderText_Blended_Wrapped(FontParam font, std::string_view text, Color fg, int wrap_width)
Render word-wrapped UTF-8 text at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3745
void SetGPUTextEngineWinding(TextEngineParam engine, GPUTextEngineWinding winding)
Sets the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engi...
Definition: SDL3pp_ttf.h:5675
HorizontalAlignment GetFontWrapAlignment(FontParam font)
Query a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:2700
int GetWeight() const
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition: SDL3pp_ttf.h:2629
Surface RenderText_Shaded(std::string_view text, Color fg, Color bg) const
Render UTF-8 text at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3566
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_INVALID
INVALID.
Definition: SDL3pp_ttf.h:3972
void SetDirection(Direction direction)
Set the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2966
void SetScript(Uint32 script)
Set the script to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3055
bool FontIsFixedWidth(FontParam font)
Query whether a font is fixed-width.
Definition: SDL3pp_ttf.h:2864
int GetLineSkip() const
Query the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:2797
void Close()
Dispose of a previously-created font.
Definition: SDL3pp_ttf.h:6739
bool GetFontSDF(FontParam font)
Query whether Signed Distance Field rendering is enabled for a font.
Definition: SDL3pp_ttf.h:2610
Surface RenderGlyph_LCD(Uint32 ch, ColorRaw fg, ColorRaw bg) const
Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3934
void InsertString(int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition: SDL3pp_ttf.h:6382
HorizontalAlignment GetWrapAlignment() const
Query a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:2705
void AddFallback(FontParam fallback)
Add a fallback font.
Definition: SDL3pp_ttf.h:2224
void DestroyGPUTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5653
Surface RenderText_Blended(FontParam font, std::string_view text, Color fg)
Render UTF-8 text at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3701
int GetFontAscent(FontParam font)
Query the offset from the baseline to the top of a font.
Definition: SDL3pp_ttf.h:2738
void DrawSurfaceText(TextConstParam text, Point p, SurfaceParam surface)
Draw text to an SDL surface.
Definition: SDL3pp_ttf.h:5382
GPUTextEngineWinding GetGPUTextEngineWinding(TextEngineParam engine)
Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engin...
Definition: SDL3pp_ttf.h:5702
TTF_TextData TextData
Internal data for Text.
Definition: SDL3pp_ttf.h:4330
void AddFallbackFont(FontParam font, FontParam fallback)
Add a fallback font.
Definition: SDL3pp_ttf.h:2219
OwnArray< SubString * > GetSubStringsForRange(int offset, int length=-1) const
Get the substrings of a text object that contain a range of text.
Definition: SDL3pp_ttf.h:6586
void GetSubString(int offset, SubString *substring) const
Get the substring of a text object that surrounds a text offset.
Definition: SDL3pp_ttf.h:6526
void SetTextWrapWidth(TextParam text, int wrap_width)
Set whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6235
constexpr FontStyleFlags STYLE_UNDERLINE
Underlined text.
Definition: SDL3pp_ttf.h:345
constexpr int FONT_WEIGHT_EXTRA_BLACK
ExtraBlack (950) named font weight value.
Definition: SDL3pp_ttf.h:2658
void AppendString(std::string_view string)
Append UTF-8 text to a text object.
Definition: SDL3pp_ttf.h:6410
Direction GetTextDirection(TextConstParam text)
Get the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5903
constexpr SubStringFlags SUBSTRING_TEXT_END
This substring contains the end of the text.
Definition: SDL3pp_ttf.h:3962
Font Copy() const
Create a copy of an existing font.
Definition: SDL3pp_ttf.h:2140
constexpr SubStringFlags SUBSTRING_DIRECTION_MASK
The mask for the flow direction for this substring.
Definition: SDL3pp_ttf.h:3948
Surface RenderText_Solid_Wrapped(FontParam font, std::string_view text, Color fg, int wrapLength)
Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3471
TTF_HorizontalAlignment HorizontalAlignment
The horizontal alignment used when rendering wrapped text.
Definition: SDL3pp_ttf.h:390
PropertiesRef GetProperties() const
Get the properties associated with a text object.
Definition: SDL3pp_ttf.h:5758
constexpr Direction DIRECTION_TTB
Top to Bottom.
Definition: SDL3pp_ttf.h:423
int GetNumFaces() const
Query the number of faces of a font.
Definition: SDL3pp_ttf.h:2532
void SetTextColor(TextParam text, Color c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5981
void RemoveFallbackFont(FontParam font, FontParam fallback)
Remove a fallback font.
Definition: SDL3pp_ttf.h:2245
void GetPreviousTextSubString(TextConstParam text, const SubString &substring, SubString *previous)
Get the previous substring in a text object.
Definition: SDL3pp_ttf.h:6638
Color GetColor() const
Get the color of a text object.
Definition: SDL3pp_ttf.h:6073
Surface RenderGlyph_LCD(FontParam font, Uint32 ch, ColorRaw fg, ColorRaw bg)
Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3926
void SetEngine(TextEngineParam engine)
Set the text engine used by a text object.
Definition: SDL3pp_ttf.h:5784
TextEngineParam GetTextEngine(TextConstParam text)
Get the text engine used by a text object.
Definition: SDL3pp_ttf.h:5803
void SetSize(float ptsize)
Set a font's size dynamically.
Definition: SDL3pp_ttf.h:2296
constexpr HintingFlags HINTING_LIGHT_SUBPIXEL
Light hinting with subpixel rendering for more precise font edges.
Definition: SDL3pp_ttf.h:383
void DeleteString(int offset, int length)
Delete UTF-8 text from a text object.
Definition: SDL3pp_ttf.h:6443
void SetFontOutline(FontParam font, int outline)
Set a font's current outline.
Definition: SDL3pp_ttf.h:2460
SurfaceTextEngine CreateSurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5357
void GetDPI(int *hdpi, int *vdpi) const
Get font target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2370
Font OpenFont(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition: SDL3pp_ttf.h:1995
void Destroy()
Destroy a text object created by a text engine.
Definition: SDL3pp_ttf.h:6713
PropertiesRef GetFontProperties(FontParam font)
Get the properties associated with a font.
Definition: SDL3pp_ttf.h:2162
Surface GetGlyphImageForIndex(FontParam font, Uint32 glyph_index, ImageType *image_type)
Get the pixel image for a character index.
Definition: SDL3pp_ttf.h:3195
Surface RenderText_LCD(FontParam font, std::string_view text, Color fg, Color bg)
Render UTF-8 text at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3831
void SetFontWrapAlignment(FontParam font, HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:2678
void SetHinting(HintingFlags hinting)
Set a font's current hinter setting.
Definition: SDL3pp_ttf.h:2515
GPUAtlasDrawSequence * GetGPUDrawData() const
Get the geometry data needed for drawing the text.
Definition: SDL3pp_ttf.h:5633
TTF_Text * TextRaw
Alias to raw representation for Text.
Definition: SDL3pp_ttf.h:105
void DrawRendererText(TextConstParam text, FPoint p)
Draw text to an SDL renderer.
Definition: SDL3pp_ttf.h:5503
FColor GetColorFloat() const
Get the color of a text object.
Definition: SDL3pp_ttf.h:6133
void GetGlyphMetrics(Uint32 ch, int *minx, int *maxx, int *miny, int *maxy, int *advance) const
Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3247
Uint32 GetScript() const
Get the script used for text shaping a font.
Definition: SDL3pp_ttf.h:3077
void GetTextColor(TextConstParam text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color of a text object.
Definition: SDL3pp_ttf.h:6037
constexpr HorizontalAlignment HORIZONTAL_ALIGN_LEFT
LEFT.
Definition: SDL3pp_ttf.h:395
void SetTextEngine(TextParam text, TextEngineParam engine)
Set the text engine used by a text object.
Definition: SDL3pp_ttf.h:5779
constexpr int FONT_WEIGHT_SEMI_BOLD
SemiBold (600) named font weight value.
Definition: SDL3pp_ttf.h:2646
void CloseFont(FontRaw font)
Dispose of a previously-created font.
Definition: SDL3pp_ttf.h:6737
int GetAscent() const
Query the offset from the baseline to the top of a font.
Definition: SDL3pp_ttf.h:2740
PropertiesRef GetProperties()
Get the properties associated with a font.
Definition: SDL3pp_ttf.h:2167
Uint32 GetScript() const
Get the script used for text shaping a text object.
Definition: SDL3pp_ttf.h:5962
bool SetTextFont(TextParam text, FontParam font)
Set the font used by a text object.
Definition: SDL3pp_ttf.h:5834
Surface RenderText_LCD_Wrapped(FontParam font, std::string_view text, Color fg, Color bg, int wrap_width)
Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3879
constexpr int FONT_WEIGHT_NORMAL
Normal (400) named font weight value.
Definition: SDL3pp_ttf.h:2640
int GetNumFontFaces(FontParam font)
Query the number of faces of a font.
Definition: SDL3pp_ttf.h:2530
Surface RenderGlyph_Shaded(FontParam font, Uint32 ch, ColorRaw fg, ColorRaw bg)
Render a single UNICODE codepoint at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3654
Surface GetGlyphImage(FontParam font, Uint32 ch, ImageType *image_type)
Get the pixel image for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3167
TTF_Direction Direction
Direction flags.
Definition: SDL3pp_ttf.h:415
Surface RenderGlyph_Blended(FontParam font, Uint32 ch, ColorRaw fg)
Render a single UNICODE codepoint at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:3788
constexpr ImageType IMAGE_SDF
The alpha channel has signed distance field information.
Definition: SDL3pp_ttf.h:443
constexpr int FONT_WEIGHT_LIGHT
Light (300) named font weight value.
Definition: SDL3pp_ttf.h:2637
void SetFontHinting(FontParam font, HintingFlags hinting)
Set a font's current hinter setting.
Definition: SDL3pp_ttf.h:2510
void Destroy() final
Destroy a text engine created for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5658
GPUAtlasDrawSequence * GetGPUTextDrawData(TextConstParam text)
Get the geometry data needed for drawing the text.
Definition: SDL3pp_ttf.h:5628
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_CLOCKWISE
CLOCKWISE.
Definition: SDL3pp_ttf.h:3975
void SetTextColorFloat(TextParam text, FColor c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:6005
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:289
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition: SDL3pp_pixels.h:2189
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2362
The structure that defines a point (using floating point values).
Definition: SDL3pp_rect.h:512
Safely wrap Font for non owning parameters.
Definition: SDL3pp_ttf.h:43
constexpr FontParam(FontRaw value)
Constructs from FontRaw.
Definition: SDL3pp_ttf.h:47
constexpr FontParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:53
FontRaw value
parameter's FontRaw
Definition: SDL3pp_ttf.h:44
constexpr auto operator<=>(const FontParam &other) const =default
Comparison.
Semi-safe reference for Font.
Definition: SDL3pp_ttf.h:1938
FontRef(const FontRef &other) noexcept
Copy constructor.
Definition: SDL3pp_ttf.h:1966
~FontRef()
Destructor.
Definition: SDL3pp_ttf.h:1972
FontRef(FontParam resource) noexcept
Constructs from FontParam.
Definition: SDL3pp_ttf.h:1948
FontRef(FontRaw resource) noexcept
Constructs from FontParam.
Definition: SDL3pp_ttf.h:1960
Safely wrap GPUDevice for non owning parameters.
Definition: SDL3pp_gpu.h:308
A GPU based text engine.
Definition: SDL3pp_ttf.h:4199
GPUTextEngine(PropertiesParam props)
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
Definition: SDL3pp_ttf.h:4245
GPUTextEngine(GPUDeviceParam device)
Create a text engine for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:4216
Safely wrap IOStream for non owning parameters.
Definition: SDL3pp_iostream.h:34
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:708
Safely wrap Renderer for non owning parameters.
Definition: SDL3pp_render.h:53
A renderer based text engine.
Definition: SDL3pp_ttf.h:4128
RendererTextEngine(PropertiesParam props)
Create a text engine for drawing text on an SDL renderer, with the specified properties.
Definition: SDL3pp_ttf.h:4174
RendererTextEngine(RendererParam renderer)
Create a text engine for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:4145
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:46
A surface based text engine.
Definition: SDL3pp_ttf.h:4089
SurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:4103
Safely wrap Text for non owning const parameters.
Definition: SDL3pp_ttf.h:142
constexpr auto operator<=>(const TextConstParam &other) const =default
Comparison.
const TextRaw value
parameter's const TextRaw
Definition: SDL3pp_ttf.h:143
constexpr TextConstParam(TextParam value)
Constructs from TextParam.
Definition: SDL3pp_ttf.h:152
constexpr TextConstParam(const TextRaw value)
Constructs from const TextRaw.
Definition: SDL3pp_ttf.h:146
constexpr TextConstParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:158
constexpr auto operator->()
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:173
Safely wrap TextEngine for non owning parameters.
Definition: SDL3pp_ttf.h:76
constexpr TextEngineParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:86
constexpr auto operator<=>(const TextEngineParam &other) const =default
Comparison.
constexpr TextEngineParam(TextEngineRaw value)
Constructs from TextEngineRaw.
Definition: SDL3pp_ttf.h:80
TextEngineRaw value
parameter's TextEngineRaw
Definition: SDL3pp_ttf.h:77
Safely wrap Text for non owning parameters.
Definition: SDL3pp_ttf.h:112
constexpr auto operator<=>(const TextParam &other) const =default
Comparison.
constexpr TextParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:122
constexpr TextParam(TextRaw value)
Constructs from TextRaw.
Definition: SDL3pp_ttf.h:116
TextRaw value
parameter's TextRaw
Definition: SDL3pp_ttf.h:113
constexpr auto operator->()
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:137
Semi-safe reference for Text.
Definition: SDL3pp_ttf.h:5236
TextRef(TextRaw resource) noexcept
Constructs from TextParam.
Definition: SDL3pp_ttf.h:5258
TextRef(const TextRef &other) noexcept
Copy constructor.
Definition: SDL3pp_ttf.h:5264
TextRef(TextParam resource=nullptr) noexcept
Constructs from TextParam.
Definition: SDL3pp_ttf.h:5246
~TextRef()
Destructor.
Definition: SDL3pp_ttf.h:5270