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>
79#define SDL_TTF_MAJOR_VERSION
81#define SDL_TTF_MINOR_VERSION
83#define SDL_TTF_MICRO_VERSION
90#define SDL_TTF_VERSION \
92 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
97#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
98 ((SDL_TTF_MAJOR_VERSION >= X) && \
99 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
100 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || \
101 SDL_TTF_MICRO_VERSION >= Z))
116inline int Version() {
return TTF_Version(); }
155inline void Quit() { TTF_Quit(); }
179inline int WasInit() {
return TTF_WasInit(); }
200 TTF_GetFreeTypeVersion(major, minor, patch);
218 TTF_GetHarfBuzzVersion(major, minor, patch);
245 TTF_STYLE_STRIKETHROUGH;
261#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
293 TTF_HORIZONTAL_ALIGN_INVALID;
296 TTF_HORIZONTAL_ALIGN_LEFT;
299 TTF_HORIZONTAL_ALIGN_CENTER;
302 TTF_HORIZONTAL_ALIGN_RIGHT;
373 :
Font(other.release())
652 void SetSizeDPI(
float ptsize,
int hdpi,
int vdpi);
684 void GetDPI(
int* hdpi,
int* vdpi)
const;
847 void SetSDF(
bool enabled);
862#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
1260 int* advance)
const;
1315 void GetStringSize(std::string_view text,
int* w,
int* h)
const;
1396 int* measured_width,
1397 size_t* measured_length)
const;
1466 int wrapLength)
const;
1567 int wrap_width)
const;
1665 int wrap_width)
const;
1765 int wrap_width)
const;
1820 return Font(std::move(file), ptsize);
1865 return Font(src, ptsize, closeio);
1920 TTF_PROP_FONT_CREATE_FILENAME_STRING;
1923 TTF_PROP_FONT_CREATE_IOSTREAM_POINTER;
1926 TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER;
1929 TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
1933 TTF_PROP_FONT_CREATE_SIZE_FLOAT;
1936 TTF_PROP_FONT_CREATE_FACE_NUMBER;
1939 TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER;
1942 TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER;
1944#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
1947 TTF_PROP_FONT_CREATE_EXISTING_FONT;
2001 return CheckError(TTF_GetFontProperties(font));
2022 TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER;
2025 TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER;
2028 TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER;
2049 return TTF_GetFontGeneration(font);
2081 CheckError(TTF_AddFallbackFont(font, fallback));
2107 TTF_RemoveFallbackFont(font, fallback);
2180 CheckError(TTF_SetFontSizeDPI(font, ptsize, hdpi, vdpi));
2224 CheckError(TTF_GetFontDPI(font, hdpi, vdpi));
2258 TTF_SetFontStyle(font, style);
2288 return TTF_GetFontStyle(font);
2319 CheckError(TTF_SetFontOutline(font, outline));
2369 TTF_SetFontHinting(font, hinting);
2414 return TTF_GetFontHinting(font);
2468#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2486 TTF_FONT_WEIGHT_THIN;
2489 TTF_FONT_WEIGHT_EXTRA_LIGHT;
2492 TTF_FONT_WEIGHT_LIGHT;
2495 TTF_FONT_WEIGHT_NORMAL;
2498 TTF_FONT_WEIGHT_MEDIUM;
2501 TTF_FONT_WEIGHT_SEMI_BOLD;
2504 TTF_FONT_WEIGHT_BOLD;
2507 TTF_FONT_WEIGHT_EXTRA_BOLD;
2510 TTF_FONT_WEIGHT_BLACK;
2513 TTF_FONT_WEIGHT_EXTRA_BLACK;
2534 TTF_SetFontWrapAlignment(font, align);
2556 return TTF_GetFontWrapAlignment(font);
2629 TTF_SetFontLineSkip(font, lineskip);
2675 TTF_SetFontKerning(font, enabled);
2717 return TTF_FontIsFixedWidth(font);
2758 return TTF_GetFontFamilyName(font);
2784 return TTF_GetFontStyleName(font);
2811 CheckError(TTF_SetFontDirection(font, direction));
2834 return TTF_GetFontDirection(font);
2856 return TTF_StringToTag(
string);
2876 TTF_TagToString(tag,
string, size);
2970 CheckError(TTF_SetFontLanguage(font, language_bcp47));
2992 return TTF_FontHasGlyph(font, ch);
3048 CheckError(TTF_GetGlyphImageForIndex(font, glyph_index, image_type)));
3093 CheckError(TTF_GetGlyphMetrics(font, ch, minx, maxx, miny, maxy, advance));
3122 if (
int r; TTF_GetGlyphKerning(font, previous_ch, ch, &r))
return r;
3150 CheckError(TTF_GetStringSize(font, text.data(), text.size(), w, h));
3182 std::string_view text,
3188 TTF_GetStringSizeWrapped(font, text.data(), text.size(), wrap_width, w, h));
3223 std::string_view text,
3225 int* measured_width,
3226 size_t* measured_length)
3238 int* measured_width,
3239 size_t* measured_length)
const
3279 return Surface{TTF_RenderText_Solid(font, text.data(), text.size(), fg)};
3320 std::string_view text,
3324 return Surface(TTF_RenderText_Solid_Wrapped(
3325 font, text.data(), text.size(), fg, wrapLength));
3330 int wrapLength)
const
3364 return Surface(TTF_RenderGlyph_Solid(font, ch, fg));
3407 std::string_view text,
3411 return Surface(TTF_RenderText_Shaded(font, text.data(), text.size(), fg, bg));
3456 std::string_view text,
3461 return Surface(TTF_RenderText_Shaded_Wrapped(
3462 font, text.data(), text.size(), fg, bg, wrap_width));
3468 int wrap_width)
const
3507 return Surface(TTF_RenderGlyph_Shaded(font, ch, fg, bg));
3551 return Surface(TTF_RenderText_Blended(font, text.data(), text.size(), fg));
3592 std::string_view text,
3596 return Surface(TTF_RenderText_Blended_Wrapped(
3597 font, text.data(), text.size(), fg, wrap_width));
3602 int wrap_width)
const
3636 return Surface(TTF_RenderGlyph_Blended(font, ch, fg));
3678 std::string_view text,
3682 return Surface(TTF_RenderText_LCD(font, text.data(), text.size(), fg, bg));
3726 std::string_view text,
3731 return Surface(TTF_RenderText_LCD_Wrapped(
3732 font, text.data(), text.size(), fg, bg, wrap_width));
3738 int wrap_width)
const
3777 return Surface(TTF_RenderGlyph_LCD(font, ch, fg, bg));
3795 TTF_SUBSTRING_DIRECTION_MASK;
3799 TTF_SUBSTRING_TEXT_START;
3809 TTF_SUBSTRING_TEXT_END;
3819 TTF_GPU_TEXTENGINE_WINDING_INVALID;
3822 TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE;
3825 TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE;
4177 :
Text(other.release())
4546 void GetColorFloat(
float* r,
float* g,
float* b,
float* a)
const;
4707 void SetString(std::string_view
string);
4730 void InsertString(
int offset, std::string_view
string);
4792 void GetSize(
int* w,
int* h)
const;
5015class SubStringIterator
5030 : SubStringIterator(
TextRef{})
5035 constexpr operator bool()
const {
return bool(m_text); }
5046 return m_subString.offset == other.m_subString.offset;
5052 m_text.GetNextSubString(m_subString, &m_subString);
5060 m_text.GetNextSubString(m_subString, &m_subString);
5067 m_text.GetPreviousSubString(m_subString, &m_subString);
5075 m_text.GetPreviousSubString(m_subString, &m_subString);
5127 CheckError(TTF_DrawSurfaceText(text, p.x, p.y, surface));
5152 TTF_DestroySurfaceTextEngine(engine);
5182 :
TextEngine(TTF_CreateRendererTextEngine(renderer))
5187 :
TextEngine(TTF_CreateRendererTextEngineWithProperties(props))
5232 TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER;
5235 TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE;
5262 CheckError(TTF_DrawRendererText(text, p.x, p.y));
5287 TTF_DestroyRendererTextEngine(engine);
5317 :
TextEngine(TTF_CreateGPUTextEngine(device))
5322 :
TextEngine(TTF_CreateGPUTextEngineWithProperties(props))
5366 TTF_PROP_GPU_TEXT_ENGINE_DEVICE;
5369 TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE;
5401 return TTF_GetGPUTextDrawData(text);
5426 TTF_DestroyGPUTextEngine(engine);
5449 TTF_SetGPUTextEngineWinding(engine, winding);
5475 return TTF_GetGPUTextEngineWinding(engine);
5502 std::string_view text)
5504 return Text(engine, font, text);
5509 return Text(
get(), font, text);
5513 :
Text(TTF_CreateText(engine, font, text.data(), text.size()))
5531 return {
CheckError(TTF_GetTextProperties(text))};
5612 return TTF_SetTextFont(text, font);
5658 CheckError(TTF_SetTextDirection(text, direction));
5681 return TTF_GetTextDirection(text);
5735 return TTF_GetTextScript(text);
5759 CheckError(TTF_SetTextColor(text, c.r, c.g, c.b, c.a));
5783 CheckError(TTF_SetTextColorFloat(text, c.r, c.g, c.b, c.a));
5816 CheckError(TTF_GetTextColor(text, r, g, b, a));
5876 CheckError(TTF_GetTextColorFloat(text, r, g, b, a));
5932 CheckError(TTF_SetTextPosition(text, p.x, p.y));
6010 CheckError(TTF_SetTextWrapWidth(text, wrap_width));
6064 CheckError(TTF_SetTextWrapWhitespaceVisible(text, visible));
6087 return TTF_TextWrapWhitespaceVisible(text);
6115 CheckError(TTF_SetTextString(text,
string.data(),
string.size()));
6147 CheckError(TTF_InsertTextString(text, offset,
string.data(),
string.size()));
6175 CheckError(TTF_AppendTextString(text,
string.data(),
string.size()));
6208 CheckError(TTF_DeleteTextString(text, offset, length));
6291 CheckError(TTF_GetTextSubString(text, offset, substring));
6322 CheckError(TTF_GetTextSubStringForLine(text, line, substring));
6350 auto data = TTF_GetTextSubStringsForRange(text, offset, length, &count);
6381 CheckError(TTF_GetTextSubStringForPoint(text, p.x, p.y, substring));
6410 CheckError(TTF_GetPreviousTextSubString(text, &substring, previous));
6439 CheckError(TTF_GetNextTextSubString(text, &substring, next));
An exception that returns GetError().
Definition SDL3pp_error.h:163
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:53
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:56
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Const reference wrapper for a given resource,.
Definition SDL3pp_resource.h:111
Reference wrapper for a given resource,.
Definition SDL3pp_resource.h:75
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
Iterator for substrings.
Definition SDL3pp_ttf.h:5016
SubStringIterator()
Default constructor.
Definition SDL3pp_ttf.h:5029
SubStringIterator operator--(int)
Decrement operator.
Definition SDL3pp_ttf.h:5072
constexpr const SubString & operator*() const
Retrieve SubString.
Definition SDL3pp_ttf.h:5038
constexpr const SubString * operator->() const
Retrieve SubString.
Definition SDL3pp_ttf.h:5041
SubStringIterator & operator--()
Decrement operator.
Definition SDL3pp_ttf.h:5065
constexpr bool operator==(const SubStringIterator &other) const
Comparison.
Definition SDL3pp_ttf.h:5044
SubStringIterator & operator++()
Increment operator.
Definition SDL3pp_ttf.h:5050
SubStringIterator operator++(int)
Increment operator.
Definition SDL3pp_ttf.h:5057
#define SDL_assert_paranoid(condition)
An assertion test that is performed only when built with paranoid settings.
Definition SDL3pp_assert.h:383
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
ResourceRef< GPUDevice > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:386
ResourceRef< IOStream > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:34
void Quit()
Clean up all initialized subsystems.
Definition SDL3pp_init.h:329
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition SDL3pp_pixels.h:83
ResourceRef< Properties > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:54
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:5989
void GetStringSize(FontRef font, std::string_view text, int *w, int *h)
Calculate the dimensions of a rendered string of UTF-8 text.
Definition SDL3pp_ttf.h:3148
FontRef GetFont() const
Get the font used by a text object.
Definition SDL3pp_ttf.h:5639
TTF_ImageType ImageType
The type of data in a glyph image.
Definition SDL3pp_ttf.h:332
constexpr FontStyleFlags STYLE_NORMAL
No special style.
Definition SDL3pp_ttf.h:235
void SetTextPosition(TextRef text, const PointRaw &p)
Set the position of a text object.
Definition SDL3pp_ttf.h:5930
Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition SDL3pp_ttf.h:2941
constexpr SubStringFlags SUBSTRING_LINE_END
This substring contains the end of line line_index.
Definition SDL3pp_ttf.h:3806
constexpr HintingFlags HINTING_LIGHT
Light hinting applies subtle adjustments to improve rendering.
Definition SDL3pp_ttf.h:271
FontStyleFlags GetFontStyle(FontRef font)
Query a font's current style.
Definition SDL3pp_ttf.h:2286
bool GetFontKerning(FontRef font)
Query whether or not kerning is enabled for a font.
Definition SDL3pp_ttf.h:2695
constexpr HorizontalAlignment HORIZONTAL_ALIGN_CENTER
CENTER.
Definition SDL3pp_ttf.h:298
void GetPreviousTextSubString(TextConstRef text, const SubString &substring, SubString *previous)
Get the previous substring in a text object.
Definition SDL3pp_ttf.h:6406
PropertiesRef GetTextProperties(TextConstRef text)
Get the properties associated with a text object.
Definition SDL3pp_ttf.h:5529
void Destroy() final
Destroy a text engine created for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5155
void SetTextScript(TextRef text, Uint32 script)
Set the script to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5706
Font OpenFontIO(IOStreamRef src, float ptsize, bool closeio=false)
Create a font from an IOStream, using a specified point size.
Definition SDL3pp_ttf.h:1863
TTF_Text * TextRaw
Alias to raw representation for Text.
Definition SDL3pp_ttf.h:57
int GetFontDescent(FontRef font)
Query the offset from the baseline to the bottom of a font.
Definition SDL3pp_ttf.h:2608
constexpr HorizontalAlignment HORIZONTAL_ALIGN_RIGHT
RIGHT.
Definition SDL3pp_ttf.h:301
TTF_GPUTextEngineWinding GPUTextEngineWinding
The winding order of the vertices returned by Text.GetGPUDrawData.
Definition SDL3pp_ttf.h:3816
ResourceLegacyRef< TextEngineRaw > TextEngineRef
Reference for TextEngine.
Definition SDL3pp_ttf.h:51
void Destroy() final
Destroy a text engine created for drawing text on an SDL renderer.
Definition SDL3pp_ttf.h:5290
int GetFontWeight(FontRef font)
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition SDL3pp_ttf.h:2481
void SetTextWrapWhitespaceVisible(TextRef text, bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition SDL3pp_ttf.h:6062
void SetFontLanguage(FontRef font, StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2968
void GetPreviousSubString(const SubString &substring, SubString *previous) const
Get the previous substring in a text object.
Definition SDL3pp_ttf.h:6413
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE
COUNTER_CLOCKWISE.
Definition SDL3pp_ttf.h:3824
Surface RenderText_Solid_Wrapped(FontRef 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:3319
void MeasureString(FontRef 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:3222
const TTF_Text * TextRawConst
Alias to const raw representation for Text.
Definition SDL3pp_ttf.h:60
bool IsFixedWidth() const
Query whether a font is fixed-width.
Definition SDL3pp_ttf.h:2720
void SetFontStyle(FontRef font, FontStyleFlags style)
Set a font's current style.
Definition SDL3pp_ttf.h:2256
Surface RenderText_LCD_Wrapped(FontRef 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:3725
GPUTextEngine CreateGPUTextEngineWithProperties(PropertiesRef props)
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
Definition SDL3pp_ttf.h:5350
void GetTextColorFloat(TextConstRef text, float *r, float *g, float *b, float *a)
Get the color of a text object.
Definition SDL3pp_ttf.h:5870
TTF_Direction Direction
Direction flags.
Definition SDL3pp_ttf.h:315
constexpr SubStringFlags SUBSTRING_TEXT_START
This substring contains the beginning of the text.
Definition SDL3pp_ttf.h:3798
const char * GetStyleName() const
Query a font's style name.
Definition SDL3pp_ttf.h:2787
void SetTextDirection(TextRef text, Direction direction)
Set the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5656
static Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition SDL3pp_ttf.h:2946
void ClearFallbackFonts(FontRef font)
Remove all fallback fonts.
Definition SDL3pp_ttf.h:2130
void SetFontScript(FontRef font, Uint32 script)
Set the script to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2898
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:3685
Uint32 GetFontGeneration(FontRef font)
Get the font generation.
Definition SDL3pp_ttf.h:2047
void AppendTextString(TextRef text, std::string_view string)
Append UTF-8 text to a text object.
Definition SDL3pp_ttf.h:6173
void SetSizeDPI(float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition SDL3pp_ttf.h:2183
constexpr int FONT_WEIGHT_BLACK
Black (900) named font weight value.
Definition SDL3pp_ttf.h:2509
void SetLanguage(StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2973
void SetFontWrapAlignment(FontRef font, HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2532
TextEngineRef GetTextEngine(TextConstRef text)
Get the text engine used by a text object.
Definition SDL3pp_ttf.h:5579
void DestroyRendererTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on an SDL renderer.
Definition SDL3pp_ttf.h:5285
void DrawRenderer(FPoint p) const
Draw text to an SDL renderer.
Definition SDL3pp_ttf.h:5265
constexpr SubStringFlags SUBSTRING_LINE_START
This substring contains the beginning of line line_index.
Definition SDL3pp_ttf.h:3803
void DestroyText(TextRaw text)
Destroy a text object created by a text engine.
Definition SDL3pp_ttf.h:6479
constexpr Direction DIRECTION_LTR
Left to Right.
Definition SDL3pp_ttf.h:319
TTF_SubString SubString
The representation of a substring within text.
Definition SDL3pp_ttf.h:4133
constexpr ImageType IMAGE_COLOR
The color channels have image data.
Definition SDL3pp_ttf.h:339
Surface GetGlyphImage(FontRef font, Uint32 ch, ImageType *image_type)
Get the pixel image for a UNICODE codepoint.
Definition SDL3pp_ttf.h:3015
Uint32 GetTextScript(TextConstRef text)
Get the script used for text shaping a text object.
Definition SDL3pp_ttf.h:5733
void AddFallback(FontRef fallback)
Add a fallback font.
Definition SDL3pp_ttf.h:2084
Uint32 StringToTag(StringParam string)
Convert from a 4 character string to a 32-bit tag.
Definition SDL3pp_ttf.h:2854
Direction GetTextDirection(TextConstRef text)
Get the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5679
Surface RenderText_LCD(FontRef 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:3677
HintingFlags GetHinting() const
Query a font's current FreeType hinter setting.
Definition SDL3pp_ttf.h:2417
Surface GetGlyphImage(Uint32 ch, ImageType *image_type) const
Get the pixel image for a UNICODE codepoint.
Definition SDL3pp_ttf.h:3020
void GetTextSubStringForPoint(TextConstRef text, Point p, SubString *substring)
Get the portion of a text string that is closest to a point.
Definition SDL3pp_ttf.h:6377
const char * GetFamilyName() const
Query a font's family name.
Definition SDL3pp_ttf.h:2761
void ClearFallbacks()
Remove all fallback fonts.
Definition SDL3pp_ttf.h:2132
void SetString(std::string_view string)
Set the UTF-8 text used by a text object.
Definition SDL3pp_ttf.h:6118
void UpdateText(TextRef text)
Update the layout of a text object.
Definition SDL3pp_ttf.h:6463
Direction GetDirection() const
Get the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5684
void DrawSurfaceText(TextConstRef text, Point p, SurfaceRef surface)
Draw text to an SDL surface.
Definition SDL3pp_ttf.h:5125
int GetWrapWidth() const
Get whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6040
Point GetSize() const
Get the size of a text object.
Definition SDL3pp_ttf.h:6265
void SetStyle(FontStyleFlags style)
Set a font's current style.
Definition SDL3pp_ttf.h:2261
bool SetTextFont(TextRef text, FontRef font)
Set the font used by a text object.
Definition SDL3pp_ttf.h:5610
SurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5100
Surface GetGlyphImageForIndex(Uint32 glyph_index, ImageType *image_type) const
Get the pixel image for a character index.
Definition SDL3pp_ttf.h:3051
void SetWrapWhitespaceVisible(bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition SDL3pp_ttf.h:6067
void SetDirection(Direction direction)
Set the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5661
constexpr ImageType IMAGE_INVALID
INVALID.
Definition SDL3pp_ttf.h:334
Text CreateText(TextEngineRef engine, FontRef font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition SDL3pp_ttf.h:5500
FontStyleFlags GetStyle() const
Query a font's current style.
Definition SDL3pp_ttf.h:2291
TextEngineRef GetEngine() const
Get the text engine used by a text object.
Definition SDL3pp_ttf.h:5584
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:3328
float GetFontSize(FontRef font)
Get the size of a font.
Definition SDL3pp_ttf.h:2203
Surface RenderText_Shaded(FontRef 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:3406
void SetTextWrapWidth(TextRef text, int wrap_width)
Set whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6008
void RemoveFallbackFont(FontRef font, FontRef fallback)
Remove a fallback font.
Definition SDL3pp_ttf.h:2105
void GetHarfBuzzVersion(int *major, int *minor, int *patch)
Query the version of the HarfBuzz library in use.
Definition SDL3pp_ttf.h:216
Font OpenFontWithProperties(PropertiesRef props)
Create a font with the specified properties.
Definition SDL3pp_ttf.h:1910
const char * GetFontStyleName(FontRef font)
Query a font's style name.
Definition SDL3pp_ttf.h:2782
void SetOutline(int outline)
Set a font's current outline.
Definition SDL3pp_ttf.h:2322
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:3600
constexpr HintingFlags HINTING_INVALID
INVALID.
Definition SDL3pp_ttf.h:263
int GetHeight() const
Query the total height of a font.
Definition SDL3pp_ttf.h:2578
void AddFallbackFont(FontRef font, FontRef fallback)
Add a fallback font.
Definition SDL3pp_ttf.h:2079
bool GetKerning() const
Query whether or not kerning is enabled for a font.
Definition SDL3pp_ttf.h:2697
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:3282
bool FontHasGlyph(FontRef font, Uint32 ch)
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition SDL3pp_ttf.h:2990
GPUAtlasDrawSequence * GetGPUTextDrawData(TextConstRef text)
Get the geometry data needed for drawing the text.
Definition SDL3pp_ttf.h:5399
void DestroySurfaceTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5150
int GetOutline() const
Query a font's current outline.
Definition SDL3pp_ttf.h:2341
constexpr int FONT_WEIGHT_EXTRA_LIGHT
ExtraLight (200) named font weight value.
Definition SDL3pp_ttf.h:2488
TTF_GPUAtlasDrawSequence GPUAtlasDrawSequence
Draw sequence returned by Text.GetGPUDrawData.
Definition SDL3pp_ttf.h:4119
Surface GetGlyphImageForIndex(FontRef font, Uint32 glyph_index, ImageType *image_type)
Get the pixel image for a character index.
Definition SDL3pp_ttf.h:3043
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:5452
bool FontIsFixedWidth(FontRef font)
Query whether a font is fixed-width.
Definition SDL3pp_ttf.h:2715
Uint32 FontStyleFlags
Font style flags for Font.
Definition SDL3pp_ttf.h:233
void RemoveFallback(FontRef fallback)
Remove a fallback font.
Definition SDL3pp_ttf.h:2110
bool TextWrapWhitespaceVisible(TextConstRef text)
Return whether whitespace is shown when wrapping a text object.
Definition SDL3pp_ttf.h:6085
void SetColor(Color c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5762
bool IsWrapWhitespaceVisible() const
Return whether whitespace is shown when wrapping a text object.
Definition SDL3pp_ttf.h:6090
int GetFontAscent(FontRef font)
Query the offset from the baseline to the top of a font.
Definition SDL3pp_ttf.h:2592
float GetSize() const
Get the size of a font.
Definition SDL3pp_ttf.h:2205
int GetGlyphKerning(Uint32 previous_ch, Uint32 ch) const
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition SDL3pp_ttf.h:3126
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:3554
void GetGlyphMetrics(FontRef 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:3085
void SetTextColor(TextRef text, Color c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5757
Uint32 SubStringFlags
Flags for SubString.
Definition SDL3pp_ttf.h:3792
void SetFontLineSkip(FontRef font, int lineskip)
Set the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2627
Surface RenderText_Shaded_Wrapped(FontRef 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:3455
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:3639
constexpr Direction DIRECTION_BTT
Bottom to Top.
Definition SDL3pp_ttf.h:325
constexpr HintingFlags HINTING_MONO
Monochrome hinting adjusts the font for better rendering at lower resolutions.
Definition SDL3pp_ttf.h:277
void SetSDF(bool enabled)
Enable Signed Distance Field rendering for a font.
Definition SDL3pp_ttf.h:2450
FontRef GetTextFont(TextConstRef text)
Get the font used by a text object.
Definition SDL3pp_ttf.h:5634
constexpr int FONT_WEIGHT_EXTRA_BOLD
ExtraBold (800) named font weight value.
Definition SDL3pp_ttf.h:2506
void SetScript(Uint32 script)
Set the script to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5711
void GetFontDPI(FontRef font, int *hdpi, int *vdpi)
Get font target resolutions, in dots per inch.
Definition SDL3pp_ttf.h:2222
void SetWrapWidth(int wrap_width)
Set whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6013
constexpr FontStyleFlags STYLE_ITALIC
Italic style.
Definition SDL3pp_ttf.h:239
Direction GetFontDirection(FontRef font)
Get the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2832
void SetLineSkip(int lineskip)
Set the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2632
bool GetSDF() const
Query whether Signed Distance Field rendering is enabled for a font.
Definition SDL3pp_ttf.h:2466
HorizontalAlignment GetFontWrapAlignment(FontRef font)
Query a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2554
void SetPosition(const PointRaw &p)
Set the position of a text object.
Definition SDL3pp_ttf.h:5935
void SetKerning(bool enabled)
Set if kerning is enabled for a font.
Definition SDL3pp_ttf.h:2678
bool IsScalable() const
Query whether a font is scalable or not.
Definition SDL3pp_ttf.h:2738
GPUTextEngine CreateGPUTextEngine(GPUDeviceRef device)
Create a text engine for drawing text with the SDL GPU API.
Definition SDL3pp_ttf.h:5311
ResourceRef< Font > FontRef
Reference for Font.
Definition SDL3pp_ttf.h:38
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:3735
void GetFreeTypeVersion(int *major, int *minor, int *patch)
Query the version of the FreeType library in use.
Definition SDL3pp_ttf.h:198
void TagToString(Uint32 tag, char *string, size_t size)
Convert from a 32-bit tag to a 4 character string.
Definition SDL3pp_ttf.h:2874
bool GetFontSDF(FontRef font)
Query whether Signed Distance Field rendering is enabled for a font.
Definition SDL3pp_ttf.h:2464
void GetTextSubStringForLine(TextConstRef text, int line, SubString *substring)
Get the substring of a text object that contains the given line.
Definition SDL3pp_ttf.h:6318
constexpr FontStyleFlags STYLE_BOLD
Bold style.
Definition SDL3pp_ttf.h:237
constexpr FontStyleFlags STYLE_STRIKETHROUGH
Strikethrough text.
Definition SDL3pp_ttf.h:244
constexpr int FONT_WEIGHT_THIN
Thin (100) named font weight value.
Definition SDL3pp_ttf.h:2485
void GetNextSubString(const SubString &substring, SubString *next) const
Get the next substring in a text object.
Definition SDL3pp_ttf.h:6442
void SetColorFloat(FColor c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5786
void SetTextEngine(TextRef text, TextEngineRef engine)
Set the text engine used by a text object.
Definition SDL3pp_ttf.h:5555
TTF_TextEngine * TextEngineRaw
Alias to raw representation for TextEngine.
Definition SDL3pp_ttf.h:44
constexpr Direction DIRECTION_RTL
Right to Left.
Definition SDL3pp_ttf.h:321
const char * GetFontFamilyName(FontRef font)
Query a font's family name.
Definition SDL3pp_ttf.h:2756
Direction GetDirection() const
Get the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2837
HintingFlags GetFontHinting(FontRef font)
Query a font's current FreeType hinter setting.
Definition SDL3pp_ttf.h:2412
GPUTextEngineWinding GetGPUWinding() const
Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engin...
Definition SDL3pp_ttf.h:5478
Uint32 GetGeneration() const
Get the font generation.
Definition SDL3pp_ttf.h:2052
int GetDescent() const
Query the offset from the baseline to the bottom of a font.
Definition SDL3pp_ttf.h:2610
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:3367
Font CopyFont(FontRef existing_font)
Create a copy of an existing font.
Definition SDL3pp_ttf.h:1972
TTF_TextData TextData
Internal data for Text.
Definition SDL3pp_ttf.h:4143
void Update()
Update the layout of a text object.
Definition SDL3pp_ttf.h:6465
constexpr HintingFlags HINTING_NORMAL
Normal hinting applies standard grid-fitting.
Definition SDL3pp_ttf.h:267
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:3236
void SetEngine(TextEngineRef engine)
Set the text engine used by a text object.
Definition SDL3pp_ttf.h:5560
constexpr HorizontalAlignment HORIZONTAL_ALIGN_INVALID
INVALID.
Definition SDL3pp_ttf.h:292
void SetFontSize(FontRef font, float ptsize)
Set a font's size dynamically.
Definition SDL3pp_ttf.h:2151
RendererTextEngine CreateRendererTextEngine(RendererRef renderer)
Create a text engine for drawing text on an SDL renderer.
Definition SDL3pp_ttf.h:5176
bool HasGlyph(Uint32 ch) const
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition SDL3pp_ttf.h:2995
constexpr Direction DIRECTION_INVALID
INVALID.
Definition SDL3pp_ttf.h:317
constexpr HintingFlags HINTING_NONE
No hinting, the font is rendered without any grid-fitting.
Definition SDL3pp_ttf.h:280
ResourceRef< Text > TextRef
Reference for Text.
Definition SDL3pp_ttf.h:67
Surface RenderText_Blended(FontRef font, std::string_view text, Color fg)
Render UTF-8 text at high quality to a new ARGB surface.
Definition SDL3pp_ttf.h:3549
void SetGPUTextEngineWinding(TextEngineRef engine, GPUTextEngineWinding winding)
Sets the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engi...
Definition SDL3pp_ttf.h:5446
constexpr int FONT_WEIGHT_BOLD
Bold (700) named font weight value.
Definition SDL3pp_ttf.h:2503
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:3510
constexpr ImageType IMAGE_ALPHA
The color channels are white.
Definition SDL3pp_ttf.h:336
void SetWrapAlignment(HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2537
void SetFontOutline(FontRef font, int outline)
Set a font's current outline.
Definition SDL3pp_ttf.h:2317
void DeleteTextString(TextRef text, int offset, int length)
Delete UTF-8 text from a text object.
Definition SDL3pp_ttf.h:6206
constexpr int FONT_WEIGHT_MEDIUM
Medium (500) named font weight value.
Definition SDL3pp_ttf.h:2497
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:3465
Surface RenderGlyph_Solid(FontRef font, Uint32 ch, ColorRaw fg)
Render a single 32-bit glyph at fast quality to a new 8-bit surface.
Definition SDL3pp_ttf.h:3362
TTF_Font * FontRaw
Alias to raw representation for Font.
Definition SDL3pp_ttf.h:31
void DrawSurface(Point p, SurfaceRef surface) const
Draw text to an SDL surface.
Definition SDL3pp_ttf.h:5130
int GetWeight() const
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition SDL3pp_ttf.h:2483
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:3414
int GetGlyphKerning(FontRef font, Uint32 previous_ch, Uint32 ch)
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition SDL3pp_ttf.h:3120
RendererTextEngine CreateRendererTextEngineWithProperties(PropertiesRef props)
Create a text engine for drawing text on an SDL renderer, with the specified properties.
Definition SDL3pp_ttf.h:5215
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_INVALID
INVALID.
Definition SDL3pp_ttf.h:3818
void SetDirection(Direction direction)
Set the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2814
void SetScript(Uint32 script)
Set the script to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2903
void SetFontKerning(FontRef font, bool enabled)
Set if kerning is enabled for a font.
Definition SDL3pp_ttf.h:2673
int GetLineSkip() const
Query the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2651
GPUTextEngine(GPUDeviceRef device)
Create a text engine for drawing text with the SDL GPU API.
Definition SDL3pp_ttf.h:5316
void Close()
Dispose of a previously-created font.
Definition SDL3pp_ttf.h:6507
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:3780
void InsertString(int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition SDL3pp_ttf.h:6150
HorizontalAlignment GetWrapAlignment() const
Query a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2559
void SetTextColorFloat(TextRef text, FColor c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5781
bool SetFont(FontRef font)
Set the font used by a text object.
Definition SDL3pp_ttf.h:5615
void DestroyGPUTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text with the SDL GPU API.
Definition SDL3pp_ttf.h:5424
OwnArray< SubString * > GetTextSubStringsForRange(TextConstRef text, int offset, int length)
Get the substrings of a text object that contain a range of text.
Definition SDL3pp_ttf.h:6345
void GetNextTextSubString(TextConstRef text, const SubString &substring, SubString *next)
Get the next substring in a text object.
Definition SDL3pp_ttf.h:6435
void SetFontHinting(FontRef font, HintingFlags hinting)
Set a font's current hinter setting.
Definition SDL3pp_ttf.h:2367
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:6354
Surface RenderText_Blended_Wrapped(FontRef 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:3591
void GetSubString(int offset, SubString *substring) const
Get the substring of a text object that surrounds a text offset.
Definition SDL3pp_ttf.h:6294
constexpr FontStyleFlags STYLE_UNDERLINE
Underlined text.
Definition SDL3pp_ttf.h:241
constexpr int FONT_WEIGHT_EXTRA_BLACK
ExtraBlack (950) named font weight value.
Definition SDL3pp_ttf.h:2512
void GetTextPosition(TextConstRef text, int *x, int *y)
Get the position of a text object.
Definition SDL3pp_ttf.h:5957
void AppendString(std::string_view string)
Append UTF-8 text to a text object.
Definition SDL3pp_ttf.h:6178
constexpr SubStringFlags SUBSTRING_TEXT_END
This substring contains the end of the text.
Definition SDL3pp_ttf.h:3808
Font Copy() const
Create a copy of an existing font.
Definition SDL3pp_ttf.h:1977
void GetTextSize(TextConstRef text, int *w, int *h)
Get the size of a text object.
Definition SDL3pp_ttf.h:6233
void GetTextSubString(TextConstRef text, int offset, SubString *substring)
Get the substring of a text object that surrounds a text offset.
Definition SDL3pp_ttf.h:6287
constexpr SubStringFlags SUBSTRING_DIRECTION_MASK
The mask for the flow direction for this substring.
Definition SDL3pp_ttf.h:3794
void GetTextColor(TextConstRef text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color of a text object.
Definition SDL3pp_ttf.h:5810
int GetTextWrapWidth(TextConstRef text)
Get whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6033
ResourceConstRef< TextRaw, TextRawConst > TextConstRef
Safely wrap Text for non owning const parameters.
Definition SDL3pp_ttf.h:70
PropertiesRef GetProperties() const
Get the properties associated with a text object.
Definition SDL3pp_ttf.h:5534
constexpr Direction DIRECTION_TTB
Top to Bottom.
Definition SDL3pp_ttf.h:323
int GetNumFaces() const
Query the number of faces of a font.
Definition SDL3pp_ttf.h:2389
int GetFontHeight(FontRef font)
Query the total height of a font.
Definition SDL3pp_ttf.h:2576
Text CreateText(FontRef font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition SDL3pp_ttf.h:5507
Surface RenderText_Solid(FontRef font, std::string_view text, Color fg)
Render UTF-8 text at fast quality to a new 8-bit surface.
Definition SDL3pp_ttf.h:3277
Color GetColor() const
Get the color of a text object.
Definition SDL3pp_ttf.h:5846
void SetSize(float ptsize)
Set a font's size dynamically.
Definition SDL3pp_ttf.h:2156
constexpr HintingFlags HINTING_LIGHT_SUBPIXEL
Light hinting with subpixel rendering for more precise font edges.
Definition SDL3pp_ttf.h:283
void DeleteString(int offset, int length)
Delete UTF-8 text from a text object.
Definition SDL3pp_ttf.h:6211
SurfaceTextEngine CreateSurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5095
void GetDPI(int *hdpi, int *vdpi) const
Get font target resolutions, in dots per inch.
Definition SDL3pp_ttf.h:2227
Font OpenFont(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition SDL3pp_ttf.h:1818
void Destroy()
Destroy a text object created by a text engine.
Definition SDL3pp_ttf.h:6481
Uint32 GetFontScript(FontRef font)
Get the script used for text shaping a font.
Definition SDL3pp_ttf.h:2923
RendererTextEngine(RendererRef renderer)
Create a text engine for drawing text on an SDL renderer.
Definition SDL3pp_ttf.h:5181
void SetFontDirection(FontRef font, Direction direction)
Set the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2809
void SetHinting(HintingFlags hinting)
Set a font's current hinter setting.
Definition SDL3pp_ttf.h:2372
TTF_HintingFlags HintingFlags
Hinting flags for TTF (TrueType Fonts).
Definition SDL3pp_ttf.h:259
GPUAtlasDrawSequence * GetGPUDrawData() const
Get the geometry data needed for drawing the text.
Definition SDL3pp_ttf.h:5404
void SetFontSizeDPI(FontRef font, float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition SDL3pp_ttf.h:2178
FColor GetColorFloat() const
Get the color of a text object.
Definition SDL3pp_ttf.h:5906
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:3096
Uint32 GetScript() const
Get the script used for text shaping a font.
Definition SDL3pp_ttf.h:2925
void InsertTextString(TextRef text, int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition SDL3pp_ttf.h:6145
constexpr HorizontalAlignment HORIZONTAL_ALIGN_LEFT
LEFT.
Definition SDL3pp_ttf.h:295
bool FontIsScalable(FontRef font)
Query whether a font is scalable or not.
Definition SDL3pp_ttf.h:2736
constexpr int FONT_WEIGHT_SEMI_BOLD
SemiBold (600) named font weight value.
Definition SDL3pp_ttf.h:2500
Surface RenderGlyph_LCD(FontRef 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:3772
void CloseFont(FontRaw font)
Dispose of a previously-created font.
Definition SDL3pp_ttf.h:6505
Surface RenderGlyph_Blended(FontRef font, Uint32 ch, ColorRaw fg)
Render a single UNICODE codepoint at high quality to a new ARGB surface.
Definition SDL3pp_ttf.h:3634
int GetAscent() const
Query the offset from the baseline to the top of a font.
Definition SDL3pp_ttf.h:2594
PropertiesRef GetProperties()
Get the properties associated with a font.
Definition SDL3pp_ttf.h:2004
Uint32 GetScript() const
Get the script used for text shaping a text object.
Definition SDL3pp_ttf.h:5738
void DrawRendererText(TextConstRef text, FPoint p)
Draw text to an SDL renderer.
Definition SDL3pp_ttf.h:5260
int GetFontLineSkip(FontRef font)
Query the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2649
int GetFontOutline(FontRef font)
Query a font's current outline.
Definition SDL3pp_ttf.h:2339
constexpr int FONT_WEIGHT_NORMAL
Normal (400) named font weight value.
Definition SDL3pp_ttf.h:2494
void GetStringSizeWrapped(FontRef 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:3181
int GetNumFontFaces(FontRef font)
Query the number of faces of a font.
Definition SDL3pp_ttf.h:2387
void SetFontSDF(FontRef font, bool enabled)
Enable Signed Distance Field rendering for a font.
Definition SDL3pp_ttf.h:2445
void SetTextString(TextRef text, std::string_view string)
Set the UTF-8 text used by a text object.
Definition SDL3pp_ttf.h:6113
PropertiesRef GetFontProperties(FontRef font)
Get the properties associated with a font.
Definition SDL3pp_ttf.h:1999
constexpr ImageType IMAGE_SDF
The alpha channel has signed distance field information.
Definition SDL3pp_ttf.h:343
constexpr int FONT_WEIGHT_LIGHT
Light (300) named font weight value.
Definition SDL3pp_ttf.h:2491
void Destroy() final
Destroy a text engine created for drawing text with the SDL GPU API.
Definition SDL3pp_ttf.h:5429
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_CLOCKWISE
CLOCKWISE.
Definition SDL3pp_ttf.h:3821
GPUTextEngineWinding GetGPUTextEngineWinding(TextEngineRef engine)
Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engin...
Definition SDL3pp_ttf.h:5473
TTF_HorizontalAlignment HorizontalAlignment
The horizontal alignment used when rendering wrapped text.
Definition SDL3pp_ttf.h:290
Surface RenderGlyph_Shaded(FontRef 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:3502
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:290
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:238
ResourceRef< Surface > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:54
ResourceRef< Renderer > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:75
Properties for Font creation.
Definition SDL3pp_ttf.h:1917
constexpr auto HORIZONTAL_DPI_NUMBER
Number for horizontal dpi.
Definition SDL3pp_ttf.h:1938
constexpr auto IOSTREAM_AUTOCLOSE_BOOLEAN
Enable iostream autoclose.
Definition SDL3pp_ttf.h:1928
constexpr auto FILENAME_STRING
String for filename.
Definition SDL3pp_ttf.h:1919
constexpr auto IOSTREAM_OFFSET_NUMBER
Number for iostream offset.
Definition SDL3pp_ttf.h:1925
constexpr auto VERTICAL_DPI_NUMBER
Number for vertical dpi.
Definition SDL3pp_ttf.h:1941
constexpr auto SIZE_FLOAT
Float for size.
Definition SDL3pp_ttf.h:1932
constexpr auto IOSTREAM_POINTER
Pointer to iostream.
Definition SDL3pp_ttf.h:1922
constexpr auto EXISTING_FONT_POINTER
Pointer to existing font.
Definition SDL3pp_ttf.h:1946
constexpr auto FACE_NUMBER
Number for face.
Definition SDL3pp_ttf.h:1935
Properties for Font.
Definition SDL3pp_ttf.h:1917
constexpr auto OUTLINE_MITER_LIMIT_NUMBER
Number for outline miter limit.
Definition SDL3pp_ttf.h:2027
constexpr auto OUTLINE_LINE_JOIN_NUMBER
Number for outline line join.
Definition SDL3pp_ttf.h:2024
constexpr auto OUTLINE_LINE_CAP_NUMBER
Number for outline line cap.
Definition SDL3pp_ttf.h:2021
Properties for GPUTextEngine.
Definition SDL3pp_ttf.h:5363
constexpr auto ATLAS_TEXTURE_SIZE_NUMBER
Number for atlas texture size.
Definition SDL3pp_ttf.h:5368
constexpr auto DEVICE_POINTER
Pointer to device.
Definition SDL3pp_ttf.h:5365
Properties for RendererTextEngine.
Definition SDL3pp_ttf.h:5229
constexpr auto ATLAS_TEXTURE_SIZE_NUMBER
Number for atlas texture size.
Definition SDL3pp_ttf.h:5234
constexpr auto RENDERER_POINTER
Pointer to renderer.
Definition SDL3pp_ttf.h:5231
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition SDL3pp_pixels.h:2145
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition SDL3pp_pixels.h:2318
The structure that defines a point (using floating point values).
Definition SDL3pp_rect.h:526
The internal structure containing font information.
Definition SDL3pp_ttf.h:353
Font & operator=(const Font &other)=delete
Assignment operator.
constexpr Font(Font &&other) noexcept
Move constructor.
Definition SDL3pp_ttf.h:372
~Font()
Destructor.
Definition SDL3pp_ttf.h:471
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Point GetStringSize(std::string_view text) const
Calculate the dimensions of a rendered string of UTF-8 text.
Definition SDL3pp_ttf.h:1292
constexpr Font(FontRaw resource) noexcept
Constructs from raw Font.
Definition SDL3pp_ttf.h:363
constexpr Font & operator=(Font &&other) noexcept
Assignment operator.
Definition SDL3pp_ttf.h:474
constexpr Font(const Font &other)=delete
Copy constructor.
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:1338
A GPU based text engine.
Definition SDL3pp_ttf.h:4014
The structure that defines a point (using integers).
Definition SDL3pp_rect.h:97
A renderer based text engine.
Definition SDL3pp_ttf.h:3945
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:156
A surface based text engine.
Definition SDL3pp_ttf.h:3905
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:172
A text engine used to create text objects.
Definition SDL3pp_ttf.h:3845
constexpr TextEngine(TextEngineRaw resource) noexcept
Constructs from raw TextEngine.
Definition SDL3pp_ttf.h:3855
TextEngine & operator=(const TextEngine &other)=delete
Assignment operator.
constexpr TextEngine(const TextEngine &other)=delete
Copy constructor.
virtual void Destroy()=0
frees up textEngine. Pure virtual
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
virtual ~TextEngine()
Destructor.
Definition SDL3pp_ttf.h:3870
constexpr TextEngine & operator=(TextEngine &&other) noexcept
Assignment operator.
Definition SDL3pp_ttf.h:3873
constexpr TextEngine(TextEngine &&other) noexcept
Move constructor.
Definition SDL3pp_ttf.h:3864
Text created with TextEngine.CreateText().
Definition SDL3pp_ttf.h:4157
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:5005
int GetNumLines() const
The number of lines in the text, 0 if it's empty.
Definition SDL3pp_ttf.h:5008
SubStringIterator GetSubStringForPoint(Point p) const
Get the portion of a text string that is closest to a point.
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Text & operator=(const Text &other)=delete
Assignment operator.
SubStringIterator begin() const
Get iterator to first substring.
SubStringIterator end() const
Get iterator to one past last substring.
~Text()
Destructor.
Definition SDL3pp_ttf.h:4208
OwnArray< SubString * > GetSubStrings() const
Get all substrings of a text object.
Definition SDL3pp_ttf.h:4891
constexpr Text(TextRaw resource) noexcept
Constructs from raw Text.
Definition SDL3pp_ttf.h:4167
constexpr Text & operator=(Text &&other) noexcept
Assignment operator.
Definition SDL3pp_ttf.h:4211
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:4176