5#include "SDL3pp_render.h"
6#include "SDL3pp_surface.h"
7#include "SDL3pp_version.h"
8#include "SDL3pp_video.h"
10#if defined(SDL3PP_ENABLE_TTF) || defined(SDL3PP_DOC)
12#include <SDL3_ttf/SDL_ttf.h>
54 constexpr explicit operator bool()
const {
return !!
value; }
87 constexpr explicit operator bool()
const {
return !!
value; }
123 constexpr explicit operator bool()
const {
return !!
value; }
159 constexpr explicit operator bool()
const {
return !!
value; }
178#define SDL_TTF_MAJOR_VERSION
180#define SDL_TTF_MINOR_VERSION
182#define SDL_TTF_MICRO_VERSION
189#define SDL_TTF_VERSION \
191 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
196#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
197 ((SDL_TTF_MAJOR_VERSION >= X) && \
198 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
199 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || \
200 SDL_TTF_MICRO_VERSION >= Z))
215inline int Version() {
return TTF_Version(); }
254inline void Quit() { TTF_Quit(); }
278inline int WasInit() {
return TTF_WasInit(); }
299 TTF_GetFreeTypeVersion(major, minor, patch);
317 TTF_GetHarfBuzzVersion(major, minor, patch);
344 TTF_STYLE_STRIKETHROUGH;
360#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
392 TTF_HORIZONTAL_ALIGN_INVALID;
395 TTF_HORIZONTAL_ALIGN_LEFT;
398 TTF_HORIZONTAL_ALIGN_CENTER;
401 TTF_HORIZONTAL_ALIGN_RIGHT;
457 constexpr Font(std::nullptr_t =
nullptr) noexcept
470 : m_resource(resource)
476 constexpr Font(
const Font& other)
noexcept =
default;
481 :
Font(other.release())
508 : m_resource(
CheckError(TTF_OpenFont(file, ptsize)))
536 : m_resource(
CheckError(TTF_OpenFontIO(src, closeio, ptsize)))
584 : m_resource(
CheckError(TTF_OpenFontWithProperties(props)))
589 ~Font() { TTF_CloseFont(m_resource); }
594 std::swap(m_resource, other.m_resource);
604 constexpr FontRaw get() const noexcept {
return m_resource; }
610 m_resource =
nullptr;
618 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
621 constexpr operator FontParam() const noexcept {
return {m_resource}; }
791 void SetSizeDPI(
float ptsize,
int hdpi,
int vdpi);
823 void GetDPI(
int* hdpi,
int* vdpi)
const;
986 void SetSDF(
bool enabled);
1001#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
1399 int* advance)
const;
1454 void GetStringSize(std::string_view text,
int* w,
int* h)
const;
1535 int* measured_width,
1536 size_t* measured_length)
const;
1605 int wrapLength)
const;
1706 int wrap_width)
const;
1804 int wrap_width)
const;
1904 int wrap_width)
const;
1950 :
Font(resource.value)
1995 return Font(std::move(file), ptsize);
2025 return Font(src, ptsize, closeio);
2075namespace prop::Font {
2077constexpr auto CREATE_FILENAME_STRING = TTF_PROP_FONT_CREATE_FILENAME_STRING;
2079constexpr auto CREATE_IOSTREAM_POINTER = TTF_PROP_FONT_CREATE_IOSTREAM_POINTER;
2081constexpr auto CREATE_IOSTREAM_OFFSET_NUMBER =
2082 TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER;
2084constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
2085 TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
2087constexpr auto CREATE_SIZE_FLOAT = TTF_PROP_FONT_CREATE_SIZE_FLOAT;
2089constexpr auto CREATE_FACE_NUMBER = TTF_PROP_FONT_CREATE_FACE_NUMBER;
2091constexpr auto CREATE_HORIZONTAL_DPI_NUMBER =
2092 TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER;
2094constexpr auto CREATE_VERTICAL_DPI_NUMBER =
2095 TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER;
2097#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2099constexpr auto CREATE_EXISTING_FONT_POINTER =
2100 TTF_PROP_FONT_CREATE_EXISTING_FONT;
2104constexpr auto OUTLINE_LINE_CAP_NUMBER = TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER;
2106constexpr auto OUTLINE_LINE_JOIN_NUMBER =
2107 TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER;
2109constexpr auto OUTLINE_MITER_LIMIT_NUMBER =
2110 TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER;
2162 return {
CheckError(TTF_GetFontProperties(font))};
2187 return TTF_GetFontGeneration(font);
2219 CheckError(TTF_AddFallbackFont(font, fallback));
2245 TTF_RemoveFallbackFont(font, fallback);
2321 CheckError(TTF_SetFontSizeDPI(font, ptsize, hdpi, vdpi));
2365 CheckError(TTF_GetFontDPI(font, hdpi, vdpi));
2399 TTF_SetFontStyle(font, style);
2429 return TTF_GetFontStyle(font);
2460 CheckError(TTF_SetFontOutline(font, outline));
2510 TTF_SetFontHinting(font, hinting);
2558 return TTF_GetFontHinting(font);
2612#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2630 TTF_FONT_WEIGHT_THIN;
2633 TTF_FONT_WEIGHT_EXTRA_LIGHT;
2636 TTF_FONT_WEIGHT_LIGHT;
2639 TTF_FONT_WEIGHT_NORMAL;
2642 TTF_FONT_WEIGHT_MEDIUM;
2645 TTF_FONT_WEIGHT_SEMI_BOLD;
2648 TTF_FONT_WEIGHT_BOLD;
2651 TTF_FONT_WEIGHT_EXTRA_BOLD;
2654 TTF_FONT_WEIGHT_BLACK;
2657 TTF_FONT_WEIGHT_EXTRA_BLACK;
2678 TTF_SetFontWrapAlignment(font, align);
2700 return TTF_GetFontWrapAlignment(font);
2773 TTF_SetFontLineSkip(font, lineskip);
2822 TTF_SetFontKerning(font, enabled);
2864 return TTF_FontIsFixedWidth(font);
2908 return TTF_GetFontFamilyName(font);
2934 return TTF_GetFontStyleName(font);
2961 CheckError(TTF_SetFontDirection(font, direction));
2984 return TTF_GetFontDirection(font);
3006 return TTF_StringToTag(
string);
3026 TTF_TagToString(tag,
string, size);
3120 CheckError(TTF_SetFontLanguage(font, language_bcp47));
3142 return TTF_FontHasGlyph(font, ch);
3167 return Surface{TTF_GetGlyphImage(font, ch, image_type)};
3197 return Surface(TTF_GetGlyphImageForIndex(font, glyph_index, image_type));
3242 CheckError(TTF_GetGlyphMetrics(font, ch, minx, maxx, miny, maxy, advance));
3271 if (
int r; TTF_GetGlyphKerning(font, previous_ch, ch, &r))
return r;
3299 CheckError(TTF_GetStringSize(font, text.data(), text.size(), w, h));
3331 std::string_view text,
3337 TTF_GetStringSizeWrapped(font, text.data(), text.size(), wrap_width, w, h));
3372 std::string_view text,
3374 int* measured_width,
3375 size_t* measured_length)
3387 int* measured_width,
3388 size_t* measured_length)
const
3391 m_resource, text, max_width, measured_width, measured_length);
3429 return Surface{TTF_RenderText_Solid(font, text.data(), text.size(), fg)};
3470 std::string_view text,
3474 return Surface(TTF_RenderText_Solid_Wrapped(
3475 font, text.data(), text.size(), fg, wrapLength));
3480 int wrapLength)
const
3514 return Surface(TTF_RenderGlyph_Solid(font, ch, fg));
3557 std::string_view text,
3561 return Surface(TTF_RenderText_Shaded(font, text.data(), text.size(), fg, bg));
3606 std::string_view text,
3611 return Surface(TTF_RenderText_Shaded_Wrapped(
3612 font, text.data(), text.size(), fg, bg, wrap_width));
3618 int wrap_width)
const
3657 return Surface(TTF_RenderGlyph_Shaded(font, ch, fg, bg));
3700 std::string_view text,
3703 return Surface(TTF_RenderText_Blended(font, text.data(), text.size(), fg));
3744 std::string_view text,
3748 return Surface(TTF_RenderText_Blended_Wrapped(
3749 font, text.data(), text.size(), fg, wrap_width));
3754 int wrap_width)
const
3788 return Surface(TTF_RenderGlyph_Blended(font, ch, fg));
3830 std::string_view text,
3834 return Surface(TTF_RenderText_LCD(font, text.data(), text.size(), fg, bg));
3878 std::string_view text,
3883 return Surface(TTF_RenderText_LCD_Wrapped(
3884 font, text.data(), text.size(), fg, bg, wrap_width));
3890 int wrap_width)
const
3929 return Surface(TTF_RenderGlyph_LCD(font, ch, fg, bg));
3947 TTF_SUBSTRING_DIRECTION_MASK;
3951 TTF_SUBSTRING_TEXT_START;
3961 TTF_SUBSTRING_TEXT_END;
3971 TTF_GPU_TEXTENGINE_WINDING_INVALID;
3974 TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE;
3977 TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE;
4016 : 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)
4373 :
Text(other.release())
4399 : m_resource(TTF_CreateText(engine, font, text.data(), text.size()))
4410 ~Text() { TTF_DestroyText(m_resource); }
4415 std::swap(m_resource, other.m_resource);
4430 auto r = m_resource;
4431 m_resource =
nullptr;
4439 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
4442 constexpr operator TextParam() const noexcept {
return {m_resource}; }
4496 void DrawRenderer(
FPoint p)
const;
4654 void SetScript(
Uint32 script);
4672 Uint32 GetScript()
const;
4690 void SetColor(
Color c);
4708 void SetColorFloat(
FColor c);
4770 void GetColorFloat(
float* r,
float* g,
float* b,
float* a)
const;
4786 FColor GetColorFloat()
const;
4806 void SetPosition(
const PointRaw& p);
4824 void GetPosition(
int* x,
int* y)
const;
4840 Point GetPosition()
const;
4858 void SetWrapWidth(
int wrap_width);
4874 int GetWrapWidth()
const;
4897 void SetWrapWhitespaceVisible(
bool visible);
4912 bool IsWrapWhitespaceVisible()
const;
4931 void SetString(std::string_view
string);
4954 void InsertString(
int offset, std::string_view
string);
4973 void AppendString(std::string_view
string);
4997 void DeleteString(
int offset,
int length);
5016 void GetSize(
int* w,
int* h)
const;
5034 Point GetSize()
const;
5055 void GetSubString(
int offset,
SubString* substring)
const;
5102 void GetSubStringForLine(
int line,
SubString* substring)
const;
5117 return GetSubStringsForRange(0);
5189 void GetPreviousSubString(
const SubString& substring,
5229 const char*
GetText()
const {
return m_resource->text; }
5248 :
Text(resource.value)
5295 constexpr operator bool()
const {
return bool(m_text); }
5306 return m_subString.offset == other.m_subString.offset;
5382 CheckError(TTF_DrawSurfaceText(text, p.x, p.y, surface));
5408 TTF_DestroySurfaceTextEngine(engine);
5467namespace prop::RendererTextEngine {
5469#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
5471constexpr auto RENDERER_POINTER = TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER;
5473constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5474 TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE;
5502 CheckError(TTF_DrawRendererText(text, p.x, p.y));
5528 TTF_DestroyRendererTextEngine(engine);
5586namespace prop::GpuTextEngine {
5588#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
5590constexpr auto DEVICE_POINTER = TTF_PROP_GPU_TEXT_ENGINE_DEVICE;
5592constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5593 TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE;
5627 return TTF_GetGPUTextDrawData(text);
5652 TTF_DestroyGPUTextEngine(engine);
5675 TTF_SetGPUTextEngineWinding(engine, winding);
5701 return TTF_GetGPUTextEngineWinding(engine);
5728 std::string_view text)
5730 return Text(engine, font, text);
5735 return Text(m_resource, font, text);
5752 return {
CheckError(TTF_GetTextProperties(text))};
5833 return TTF_SetTextFont(text, font);
5879 CheckError(TTF_SetTextDirection(text, direction));
5902 return TTF_GetTextDirection(text);
5956 return TTF_GetTextScript(text);
5980 CheckError(TTF_SetTextColor(text, c.r, c.g, c.b, c.a));
6004 CheckError(TTF_SetTextColorFloat(text, c.r, c.g, c.b, c.a));
6040 CheckError(TTF_GetTextColor(text, r, g, b, a));
6100 CheckError(TTF_GetTextColorFloat(text, r, g, b, a));
6156 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:452
constexpr Font(Font &&other) noexcept
Move constructor.
Definition: SDL3pp_ttf.h:480
~Font()
Destructor.
Definition: SDL3pp_ttf.h:589
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:535
Font(PropertiesParam props)
Create a font with the specified properties.
Definition: SDL3pp_ttf.h:583
Point GetStringSize(std::string_view text) const
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:1431
Font(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition: SDL3pp_ttf.h:507
constexpr Font(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_ttf.h:457
constexpr auto operator<=>(const Font &other) const noexcept=default
Comparison.
constexpr Font(const FontRaw resource) noexcept
Constructs from FontParam.
Definition: SDL3pp_ttf.h:469
constexpr FontRaw get() const noexcept
Retrieves underlying FontRaw.
Definition: SDL3pp_ttf.h:604
constexpr Font(const Font &other) noexcept=default
Copy constructor.
constexpr Font & operator=(Font &&other) noexcept
Assignment operator.
Definition: SDL3pp_ttf.h:592
constexpr FontRaw release() noexcept
Retrieves underlying FontRaw and clear this.
Definition: SDL3pp_ttf.h:607
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:1477
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:5276
constexpr SubStringIterator()
Default constructor.
Definition: SDL3pp_ttf.h:5289
constexpr SubStringIterator & operator--()
Decrement operator.
Definition: SDL3pp_ttf.h:5325
constexpr const SubString & operator*() const
Retrieve SubString.
Definition: SDL3pp_ttf.h:5298
constexpr const SubString * operator->() const
Retrieve SubString.
Definition: SDL3pp_ttf.h:5301
constexpr bool operator==(const SubStringIterator &other) const
Comparison.
Definition: SDL3pp_ttf.h:5304
constexpr SubStringIterator operator--(int)
Decrement operator.
Definition: SDL3pp_ttf.h:5332
constexpr SubStringIterator operator++(int)
Increment operator.
Definition: SDL3pp_ttf.h:5317
constexpr SubStringIterator & operator++()
Increment operator.
Definition: SDL3pp_ttf.h:5310
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:227
A text engine used to create text objects.
Definition: SDL3pp_ttf.h:3998
constexpr TextEngineRaw release() noexcept
Retrieves underlying TextEngineRaw and clear this.
Definition: SDL3pp_ttf.h:4050
virtual void Destroy()=0
frees up textEngine. Pure virtual
constexpr TextEngineRaw get() const noexcept
Retrieves underlying TextEngineRaw.
Definition: SDL3pp_ttf.h:4047
constexpr TextEngine(const TextEngine &other) noexcept=default
Copy constructor.
constexpr auto operator<=>(const TextEngine &other) const noexcept=default
Comparison.
constexpr TextEngine(const TextEngineRaw resource) noexcept
Constructs from TextEngineParam.
Definition: SDL3pp_ttf.h:4015
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:4003
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:5229
int GetNumLines() const
The number of lines in the text, 0 if it's empty.
Definition: SDL3pp_ttf.h:5232
constexpr Text(const Text &other) noexcept=default
Copy constructor.
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:4428
constexpr TextRaw get() const noexcept
Retrieves underlying TextRaw.
Definition: SDL3pp_ttf.h:4425
constexpr TextRaw operator->() noexcept
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:4407
SubStringIterator begin() const
Get iterator to first substring.
constexpr const TextRaw operator->() const noexcept
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:4404
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:4410
OwnArray< SubString * > GetSubStrings() const
Get all substrings of a text object.
Definition: SDL3pp_ttf.h:5115
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:4398
constexpr Text & operator=(Text &&other) noexcept
Assignment operator.
Definition: SDL3pp_ttf.h:4413
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:4372
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:3086
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition: SDL3pp_pixels.h:83
SDL_Point PointRaw
Alias to raw representation for Point.
Definition: SDL3pp_rect.h:22
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:5860
void SetFontLanguage(FontParam font, StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3118
const char * GetFontFamilyName(FontParam font)
Query a font's family name.
Definition: SDL3pp_ttf.h:2906
constexpr FontStyleFlags STYLE_NORMAL
No special style.
Definition: SDL3pp_ttf.h:334
Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition: SDL3pp_ttf.h:3091
void SetFontLineSkip(FontParam font, int lineskip)
Set the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:2771
constexpr SubStringFlags SUBSTRING_LINE_END
This substring contains the end of line line_index
Definition: SDL3pp_ttf.h:3958
constexpr HintingFlags HINTING_LIGHT
Light hinting applies subtle adjustments to improve rendering.
Definition: SDL3pp_ttf.h:370
void DrawSurface(Point p, SurfaceParam surface) const
Draw text to an SDL surface.
Definition: SDL3pp_ttf.h:5385
constexpr HorizontalAlignment HORIZONTAL_ALIGN_CENTER
CENTER.
Definition: SDL3pp_ttf.h:397
PropertiesRef GetTextProperties(TextConstParam text)
Get the properties associated with a text object.
Definition: SDL3pp_ttf.h:5750
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:5411
void SetFontSDF(FontParam font, bool enabled)
Enable Signed Distance Field rendering for a font.
Definition: SDL3pp_ttf.h:2589
constexpr HorizontalAlignment HORIZONTAL_ALIGN_RIGHT
RIGHT.
Definition: SDL3pp_ttf.h:400
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:3512
int GetFontHeight(FontParam font)
Query the total height of a font.
Definition: SDL3pp_ttf.h:2720
void Destroy() final
Destroy a text engine created for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5531
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:3976
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:3371
bool IsFixedWidth() const
Query whether a font is fixed-width.
Definition: SDL3pp_ttf.h:2867
TTF_Font * FontRaw
Alias to raw representation for Font.
Definition: SDL3pp_ttf.h:31
RendererTextEngine CreateRendererTextEngine(RendererParam renderer)
Create a text engine for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5432
constexpr SubStringFlags SUBSTRING_TEXT_START
This substring contains the beginning of the text.
Definition: SDL3pp_ttf.h:3950
const char * GetStyleName() const
Query a font's style name.
Definition: SDL3pp_ttf.h:2937
static Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition: SDL3pp_ttf.h:3096
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:3556
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:3837
HintingFlags GetFontHinting(FontParam font)
Query a font's current FreeType hinter setting.
Definition: SDL3pp_ttf.h:2556
void SetFontScript(FontParam font, Uint32 script)
Set the script to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3048
int GetFontWeight(FontParam font)
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition: SDL3pp_ttf.h:2625
void SetSizeDPI(float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2324
constexpr int FONT_WEIGHT_BLACK
Black (900) named font weight value.
Definition: SDL3pp_ttf.h:2653
void SetLanguage(StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3123
void RemoveFallback(FontParam fallback)
Remove a fallback font.
Definition: SDL3pp_ttf.h:2248
void SetTextScript(TextParam text, Uint32 script)
Set the script to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5927
void GetTextColorFloat(TextConstParam text, float *r, float *g, float *b, float *a)
Get the color of a text object.
Definition: SDL3pp_ttf.h:6094
int GetFontOutline(FontParam font)
Query a font's current outline.
Definition: SDL3pp_ttf.h:2480
void DestroyRendererTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5526
void DrawRenderer(FPoint p) const
Draw text to an SDL renderer.
Definition: SDL3pp_ttf.h:5505
constexpr SubStringFlags SUBSTRING_LINE_START
This substring contains the beginning of line line_index
Definition: SDL3pp_ttf.h:3955
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:3297
constexpr Direction DIRECTION_LTR
Left to Right.
Definition: SDL3pp_ttf.h:418
constexpr ImageType IMAGE_COLOR
The color channels have image data.
Definition: SDL3pp_ttf.h:438
bool SetFont(FontParam font)
Set the font used by a text object.
Definition: SDL3pp_ttf.h:5836
Direction GetFontDirection(FontParam font)
Get the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2982
Text CreateText(FontParam font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition: SDL3pp_ttf.h:5733
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:3004
HintingFlags GetHinting() const
Query a font's current FreeType hinter setting.
Definition: SDL3pp_ttf.h:2561
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:3170
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:2319
Uint32 SubStringFlags
Flags for SubString.
Definition: SDL3pp_ttf.h:3944
const char * GetFamilyName() const
Query a font's family name.
Definition: SDL3pp_ttf.h:2911
void ClearFallbacks()
Remove all fallback fonts.
Definition: SDL3pp_ttf.h:2270
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:5954
Direction GetDirection() const
Get the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5905
TTF_HintingFlags HintingFlags
Hinting flags for TTF (TrueType Fonts)
Definition: SDL3pp_ttf.h:358
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:3140
void SetStyle(FontStyleFlags style)
Set a font's current style.
Definition: SDL3pp_ttf.h:2402
RendererTextEngine CreateRendererTextEngineWithProperties(PropertiesParam props)
Create a text engine for drawing text on an SDL renderer, with the specified properties.
Definition: SDL3pp_ttf.h:5461
Surface GetGlyphImageForIndex(Uint32 glyph_index, ImageType *image_type) const
Get the pixel image for a character index.
Definition: SDL3pp_ttf.h:3200
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:5882
constexpr ImageType IMAGE_INVALID
INVALID.
Definition: SDL3pp_ttf.h:433
FontStyleFlags GetStyle() const
Query a font's current style.
Definition: SDL3pp_ttf.h:2432
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:3478
void GetHarfBuzzVersion(int *major, int *minor, int *patch)
Query the version of the HarfBuzz library in use.
Definition: SDL3pp_ttf.h:315
void SetOutline(int outline)
Set a font's current outline.
Definition: SDL3pp_ttf.h:2463
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:3752
constexpr HintingFlags HINTING_INVALID
INVALID.
Definition: SDL3pp_ttf.h:362
int GetHeight() const
Query the total height of a font.
Definition: SDL3pp_ttf.h:2722
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:2844
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:3432
GPUTextEngine CreateGPUTextEngineWithProperties(PropertiesParam props)
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
Definition: SDL3pp_ttf.h:5581
void DestroySurfaceTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5406
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:2482
constexpr int FONT_WEIGHT_EXTRA_LIGHT
ExtraLight (200) named font weight value.
Definition: SDL3pp_ttf.h:2632
bool GetFontKerning(FontParam font)
Query whether or not kerning is enabled for a font.
Definition: SDL3pp_ttf.h:2842
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:332
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:5678
void SetFontKerning(FontParam font, bool enabled)
Set if kerning is enabled for a font.
Definition: SDL3pp_ttf.h:2820
Font CopyFont(FontParam existing_font)
Create a copy of an existing font.
Definition: SDL3pp_ttf.h:2133
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:3234
void SetColor(Color c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5983
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:2346
int GetGlyphKerning(Uint32 previous_ch, Uint32 ch) const
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition: SDL3pp_ttf.h:3275
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:3706
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:3427
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:2793
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:3791
constexpr Direction DIRECTION_BTT
Bottom to Top.
Definition: SDL3pp_ttf.h:424
constexpr HintingFlags HINTING_MONO
Monochrome hinting adjusts the font for better rendering at lower resolutions.
Definition: SDL3pp_ttf.h:376
GPUTextEngine CreateGPUTextEngine(GPUDeviceParam device)
Create a text engine for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5552
void SetSDF(bool enabled)
Enable Signed Distance Field rendering for a font.
Definition: SDL3pp_ttf.h:2594
Font OpenFontWithProperties(PropertiesParam props)
Create a font with the specified properties.
Definition: SDL3pp_ttf.h:2070
constexpr int FONT_WEIGHT_EXTRA_BOLD
ExtraBold (800) named font weight value.
Definition: SDL3pp_ttf.h:2650
void GetFontDPI(FontParam font, int *hdpi, int *vdpi)
Get font target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2363
void SetScript(Uint32 script)
Set the script to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5932
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:338
Uint32 GetFontGeneration(FontParam font)
Get the font generation.
Definition: SDL3pp_ttf.h:2185
void SetLineSkip(int lineskip)
Set the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:2776
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:2610
void SetPosition(const PointRaw &p)
Set the position of a text object.
Definition: SDL3pp_ttf.h:6159
void SetKerning(bool enabled)
Set if kerning is enabled for a font.
Definition: SDL3pp_ttf.h:2825
float GetFontSize(FontParam font)
Get the size of a font.
Definition: SDL3pp_ttf.h:2344
bool IsScalable() const
Query whether a font is scalable or not.
Definition: SDL3pp_ttf.h:2888
void SetFontDirection(FontParam font, Direction direction)
Set the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2959
Uint32 GetFontScript(FontParam font)
Get the script used for text shaping a font.
Definition: SDL3pp_ttf.h:3073
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:3887
void GetFreeTypeVersion(int *major, int *minor, int *patch)
Query the version of the FreeType library in use.
Definition: SDL3pp_ttf.h:297
void TagToString(Uint32 tag, char *string, size_t size)
Convert from a 32-bit tag to a 4 character string.
Definition: SDL3pp_ttf.h:3024
TTF_GPUTextEngineWinding GPUTextEngineWinding
The winding order of the vertices returned by Text.GetGPUDrawData.
Definition: SDL3pp_ttf.h:3968
constexpr FontStyleFlags STYLE_BOLD
Bold style.
Definition: SDL3pp_ttf.h:336
constexpr FontStyleFlags STYLE_STRIKETHROUGH
Strikethrough text.
Definition: SDL3pp_ttf.h:343
constexpr int FONT_WEIGHT_THIN
Thin (100) named font weight value.
Definition: SDL3pp_ttf.h:2629
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:2886
void SetColorFloat(FColor c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:6007
constexpr Direction DIRECTION_RTL
Right to Left.
Definition: SDL3pp_ttf.h:420
TTF_ImageType ImageType
The type of data in a glyph image.
Definition: SDL3pp_ttf.h:431
Direction GetDirection() const
Get the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2987
GPUTextEngineWinding GetGPUWinding() const
Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engin...
Definition: SDL3pp_ttf.h:5704
Uint32 GetGeneration() const
Get the font generation.
Definition: SDL3pp_ttf.h:2190
void SetFontSize(FontParam font, float ptsize)
Set a font's size dynamically.
Definition: SDL3pp_ttf.h:2289
int GetDescent() const
Query the offset from the baseline to the bottom of a font.
Definition: SDL3pp_ttf.h:2754
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:3517
TTF_TextEngine * TextEngineRaw
Alias to raw representation for TextEngine.
Definition: SDL3pp_ttf.h:67
int GetFontDescent(FontParam font)
Query the offset from the baseline to the bottom of a font.
Definition: SDL3pp_ttf.h:2752
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:3330
constexpr HintingFlags HINTING_NORMAL
Normal hinting applies standard grid-fitting.
Definition: SDL3pp_ttf.h:366
int GetGlyphKerning(FontParam font, Uint32 previous_ch, Uint32 ch)
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition: SDL3pp_ttf.h:3269
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:3385
constexpr HorizontalAlignment HORIZONTAL_ALIGN_INVALID
INVALID.
Definition: SDL3pp_ttf.h:391
TextEngineParam GetEngine() const
Get the text engine used by a text object.
Definition: SDL3pp_ttf.h:5805
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:5877
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:3605
bool HasGlyph(Uint32 ch) const
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3145
constexpr Direction DIRECTION_INVALID
INVALID.
Definition: SDL3pp_ttf.h:416
FontStyleFlags GetFontStyle(FontParam font)
Query a font's current style.
Definition: SDL3pp_ttf.h:2427
const char * GetFontStyleName(FontParam font)
Query a font's style name.
Definition: SDL3pp_ttf.h:2932
constexpr HintingFlags HINTING_NONE
No hinting, the font is rendered without any grid-fitting.
Definition: SDL3pp_ttf.h:379
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:2647
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:3660
constexpr ImageType IMAGE_ALPHA
The color channels are white.
Definition: SDL3pp_ttf.h:435
void SetWrapAlignment(HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:2681
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:2641
void ClearFallbackFonts(FontParam font)
Remove all fallback fonts.
Definition: SDL3pp_ttf.h:2268
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:5855
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:3615
void SetFontStyle(FontParam font, FontStyleFlags style)
Set a font's current style.
Definition: SDL3pp_ttf.h:2397
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:3743
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:5672
HorizontalAlignment GetFontWrapAlignment(FontParam font)
Query a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:2698
int GetWeight() const
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition: SDL3pp_ttf.h:2627
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:3564
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_INVALID
INVALID.
Definition: SDL3pp_ttf.h:3970
void SetDirection(Direction direction)
Set the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:2964
void SetScript(Uint32 script)
Set the script to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3053
bool FontIsFixedWidth(FontParam font)
Query whether a font is fixed-width.
Definition: SDL3pp_ttf.h:2862
int GetLineSkip() const
Query the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:2795
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:2608
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:3932
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:2703
void AddFallback(FontParam fallback)
Add a fallback font.
Definition: SDL3pp_ttf.h:2222
void DestroyGPUTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5650
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:3699
int GetFontAscent(FontParam font)
Query the offset from the baseline to the top of a font.
Definition: SDL3pp_ttf.h:2736
void SetTextPosition(TextParam text, const PointRaw &p)
Set the position of a text object.
Definition: SDL3pp_ttf.h:6154
void DrawSurfaceText(TextConstParam text, Point p, SurfaceParam surface)
Draw text to an SDL surface.
Definition: SDL3pp_ttf.h:5380
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:5699
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:2217
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:340
constexpr int FONT_WEIGHT_EXTRA_BLACK
ExtraBlack (950) named font weight value.
Definition: SDL3pp_ttf.h:2656
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:5900
constexpr SubStringFlags SUBSTRING_TEXT_END
This substring contains the end of the text.
Definition: SDL3pp_ttf.h:3960
Font Copy() const
Create a copy of an existing font.
Definition: SDL3pp_ttf.h:2138
constexpr SubStringFlags SUBSTRING_DIRECTION_MASK
The mask for the flow direction for this substring.
Definition: SDL3pp_ttf.h:3946
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:3469
TTF_HorizontalAlignment HorizontalAlignment
The horizontal alignment used when rendering wrapped text.
Definition: SDL3pp_ttf.h:389
PropertiesRef GetProperties() const
Get the properties associated with a text object.
Definition: SDL3pp_ttf.h:5755
constexpr Direction DIRECTION_TTB
Top to Bottom.
Definition: SDL3pp_ttf.h:422
int GetNumFaces() const
Query the number of faces of a font.
Definition: SDL3pp_ttf.h:2530
void SetTextColor(TextParam text, Color c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5978
void RemoveFallbackFont(FontParam font, FontParam fallback)
Remove a fallback font.
Definition: SDL3pp_ttf.h:2243
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:6070
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:3924
void SetEngine(TextEngineParam engine)
Set the text engine used by a text object.
Definition: SDL3pp_ttf.h:5781
TextEngineParam GetTextEngine(TextConstParam text)
Get the text engine used by a text object.
Definition: SDL3pp_ttf.h:5800
void SetSize(float ptsize)
Set a font's size dynamically.
Definition: SDL3pp_ttf.h:2294
constexpr HintingFlags HINTING_LIGHT_SUBPIXEL
Light hinting with subpixel rendering for more precise font edges.
Definition: SDL3pp_ttf.h:382
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:2458
SurfaceTextEngine CreateSurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5355
void GetDPI(int *hdpi, int *vdpi) const
Get font target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2368
Font OpenFont(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition: SDL3pp_ttf.h:1993
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:2160
Surface GetGlyphImageForIndex(FontParam font, Uint32 glyph_index, ImageType *image_type)
Get the pixel image for a character index.
Definition: SDL3pp_ttf.h:3193
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:3829
void SetFontWrapAlignment(FontParam font, HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:2676
void SetHinting(HintingFlags hinting)
Set a font's current hinter setting.
Definition: SDL3pp_ttf.h:2513
GPUAtlasDrawSequence * GetGPUDrawData() const
Get the geometry data needed for drawing the text.
Definition: SDL3pp_ttf.h:5630
TTF_Text * TextRaw
Alias to raw representation for Text.
Definition: SDL3pp_ttf.h:100
void DrawRendererText(TextConstParam text, FPoint p)
Draw text to an SDL renderer.
Definition: SDL3pp_ttf.h:5500
FColor GetColorFloat() const
Get the color of a text object.
Definition: SDL3pp_ttf.h:6130
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:3245
Uint32 GetScript() const
Get the script used for text shaping a font.
Definition: SDL3pp_ttf.h:3075
void GetTextColor(TextConstParam text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color of a text object.
Definition: SDL3pp_ttf.h:6034
constexpr HorizontalAlignment HORIZONTAL_ALIGN_LEFT
LEFT.
Definition: SDL3pp_ttf.h:394
void SetTextEngine(TextParam text, TextEngineParam engine)
Set the text engine used by a text object.
Definition: SDL3pp_ttf.h:5776
constexpr int FONT_WEIGHT_SEMI_BOLD
SemiBold (600) named font weight value.
Definition: SDL3pp_ttf.h:2644
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:2738
PropertiesRef GetProperties()
Get the properties associated with a font.
Definition: SDL3pp_ttf.h:2165
Uint32 GetScript() const
Get the script used for text shaping a text object.
Definition: SDL3pp_ttf.h:5959
bool SetTextFont(TextParam text, FontParam font)
Set the font used by a text object.
Definition: SDL3pp_ttf.h:5831
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:3877
constexpr int FONT_WEIGHT_NORMAL
Normal (400) named font weight value.
Definition: SDL3pp_ttf.h:2638
int GetNumFontFaces(FontParam font)
Query the number of faces of a font.
Definition: SDL3pp_ttf.h:2528
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:3652
Surface GetGlyphImage(FontParam font, Uint32 ch, ImageType *image_type)
Get the pixel image for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3165
TTF_Direction Direction
Direction flags.
Definition: SDL3pp_ttf.h:414
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:3786
constexpr ImageType IMAGE_SDF
The alpha channel has signed distance field information.
Definition: SDL3pp_ttf.h:442
constexpr int FONT_WEIGHT_LIGHT
Light (300) named font weight value.
Definition: SDL3pp_ttf.h:2635
void SetFontHinting(FontParam font, HintingFlags hinting)
Set a font's current hinter setting.
Definition: SDL3pp_ttf.h:2508
void Destroy() final
Destroy a text engine created for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5655
GPUAtlasDrawSequence * GetGPUTextDrawData(TextConstParam text)
Get the geometry data needed for drawing the text.
Definition: SDL3pp_ttf.h:5625
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_CLOCKWISE
CLOCKWISE.
Definition: SDL3pp_ttf.h:3973
void SetTextColorFloat(TextParam text, FColor c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:6002
::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:2192
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2365
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:38
constexpr FontParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:48
constexpr FontParam(FontRaw value)
Constructs from FontRaw.
Definition: SDL3pp_ttf.h:42
FontRaw value
parameter's FontRaw
Definition: SDL3pp_ttf.h:39
constexpr auto operator<=>(const FontParam &other) const =default
Comparison.
Semi-safe reference for Font.
Definition: SDL3pp_ttf.h:1939
constexpr FontRef(const FontRef &other) noexcept=default
Copy constructor.
~FontRef()
Destructor.
Definition: SDL3pp_ttf.h:1970
FontRef(FontParam resource) noexcept
Constructs from FontParam.
Definition: SDL3pp_ttf.h:1949
FontRef(FontRaw resource) noexcept
Constructs from FontParam.
Definition: SDL3pp_ttf.h:1961
Safely wrap GPUDevice for non owning parameters.
Definition: SDL3pp_gpu.h:387
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:53
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:716
Safely wrap Renderer for non owning parameters.
Definition: SDL3pp_render.h:54
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:53
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:137
constexpr auto operator<=>(const TextConstParam &other) const =default
Comparison.
const TextRaw value
parameter's const TextRaw
Definition: SDL3pp_ttf.h:138
constexpr TextConstParam(TextParam value)
Constructs from TextParam.
Definition: SDL3pp_ttf.h:147
constexpr TextConstParam(const TextRaw value)
Constructs from const TextRaw.
Definition: SDL3pp_ttf.h:141
constexpr TextConstParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:153
constexpr auto operator->()
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:168
Safely wrap TextEngine for non owning parameters.
Definition: SDL3pp_ttf.h:71
constexpr TextEngineParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:81
constexpr auto operator<=>(const TextEngineParam &other) const =default
Comparison.
constexpr TextEngineParam(TextEngineRaw value)
Constructs from TextEngineRaw.
Definition: SDL3pp_ttf.h:75
TextEngineRaw value
parameter's TextEngineRaw
Definition: SDL3pp_ttf.h:72
Safely wrap Text for non owning parameters.
Definition: SDL3pp_ttf.h:107
constexpr auto operator<=>(const TextParam &other) const =default
Comparison.
constexpr TextParam(TextRaw value)
Constructs from TextRaw.
Definition: SDL3pp_ttf.h:111
TextRaw value
parameter's TextRaw
Definition: SDL3pp_ttf.h:108
constexpr TextParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:117
constexpr auto operator->()
member access to underlying TextRaw.
Definition: SDL3pp_ttf.h:132
Semi-safe reference for Text.
Definition: SDL3pp_ttf.h:5237
TextRef(TextRaw resource) noexcept
Constructs from TextParam.
Definition: SDL3pp_ttf.h:5259
TextRef(TextParam resource=nullptr) noexcept
Constructs from TextParam.
Definition: SDL3pp_ttf.h:5247
~TextRef()
Destructor.
Definition: SDL3pp_ttf.h:5268
constexpr TextRef(const TextRef &other) noexcept=default
Copy constructor.