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>
85#define SDL_TTF_MAJOR_VERSION
87#define SDL_TTF_MINOR_VERSION
89#define SDL_TTF_MICRO_VERSION
96#define SDL_TTF_VERSION \
98 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
103#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
104 ((SDL_TTF_MAJOR_VERSION >= X) && \
105 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
106 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || \
107 SDL_TTF_MICRO_VERSION >= Z))
122inline int Version() {
return TTF_Version(); }
161inline void Quit() { TTF_Quit(); }
185inline int WasInit() {
return TTF_WasInit(); }
206 TTF_GetFreeTypeVersion(major, minor, patch);
224 TTF_GetHarfBuzzVersion(major, minor, patch);
251 TTF_STYLE_STRIKETHROUGH;
267#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
299 TTF_HORIZONTAL_ALIGN_INVALID;
302 TTF_HORIZONTAL_ALIGN_LEFT;
305 TTF_HORIZONTAL_ALIGN_CENTER;
308 TTF_HORIZONTAL_ALIGN_RIGHT;
529 void SetSizeDPI(
float ptsize,
int hdpi,
int vdpi);
561 void GetDPI(
int* hdpi,
int* vdpi)
const;
724 void SetSDF(
bool enabled);
739#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
1137 int* advance)
const;
1192 void GetStringSize(std::string_view text,
int* w,
int* h)
const;
1273 int* measured_width,
1274 size_t* measured_length)
const;
1343 int wrapLength)
const;
1444 int wrap_width)
const;
1542 int wrap_width)
const;
1642 int wrap_width)
const;
1684 using FontBase::FontBase;
1700 :
Font(other.release())
1826 return Font(file, ptsize);
1871 return Font(src, ptsize, closeio);
1926 TTF_PROP_FONT_CREATE_FILENAME_STRING;
1929 TTF_PROP_FONT_CREATE_IOSTREAM_POINTER;
1932 TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER;
1935 TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
1939 TTF_PROP_FONT_CREATE_SIZE_FLOAT;
1942 TTF_PROP_FONT_CREATE_FACE_NUMBER;
1945 TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER;
1948 TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER;
1950#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
1953 TTF_PROP_FONT_CREATE_EXISTING_FONT;
2007 return CheckError(TTF_GetFontProperties(font));
2028 TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER;
2031 TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER;
2034 TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER;
2055 return TTF_GetFontGeneration(font);
2087 CheckError(TTF_AddFallbackFont(font, fallback));
2113 TTF_RemoveFallbackFont(font, fallback);
2186 CheckError(TTF_SetFontSizeDPI(font, ptsize, hdpi, vdpi));
2230 CheckError(TTF_GetFontDPI(font, hdpi, vdpi));
2264 TTF_SetFontStyle(font, style);
2294 return TTF_GetFontStyle(font);
2325 CheckError(TTF_SetFontOutline(font, outline));
2375 TTF_SetFontHinting(font, hinting);
2420 return TTF_GetFontHinting(font);
2474#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2492 TTF_FONT_WEIGHT_THIN;
2495 TTF_FONT_WEIGHT_EXTRA_LIGHT;
2498 TTF_FONT_WEIGHT_LIGHT;
2501 TTF_FONT_WEIGHT_NORMAL;
2504 TTF_FONT_WEIGHT_MEDIUM;
2507 TTF_FONT_WEIGHT_SEMI_BOLD;
2510 TTF_FONT_WEIGHT_BOLD;
2513 TTF_FONT_WEIGHT_EXTRA_BOLD;
2516 TTF_FONT_WEIGHT_BLACK;
2519 TTF_FONT_WEIGHT_EXTRA_BLACK;
2540 TTF_SetFontWrapAlignment(font, align);
2562 return TTF_GetFontWrapAlignment(font);
2635 TTF_SetFontLineSkip(font, lineskip);
2681 TTF_SetFontKerning(font, enabled);
2723 return TTF_FontIsFixedWidth(font);
2767 return TTF_GetFontFamilyName(font);
2793 return TTF_GetFontStyleName(font);
2820 CheckError(TTF_SetFontDirection(font, direction));
2843 return TTF_GetFontDirection(font);
2865 return TTF_StringToTag(
string);
2885 TTF_TagToString(tag,
string, size);
2979 CheckError(TTF_SetFontLanguage(font, language_bcp47));
3001 return TTF_FontHasGlyph(font, ch);
3057 CheckError(TTF_GetGlyphImageForIndex(font, glyph_index, image_type)));
3102 CheckError(TTF_GetGlyphMetrics(font, ch, minx, maxx, miny, maxy, advance));
3131 if (
int r; TTF_GetGlyphKerning(font, previous_ch, ch, &r))
return r;
3159 CheckError(TTF_GetStringSize(font, text.data(), text.size(), w, h));
3191 std::string_view text,
3197 TTF_GetStringSizeWrapped(font, text.data(), text.size(), wrap_width, w, h));
3232 std::string_view text,
3234 int* measured_width,
3235 size_t* measured_length)
3247 int* measured_width,
3248 size_t* measured_length)
const
3288 return Surface{TTF_RenderText_Solid(font, text.data(), text.size(), fg)};
3329 std::string_view text,
3333 return Surface(TTF_RenderText_Solid_Wrapped(
3334 font, text.data(), text.size(), fg, wrapLength));
3339 int wrapLength)
const
3373 return Surface(TTF_RenderGlyph_Solid(font, ch, fg));
3416 std::string_view text,
3420 return Surface(TTF_RenderText_Shaded(font, text.data(), text.size(), fg, bg));
3465 std::string_view text,
3470 return Surface(TTF_RenderText_Shaded_Wrapped(
3471 font, text.data(), text.size(), fg, bg, wrap_width));
3477 int wrap_width)
const
3516 return Surface(TTF_RenderGlyph_Shaded(font, ch, fg, bg));
3560 return Surface(TTF_RenderText_Blended(font, text.data(), text.size(), fg));
3602 std::string_view text,
3606 return Surface(TTF_RenderText_Blended_Wrapped(
3607 font, text.data(), text.size(), fg, wrap_width));
3612 int wrap_width)
const
3646 return Surface(TTF_RenderGlyph_Blended(font, ch, fg));
3687 std::string_view text,
3691 return Surface(TTF_RenderText_LCD(font, text.data(), text.size(), fg, bg));
3735 std::string_view text,
3740 return Surface(TTF_RenderText_LCD_Wrapped(
3741 font, text.data(), text.size(), fg, bg, wrap_width));
3747 int wrap_width)
const
3786 return Surface(TTF_RenderGlyph_LCD(font, ch, fg, bg));
3806 TTF_SUBSTRING_DIRECTION_MASK;
3810 TTF_SUBSTRING_TEXT_START;
3820 TTF_SUBSTRING_TEXT_END;
3830 TTF_GPU_TEXTENGINE_WINDING_INVALID;
3833 TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE;
3836 TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE;
3880 using TextEngine::TextEngine;
3944 using TextEngine::TextEngine;
4037 using TextEngine::TextEngine;
4529 void GetColorFloat(
float* r,
float* g,
float* b,
float* a)
const;
4690 void SetString(std::string_view
string);
4713 void InsertString(
int offset, std::string_view
string);
4775 void GetSize(
int* w,
int* h)
const;
5007 using TextBase::TextBase;
5023 :
Text(other.release())
5061class SubStringIterator
5076 : SubStringIterator(
TextRef{})
5081 constexpr operator bool()
const {
return bool(m_text); }
5092 return m_subString.offset == other.m_subString.offset;
5098 m_text.GetNextSubString(m_subString, &m_subString);
5106 m_text.GetNextSubString(m_subString, &m_subString);
5113 m_text.GetPreviousSubString(m_subString, &m_subString);
5121 m_text.GetPreviousSubString(m_subString, &m_subString);
5173 CheckError(TTF_DrawSurfaceText(text, p.x, p.y, surface));
5198 TTF_DestroySurfaceTextEngine(engine);
5228 :
TextEngine(TTF_CreateRendererTextEngine(renderer))
5233 :
TextEngine(TTF_CreateRendererTextEngineWithProperties(props))
5278 TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER;
5281 TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE;
5308 CheckError(TTF_DrawRendererText(text, p.x, p.y));
5333 TTF_DestroyRendererTextEngine(engine);
5363 :
TextEngine(TTF_CreateGPUTextEngine(device))
5368 :
TextEngine(TTF_CreateGPUTextEngineWithProperties(props))
5412 TTF_PROP_GPU_TEXT_ENGINE_DEVICE;
5415 TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE;
5447 return TTF_GetGPUTextDrawData(text);
5472 TTF_DestroyGPUTextEngine(engine);
5495 TTF_SetGPUTextEngineWinding(engine, winding);
5521 return TTF_GetGPUTextEngineWinding(engine);
5548 std::string_view text)
5550 return Text(engine, font, text);
5555 return Text(
get(), font, text);
5559 :
Text(TTF_CreateText(engine, font, text.data(), text.size()))
5577 return {
CheckError(TTF_GetTextProperties(text))};
5658 return TTF_SetTextFont(text, font);
5704 CheckError(TTF_SetTextDirection(text, direction));
5727 return TTF_GetTextDirection(text);
5781 return TTF_GetTextScript(text);
5805 CheckError(TTF_SetTextColor(text, c.r, c.g, c.b, c.a));
5829 CheckError(TTF_SetTextColorFloat(text, c.r, c.g, c.b, c.a));
5862 CheckError(TTF_GetTextColor(text, r, g, b, a));
5922 CheckError(TTF_GetTextColorFloat(text, r, g, b, a));
5981 CheckError(TTF_SetTextPosition(text, p.x, p.y));
6059 CheckError(TTF_SetTextWrapWidth(text, wrap_width));
6113 CheckError(TTF_SetTextWrapWhitespaceVisible(text, visible));
6136 return TTF_TextWrapWhitespaceVisible(text);
6164 CheckError(TTF_SetTextString(text,
string.data(),
string.size()));
6196 CheckError(TTF_InsertTextString(text, offset,
string.data(),
string.size()));
6224 CheckError(TTF_AppendTextString(text,
string.data(),
string.size()));
6257 CheckError(TTF_DeleteTextString(text, offset, length));
6340 CheckError(TTF_GetTextSubString(text, offset, substring));
6371 CheckError(TTF_GetTextSubStringForLine(text, line, substring));
6399 auto data = TTF_GetTextSubStringsForRange(text, offset, length, &count);
6430 CheckError(TTF_GetTextSubStringForPoint(text, p.x, p.y, substring));
6459 CheckError(TTF_GetPreviousTextSubString(text, &substring, previous));
6488 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 release() noexcept
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Const reference wrapper for a given resource,.
Definition SDL3pp_resource.h:115
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:58
Iterator for substrings.
Definition SDL3pp_ttf.h:5062
SubStringIterator()
Default constructor.
Definition SDL3pp_ttf.h:5075
SubStringIterator operator--(int)
Decrement operator.
Definition SDL3pp_ttf.h:5118
constexpr const SubString & operator*() const
Retrieve SubString.
Definition SDL3pp_ttf.h:5084
constexpr const SubString * operator->() const
Retrieve SubString.
Definition SDL3pp_ttf.h:5087
SubStringIterator & operator--()
Decrement operator.
Definition SDL3pp_ttf.h:5111
constexpr bool operator==(const SubStringIterator &other) const
Comparison.
Definition SDL3pp_ttf.h:5090
SubStringIterator & operator++()
Increment operator.
Definition SDL3pp_ttf.h:5096
SubStringIterator operator++(int)
Increment operator.
Definition SDL3pp_ttf.h:5103
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
ResourceRefT< GPUDeviceBase > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:387
ResourceRefT< IOStreamBase > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:37
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
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:55
SDL_Point PointRaw
Alias to raw representation for Point.
Definition SDL3pp_rect.h:22
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:3157
TTF_ImageType ImageType
The type of data in a glyph image.
Definition SDL3pp_ttf.h:338
void SetHinting(HintingFlags hinting)
Set a font's current hinter setting.
Definition SDL3pp_ttf.h:2378
constexpr FontStyleFlags STYLE_NORMAL
No special style.
Definition SDL3pp_ttf.h:241
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:3610
void Destroy()
Destroy a text object created by a text engine.
Definition SDL3pp_ttf.h:6530
void SetTextPosition(TextRef text, const PointRaw &p)
Set the position of a text object.
Definition SDL3pp_ttf.h:5979
Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition SDL3pp_ttf.h:2950
constexpr SubStringFlags SUBSTRING_LINE_END
This substring contains the end of line line_index.
Definition SDL3pp_ttf.h:3817
constexpr HintingFlags HINTING_LIGHT
Light hinting applies subtle adjustments to improve rendering.
Definition SDL3pp_ttf.h:277
FontStyleFlags GetFontStyle(FontRef font)
Query a font's current style.
Definition SDL3pp_ttf.h:2292
bool IsWrapWhitespaceVisible() const
Return whether whitespace is shown when wrapping a text object.
Definition SDL3pp_ttf.h:6139
bool GetFontKerning(FontRef font)
Query whether or not kerning is enabled for a font.
Definition SDL3pp_ttf.h:2701
constexpr HorizontalAlignment HORIZONTAL_ALIGN_CENTER
CENTER.
Definition SDL3pp_ttf.h:304
ResourceRefT< TextEngine > TextEngineRef
Reference for TextEngine.
Definition SDL3pp_ttf.h:54
void GetPreviousTextSubString(TextConstRef text, const SubString &substring, SubString *previous)
Get the previous substring in a text object.
Definition SDL3pp_ttf.h:6455
PropertiesRef GetTextProperties(TextConstRef text)
Get the properties associated with a text object.
Definition SDL3pp_ttf.h:5575
void SetTextScript(TextRef text, Uint32 script)
Set the script to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5752
Font OpenFontIO(IOStreamRef src, float ptsize, bool closeio=false)
Create a font from an IOStream, using a specified point size.
Definition SDL3pp_ttf.h:1869
TTF_Text * TextRaw
Alias to raw representation for Text.
Definition SDL3pp_ttf.h:63
int GetFontDescent(FontRef font)
Query the offset from the baseline to the bottom of a font.
Definition SDL3pp_ttf.h:2614
constexpr HorizontalAlignment HORIZONTAL_ALIGN_RIGHT
RIGHT.
Definition SDL3pp_ttf.h:307
TTF_GPUTextEngineWinding GPUTextEngineWinding
The winding order of the vertices returned by GetGPUTextDrawData.
Definition SDL3pp_ttf.h:3827
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:3423
void SetWrapWidth(int wrap_width)
Set whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6062
int GetFontWeight(FontRef font)
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition SDL3pp_ttf.h:2487
void SetTextWrapWhitespaceVisible(TextRef text, bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition SDL3pp_ttf.h:6111
void SetFontLanguage(FontRef font, StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2977
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE
COUNTER_CLOCKWISE.
Definition SDL3pp_ttf.h:3835
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:3328
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:3231
FontRef GetFont() const
Get the font used by a text object.
Definition SDL3pp_ttf.h:5685
const TTF_Text * TextRawConst
Alias to const raw representation for Text.
Definition SDL3pp_ttf.h:66
void GetDPI(int *hdpi, int *vdpi) const
Get font target resolutions, in dots per inch.
Definition SDL3pp_ttf.h:2233
void SetFontStyle(FontRef font, FontStyleFlags style)
Set a font's current style.
Definition SDL3pp_ttf.h:2262
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:3734
GPUTextEngine CreateGPUTextEngineWithProperties(PropertiesRef props)
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
Definition SDL3pp_ttf.h:5396
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:3563
void GetTextColorFloat(TextConstRef text, float *r, float *g, float *b, float *a)
Get the color of a text object.
Definition SDL3pp_ttf.h:5916
TTF_Direction Direction
Direction flags.
Definition SDL3pp_ttf.h:321
constexpr SubStringFlags SUBSTRING_TEXT_START
This substring contains the beginning of the text.
Definition SDL3pp_ttf.h:3809
void SetTextDirection(TextRef text, Direction direction)
Set the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5702
void SetScript(Uint32 script)
Set the script to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2912
void ClearFallbackFonts(FontRef font)
Remove all fallback fonts.
Definition SDL3pp_ttf.h:2136
void SetFontScript(FontRef font, Uint32 script)
Set the script to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2907
void Update()
Update the layout of a text object.
Definition SDL3pp_ttf.h:6514
Uint32 GetFontGeneration(FontRef font)
Get the font generation.
Definition SDL3pp_ttf.h:2053
bool GetKerning() const
Query whether or not kerning is enabled for a font.
Definition SDL3pp_ttf.h:2703
int GetDescent() const
Query the offset from the baseline to the bottom of a font.
Definition SDL3pp_ttf.h:2616
void AppendTextString(TextRef text, std::string_view string)
Append UTF-8 text to a text object.
Definition SDL3pp_ttf.h:6222
constexpr int FONT_WEIGHT_BLACK
Black (900) named font weight value.
Definition SDL3pp_ttf.h:2515
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:3519
void SetFontWrapAlignment(FontRef font, HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2538
TextEngineRef GetTextEngine(TextConstRef text)
Get the text engine used by a text object.
Definition SDL3pp_ttf.h:5625
void DestroyRendererTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on an SDL renderer.
Definition SDL3pp_ttf.h:5331
constexpr SubStringFlags SUBSTRING_LINE_START
This substring contains the beginning of line line_index.
Definition SDL3pp_ttf.h:3814
void DestroyText(TextRaw text)
Destroy a text object created by a text engine.
Definition SDL3pp_ttf.h:6528
constexpr Direction DIRECTION_LTR
Left to Right.
Definition SDL3pp_ttf.h:325
TTF_SubString SubString
The representation of a substring within text.
Definition SDL3pp_ttf.h:4179
constexpr ImageType IMAGE_COLOR
The color channels have image data.
Definition SDL3pp_ttf.h:345
Surface GetGlyphImage(FontRef font, Uint32 ch, ImageType *image_type)
Get the pixel image for a UNICODE codepoint.
Definition SDL3pp_ttf.h:3024
bool IsFixedWidth() const
Query whether a font is fixed-width.
Definition SDL3pp_ttf.h:2726
void DeleteString(int offset, int length)
Delete UTF-8 text from a text object.
Definition SDL3pp_ttf.h:6260
Point GetPosition() const
Get the position of a text object.
Definition SDL3pp_ttf.h:6038
Uint32 GetTextScript(TextConstRef text)
Get the script used for text shaping a text object.
Definition SDL3pp_ttf.h:5779
Uint32 StringToTag(StringParam string)
Convert from a 4 character string to a 32-bit tag.
Definition SDL3pp_ttf.h:2863
void DrawSurface(Point p, SurfaceRef surface) const
Draw text to an SDL surface.
Definition SDL3pp_ttf.h:5176
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:3649
Direction GetTextDirection(TextConstRef text)
Get the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5725
void SetEngine(TextEngineRef engine)
Set the text engine used by a text object.
Definition SDL3pp_ttf.h:5606
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:3686
bool SetFont(FontRef font)
Set the font used by a text object.
Definition SDL3pp_ttf.h:5661
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:6426
void UpdateText(TextRef text)
Update the layout of a text object.
Definition SDL3pp_ttf.h:6512
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:3291
void DrawSurfaceText(TextConstRef text, Point p, SurfaceRef surface)
Draw text to an SDL surface.
Definition SDL3pp_ttf.h:5171
bool SetTextFont(TextRef text, FontRef font)
Set the font used by a text object.
Definition SDL3pp_ttf.h:5656
SurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5146
void SetSizeDPI(float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition SDL3pp_ttf.h:2189
PropertiesRef GetProperties()
Get the properties associated with a font.
Definition SDL3pp_ttf.h:2010
void SetOutline(int outline)
Set a font's current outline.
Definition SDL3pp_ttf.h:2328
constexpr ImageType IMAGE_INVALID
INVALID.
Definition SDL3pp_ttf.h:340
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:5546
static Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition SDL3pp_ttf.h:2955
float GetFontSize(FontRef font)
Get the size of a font.
Definition SDL3pp_ttf.h:2209
void Destroy()
Destroy a text engine created for drawing text with the SDL GPU API.
Definition SDL3pp_ttf.h:5475
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:3415
void SetTextWrapWidth(TextRef text, int wrap_width)
Set whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6057
void RemoveFallbackFont(FontRef font, FontRef fallback)
Remove a fallback font.
Definition SDL3pp_ttf.h:2111
void GetHarfBuzzVersion(int *major, int *minor, int *patch)
Query the version of the HarfBuzz library in use.
Definition SDL3pp_ttf.h:222
Font OpenFontWithProperties(PropertiesRef props)
Create a font with the specified properties.
Definition SDL3pp_ttf.h:1916
const char * GetFontStyleName(FontRef font)
Query a font's style name.
Definition SDL3pp_ttf.h:2791
void SetWrapAlignment(HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2543
constexpr HintingFlags HINTING_INVALID
INVALID.
Definition SDL3pp_ttf.h:269
void AddFallbackFont(FontRef font, FontRef fallback)
Add a fallback font.
Definition SDL3pp_ttf.h:2085
bool FontHasGlyph(FontRef font, Uint32 ch)
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition SDL3pp_ttf.h:2999
GPUAtlasDrawSequence * GetGPUTextDrawData(TextConstRef text)
Get the geometry data needed for drawing the text.
Definition SDL3pp_ttf.h:5445
void DestroySurfaceTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5196
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:6403
constexpr int FONT_WEIGHT_EXTRA_LIGHT
ExtraLight (200) named font weight value.
Definition SDL3pp_ttf.h:2494
TTF_GPUAtlasDrawSequence GPUAtlasDrawSequence
Draw sequence returned by GetGPUTextDrawData.
Definition SDL3pp_ttf.h:4165
Surface GetGlyphImageForIndex(FontRef font, Uint32 glyph_index, ImageType *image_type)
Get the pixel image for a character index.
Definition SDL3pp_ttf.h:3052
void SetGPUWinding(GPUTextEngineWinding winding)
Sets the winding order of the vertices returned by GetGPUTextDrawData for a particular GPU text engin...
Definition SDL3pp_ttf.h:5498
bool FontIsFixedWidth(FontRef font)
Query whether a font is fixed-width.
Definition SDL3pp_ttf.h:2721
Uint32 FontStyleFlags
Font style flags for Font.
Definition SDL3pp_ttf.h:239
int GetWrapWidth() const
Get whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6089
int GetLineSkip() const
Query the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2657
bool TextWrapWhitespaceVisible(TextConstRef text)
Return whether whitespace is shown when wrapping a text object.
Definition SDL3pp_ttf.h:6134
int GetFontAscent(FontRef font)
Query the offset from the baseline to the top of a font.
Definition SDL3pp_ttf.h:2598
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:3094
bool HasGlyph(Uint32 ch) const
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition SDL3pp_ttf.h:3004
void SetTextColor(TextRef text, Color c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5803
Surface GetGlyphImageForIndex(Uint32 glyph_index, ImageType *image_type) const
Get the pixel image for a character index.
Definition SDL3pp_ttf.h:3060
void SetSize(float ptsize)
Set a font's size dynamically.
Definition SDL3pp_ttf.h:2162
Uint32 GetGeneration() const
Get the font generation.
Definition SDL3pp_ttf.h:2058
Uint32 SubStringFlags
Flags for SubString.
Definition SDL3pp_ttf.h:3803
void SetFontLineSkip(FontRef font, int lineskip)
Set the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2633
void Destroy()
Destroy a text engine created for drawing text on an SDL renderer.
Definition SDL3pp_ttf.h:5336
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:3464
void SetScript(Uint32 script)
Set the script to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5757
void GetPreviousSubString(const SubString &substring, SubString *previous) const
Get the previous substring in a text object.
Definition SDL3pp_ttf.h:6462
constexpr Direction DIRECTION_BTT
Bottom to Top.
Definition SDL3pp_ttf.h:331
constexpr HintingFlags HINTING_MONO
Monochrome hinting adjusts the font for better rendering at lower resolutions.
Definition SDL3pp_ttf.h:283
HorizontalAlignment GetWrapAlignment() const
Query a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2565
int GetWeight() const
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition SDL3pp_ttf.h:2489
FontRef GetTextFont(TextConstRef text)
Get the font used by a text object.
Definition SDL3pp_ttf.h:5680
constexpr int FONT_WEIGHT_EXTRA_BOLD
ExtraBold (800) named font weight value.
Definition SDL3pp_ttf.h:2512
void GetNextSubString(const SubString &substring, SubString *next) const
Get the next substring in a text object.
Definition SDL3pp_ttf.h:6491
void GetFontDPI(FontRef font, int *hdpi, int *vdpi)
Get font target resolutions, in dots per inch.
Definition SDL3pp_ttf.h:2228
int GetNumFaces() const
Query the number of faces of a font.
Definition SDL3pp_ttf.h:2395
constexpr FontStyleFlags STYLE_ITALIC
Italic style.
Definition SDL3pp_ttf.h:245
Direction GetFontDirection(FontRef font)
Get the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2841
void SetColorFloat(FColor c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5832
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:3105
GPUAtlasDrawSequence * GetGPUDrawData() const
Get the geometry data needed for drawing the text.
Definition SDL3pp_ttf.h:5450
HorizontalAlignment GetFontWrapAlignment(FontRef font)
Query a font's current wrap alignment option.
Definition SDL3pp_ttf.h:2560
bool GetSDF() const
Query whether Signed Distance Field rendering is enabled for a font.
Definition SDL3pp_ttf.h:2472
void AppendString(std::string_view string)
Append UTF-8 text to a text object.
Definition SDL3pp_ttf.h:6227
void GetSubString(int offset, SubString *substring) const
Get the substring of a text object that surrounds a text offset.
Definition SDL3pp_ttf.h:6343
GPUTextEngine CreateGPUTextEngine(GPUDeviceRef device)
Create a text engine for drawing text with the SDL GPU API.
Definition SDL3pp_ttf.h:5357
void SetDirection(Direction direction)
Set the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2823
void GetFreeTypeVersion(int *major, int *minor, int *patch)
Query the version of the FreeType library in use.
Definition SDL3pp_ttf.h:204
void TagToString(Uint32 tag, char *string, size_t size)
Convert from a 32-bit tag to a 4 character string.
Definition SDL3pp_ttf.h:2883
bool GetFontSDF(FontRef font)
Query whether Signed Distance Field rendering is enabled for a font.
Definition SDL3pp_ttf.h:2470
void GetTextSubStringForLine(TextConstRef text, int line, SubString *substring)
Get the substring of a text object that contains the given line.
Definition SDL3pp_ttf.h:6367
constexpr FontStyleFlags STYLE_BOLD
Bold style.
Definition SDL3pp_ttf.h:243
constexpr FontStyleFlags STYLE_STRIKETHROUGH
Strikethrough text.
Definition SDL3pp_ttf.h:250
constexpr int FONT_WEIGHT_THIN
Thin (100) named font weight value.
Definition SDL3pp_ttf.h:2491
void SetTextEngine(TextRef text, TextEngineRef engine)
Set the text engine used by a text object.
Definition SDL3pp_ttf.h:5601
Font Copy() const
Create a copy of an existing font.
Definition SDL3pp_ttf.h:1983
void SetStyle(FontStyleFlags style)
Set a font's current style.
Definition SDL3pp_ttf.h:2267
void SetLanguage(StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2982
const char * GetStyleName() const
Query a font's style name.
Definition SDL3pp_ttf.h:2796
Direction GetDirection() const
Get the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5730
void AddFallback(FontRef fallback)
Add a fallback font.
Definition SDL3pp_ttf.h:2090
TTF_TextEngine * TextEngineRaw
Alias to raw representation for TextEngine.
Definition SDL3pp_ttf.h:47
constexpr Direction DIRECTION_RTL
Right to Left.
Definition SDL3pp_ttf.h:327
const char * GetFontFamilyName(FontRef font)
Query a font's family name.
Definition SDL3pp_ttf.h:2765
HintingFlags GetFontHinting(FontRef font)
Query a font's current FreeType hinter setting.
Definition SDL3pp_ttf.h:2418
GPUTextEngineWinding GetGPUWinding() const
Get the winding order of the vertices returned by GetGPUTextDrawData for a particular GPU text engine...
Definition SDL3pp_ttf.h:5524
int GetAscent() const
Query the offset from the baseline to the top of a font.
Definition SDL3pp_ttf.h:2600
bool IsScalable() const
Query whether a font is scalable or not.
Definition SDL3pp_ttf.h:2747
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:3245
TextEngineRef GetEngine() const
Get the text engine used by a text object.
Definition SDL3pp_ttf.h:5630
Font CopyFont(FontRef existing_font)
Create a copy of an existing font.
Definition SDL3pp_ttf.h:1978
TTF_TextData TextData
Internal data for Text.
Definition SDL3pp_ttf.h:4189
int GetOutline() const
Query a font's current outline.
Definition SDL3pp_ttf.h:2347
void InsertString(int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition SDL3pp_ttf.h:6199
Color GetColor() const
Get the color of a text object.
Definition SDL3pp_ttf.h:5892
constexpr HintingFlags HINTING_NORMAL
Normal hinting applies standard grid-fitting.
Definition SDL3pp_ttf.h:273
constexpr HorizontalAlignment HORIZONTAL_ALIGN_INVALID
INVALID.
Definition SDL3pp_ttf.h:298
void SetKerning(bool enabled)
Set if kerning is enabled for a font.
Definition SDL3pp_ttf.h:2684
void SetFontSize(FontRef font, float ptsize)
Set a font's size dynamically.
Definition SDL3pp_ttf.h:2157
RendererTextEngine CreateRendererTextEngine(RendererRef renderer)
Create a text engine for drawing text on an SDL renderer.
Definition SDL3pp_ttf.h:5222
constexpr Direction DIRECTION_INVALID
INVALID.
Definition SDL3pp_ttf.h:323
constexpr HintingFlags HINTING_NONE
No hinting, the font is rendered without any grid-fitting.
Definition SDL3pp_ttf.h:286
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:3558
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:5492
constexpr int FONT_WEIGHT_BOLD
Bold (700) named font weight value.
Definition SDL3pp_ttf.h:2509
Point GetSize() const
Get the size of a text object.
Definition SDL3pp_ttf.h:6314
constexpr ImageType IMAGE_ALPHA
The color channels are white.
Definition SDL3pp_ttf.h:342
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:3337
void SetFontOutline(FontRef font, int outline)
Set a font's current outline.
Definition SDL3pp_ttf.h:2323
void DeleteTextString(TextRef text, int offset, int length)
Delete UTF-8 text from a text object.
Definition SDL3pp_ttf.h:6255
void Destroy()
Destroy a text engine created for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5201
constexpr int FONT_WEIGHT_MEDIUM
Medium (500) named font weight value.
Definition SDL3pp_ttf.h:2503
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:3371
PropertiesRef GetProperties() const
Get the properties associated with a text object.
Definition SDL3pp_ttf.h:5580
TTF_Font * FontRaw
Alias to raw representation for Font.
Definition SDL3pp_ttf.h:34
float GetSize() const
Get the size of a font.
Definition SDL3pp_ttf.h:2211
void SetLineSkip(int lineskip)
Set the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2638
int GetGlyphKerning(FontRef font, Uint32 previous_ch, Uint32 ch)
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition SDL3pp_ttf.h:3129
const char * GetFamilyName() const
Query a font's family name.
Definition SDL3pp_ttf.h:2770
RendererTextEngine CreateRendererTextEngineWithProperties(PropertiesRef props)
Create a text engine for drawing text on an SDL renderer, with the specified properties.
Definition SDL3pp_ttf.h:5261
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_INVALID
INVALID.
Definition SDL3pp_ttf.h:3829
void SetFontKerning(FontRef font, bool enabled)
Set if kerning is enabled for a font.
Definition SDL3pp_ttf.h:2679
void ClearFallbacks()
Remove all fallback fonts.
Definition SDL3pp_ttf.h:2138
int GetHeight() const
Query the total height of a font.
Definition SDL3pp_ttf.h:2584
void SetTextColorFloat(TextRef text, FColor c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5827
void DestroyGPUTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text with the SDL GPU API.
Definition SDL3pp_ttf.h:5470
void Close()
Dispose of a previously-created font.
Definition SDL3pp_ttf.h:6556
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:6394
void GetNextTextSubString(TextConstRef text, const SubString &substring, SubString *next)
Get the next substring in a text object.
Definition SDL3pp_ttf.h:6484
void SetFontHinting(FontRef font, HintingFlags hinting)
Set a font's current hinter setting.
Definition SDL3pp_ttf.h:2373
FontStyleFlags GetStyle() const
Query a font's current style.
Definition SDL3pp_ttf.h:2297
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:3376
void SetDirection(Direction direction)
Set the direction to be used for text shaping a text object.
Definition SDL3pp_ttf.h:5707
void SetColor(Color c)
Set the color of a text object.
Definition SDL3pp_ttf.h:5808
Uint32 GetScript() const
Get the script used for text shaping a text object.
Definition SDL3pp_ttf.h:5784
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:3601
constexpr FontStyleFlags STYLE_UNDERLINE
Underlined text.
Definition SDL3pp_ttf.h:247
constexpr int FONT_WEIGHT_EXTRA_BLACK
ExtraBlack (950) named font weight value.
Definition SDL3pp_ttf.h:2518
void GetTextPosition(TextConstRef text, int *x, int *y)
Get the position of a text object.
Definition SDL3pp_ttf.h:6006
constexpr SubStringFlags SUBSTRING_TEXT_END
This substring contains the end of the text.
Definition SDL3pp_ttf.h:3819
void RemoveFallback(FontRef fallback)
Remove a fallback font.
Definition SDL3pp_ttf.h:2116
void GetTextSize(TextConstRef text, int *w, int *h)
Get the size of a text object.
Definition SDL3pp_ttf.h:6282
void GetTextSubString(TextConstRef text, int offset, SubString *substring)
Get the substring of a text object that surrounds a text offset.
Definition SDL3pp_ttf.h:6336
constexpr SubStringFlags SUBSTRING_DIRECTION_MASK
The mask for the flow direction for this substring.
Definition SDL3pp_ttf.h:3805
Surface GetGlyphImage(Uint32 ch, ImageType *image_type) const
Get the pixel image for a UNICODE codepoint.
Definition SDL3pp_ttf.h:3029
void GetTextColor(TextConstRef text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color of a text object.
Definition SDL3pp_ttf.h:5856
int GetTextWrapWidth(TextConstRef text)
Get whether wrapping is enabled on a text object.
Definition SDL3pp_ttf.h:6082
ResourceConstRef< TextRaw, TextRawConst > TextConstRef
Safely wrap Text for non owning const parameters.
Definition SDL3pp_ttf.h:76
constexpr Direction DIRECTION_TTB
Top to Bottom.
Definition SDL3pp_ttf.h:329
int GetFontHeight(FontRef font)
Query the total height of a font.
Definition SDL3pp_ttf.h:2582
Text CreateText(FontRef font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition SDL3pp_ttf.h:5553
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:3694
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:3286
Uint32 GetScript() const
Get the script used for text shaping a font.
Definition SDL3pp_ttf.h:2934
void SetString(std::string_view string)
Set the UTF-8 text used by a text object.
Definition SDL3pp_ttf.h:6167
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:3789
constexpr HintingFlags HINTING_LIGHT_SUBPIXEL
Light hinting with subpixel rendering for more precise font edges.
Definition SDL3pp_ttf.h:289
ResourceRefT< TextBase > TextRef
Reference for Text.
Definition SDL3pp_ttf.h:73
SurfaceTextEngine CreateSurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition SDL3pp_ttf.h:5141
Font OpenFont(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition SDL3pp_ttf.h:1824
void SetSDF(bool enabled)
Enable Signed Distance Field rendering for a font.
Definition SDL3pp_ttf.h:2456
Uint32 GetFontScript(FontRef font)
Get the script used for text shaping a font.
Definition SDL3pp_ttf.h:2932
Direction GetDirection() const
Get the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2846
void SetFontDirection(FontRef font, Direction direction)
Set the direction to be used for text shaping by a font.
Definition SDL3pp_ttf.h:2818
void SetWrapWhitespaceVisible(bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition SDL3pp_ttf.h:6116
TTF_HintingFlags HintingFlags
Hinting flags for TTF (TrueType Fonts).
Definition SDL3pp_ttf.h:265
void SetPosition(const PointRaw &p)
Set the position of a text object.
Definition SDL3pp_ttf.h:5984
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:2184
int GetGlyphKerning(Uint32 previous_ch, Uint32 ch) const
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition SDL3pp_ttf.h:3135
void InsertTextString(TextRef text, int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition SDL3pp_ttf.h:6194
constexpr HorizontalAlignment HORIZONTAL_ALIGN_LEFT
LEFT.
Definition SDL3pp_ttf.h:301
bool FontIsScalable(FontRef font)
Query whether a font is scalable or not.
Definition SDL3pp_ttf.h:2745
constexpr int FONT_WEIGHT_SEMI_BOLD
SemiBold (600) named font weight value.
Definition SDL3pp_ttf.h:2506
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:3744
FColor GetColorFloat() const
Get the color of a text object.
Definition SDL3pp_ttf.h:5955
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:3781
HintingFlags GetHinting() const
Query a font's current FreeType hinter setting.
Definition SDL3pp_ttf.h:2423
void CloseFont(FontRaw font)
Dispose of a previously-created font.
Definition SDL3pp_ttf.h:6554
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:3644
ResourceRefT< FontBase > FontRef
Reference for Font.
Definition SDL3pp_ttf.h:41
void DrawRendererText(TextConstRef text, FPoint p)
Draw text to an SDL renderer.
Definition SDL3pp_ttf.h:5306
int GetFontLineSkip(FontRef font)
Query the spacing between lines of text for a font.
Definition SDL3pp_ttf.h:2655
int GetFontOutline(FontRef font)
Query a font's current outline.
Definition SDL3pp_ttf.h:2345
constexpr int FONT_WEIGHT_NORMAL
Normal (400) named font weight value.
Definition SDL3pp_ttf.h:2500
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:3190
int GetNumFontFaces(FontRef font)
Query the number of faces of a font.
Definition SDL3pp_ttf.h:2393
void SetFontSDF(FontRef font, bool enabled)
Enable Signed Distance Field rendering for a font.
Definition SDL3pp_ttf.h:2451
void SetTextString(TextRef text, std::string_view string)
Set the UTF-8 text used by a text object.
Definition SDL3pp_ttf.h:6162
PropertiesRef GetFontProperties(FontRef font)
Get the properties associated with a font.
Definition SDL3pp_ttf.h:2005
constexpr ImageType IMAGE_SDF
The alpha channel has signed distance field information.
Definition SDL3pp_ttf.h:349
constexpr int FONT_WEIGHT_LIGHT
Light (300) 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:3474
void DrawRenderer(FPoint p) const
Draw text to an SDL renderer.
Definition SDL3pp_ttf.h:5311
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_CLOCKWISE
CLOCKWISE.
Definition SDL3pp_ttf.h:3832
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:5519
TTF_HorizontalAlignment HorizontalAlignment
The horizontal alignment used when rendering wrapped text.
Definition SDL3pp_ttf.h:296
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:3511
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:296
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:244
ResourceRefT< SurfaceBase > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:57
ResourceRefT< RendererBase > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:86
Properties for Font creation.
Definition SDL3pp_ttf.h:1923
constexpr auto HORIZONTAL_DPI_NUMBER
Number for horizontal dpi.
Definition SDL3pp_ttf.h:1944
constexpr auto IOSTREAM_AUTOCLOSE_BOOLEAN
Enable iostream autoclose.
Definition SDL3pp_ttf.h:1934
constexpr auto FILENAME_STRING
String for filename.
Definition SDL3pp_ttf.h:1925
constexpr auto IOSTREAM_OFFSET_NUMBER
Number for iostream offset.
Definition SDL3pp_ttf.h:1931
constexpr auto VERTICAL_DPI_NUMBER
Number for vertical dpi.
Definition SDL3pp_ttf.h:1947
constexpr auto SIZE_FLOAT
Float for size.
Definition SDL3pp_ttf.h:1938
constexpr auto IOSTREAM_POINTER
Pointer to iostream.
Definition SDL3pp_ttf.h:1928
constexpr auto EXISTING_FONT_POINTER
Pointer to existing font.
Definition SDL3pp_ttf.h:1952
constexpr auto FACE_NUMBER
Number for face.
Definition SDL3pp_ttf.h:1941
Properties for Font.
Definition SDL3pp_ttf.h:1923
constexpr auto OUTLINE_MITER_LIMIT_NUMBER
Number for outline miter limit.
Definition SDL3pp_ttf.h:2033
constexpr auto OUTLINE_LINE_JOIN_NUMBER
Number for outline line join.
Definition SDL3pp_ttf.h:2030
constexpr auto OUTLINE_LINE_CAP_NUMBER
Number for outline line cap.
Definition SDL3pp_ttf.h:2027
Properties for GPUTextEngine.
Definition SDL3pp_ttf.h:5409
constexpr auto ATLAS_TEXTURE_SIZE_NUMBER
Number for atlas texture size.
Definition SDL3pp_ttf.h:5414
constexpr auto DEVICE_POINTER
Pointer to device.
Definition SDL3pp_ttf.h:5411
Properties for RendererTextEngine.
Definition SDL3pp_ttf.h:5275
constexpr auto ATLAS_TEXTURE_SIZE_NUMBER
Number for atlas texture size.
Definition SDL3pp_ttf.h:5280
constexpr auto RENDERER_POINTER
Pointer to renderer.
Definition SDL3pp_ttf.h:5277
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition SDL3pp_pixels.h:2121
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition SDL3pp_pixels.h:2294
The structure that defines a point (using floating point values).
Definition SDL3pp_rect.h:422
Base class to Font.
Definition SDL3pp_ttf.h:357
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:1215
Point GetStringSize(std::string_view text) const
Calculate the dimensions of a rendered string of UTF-8 text.
Definition SDL3pp_ttf.h:1169
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
The internal structure containing font information.
Definition SDL3pp_ttf.h:1683
constexpr Font(Font &&other) noexcept
Move constructor.
Definition SDL3pp_ttf.h:1699
~Font()
Destructor.
Definition SDL3pp_ttf.h:1794
constexpr Font(FontRaw resource) noexcept
Constructs from raw Font.
Definition SDL3pp_ttf.h:1693
constexpr Font & operator=(Font &&other) noexcept
Assignment operator.
Definition SDL3pp_ttf.h:1797
A GPU based text engine.
Definition SDL3pp_ttf.h:4036
~GPUTextEngine()
Destructor.
Definition SDL3pp_ttf.h:4109
constexpr GPUTextEngine & operator=(GPUTextEngine &&other) noexcept
Move assignment operator.
Definition SDL3pp_ttf.h:4058
constexpr GPUTextEngine(GPUTextEngine &&other) noexcept
Move constructor.
Definition SDL3pp_ttf.h:4052
constexpr GPUTextEngine(TextEngineRaw resource) noexcept
Constructs from raw TextEngine.
Definition SDL3pp_ttf.h:4046
The structure that defines a point (using integers).
Definition SDL3pp_rect.h:97
A renderer based text engine.
Definition SDL3pp_ttf.h:3943
constexpr RendererTextEngine & operator=(RendererTextEngine &&other) noexcept
Move assignment operator.
Definition SDL3pp_ttf.h:3965
constexpr RendererTextEngine(TextEngineRaw resource) noexcept
Constructs from raw TextEngine.
Definition SDL3pp_ttf.h:3953
constexpr RendererTextEngine(RendererTextEngine &&other) noexcept
Move constructor.
Definition SDL3pp_ttf.h:3959
~RendererTextEngine()
Destructor.
Definition SDL3pp_ttf.h:4016
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
A surface based text engine.
Definition SDL3pp_ttf.h:3879
constexpr SurfaceTextEngine(SurfaceTextEngine &&other) noexcept
Move constructor.
Definition SDL3pp_ttf.h:3895
constexpr SurfaceTextEngine(TextEngineRaw resource) noexcept
Constructs from raw TextEngine.
Definition SDL3pp_ttf.h:3889
constexpr SurfaceTextEngine & operator=(SurfaceTextEngine &&other) noexcept
Move assignment operator.
Definition SDL3pp_ttf.h:3901
~SurfaceTextEngine()
Destructor.
Definition SDL3pp_ttf.h:3923
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:1677
Base class to Text.
Definition SDL3pp_ttf.h:4197
OwnArray< SubString * > GetSubStrings() const
Get all substrings of a text object.
Definition SDL3pp_ttf.h:4874
int GetNumLines() const
The number of lines in the text, 0 if it's empty.
Definition SDL3pp_ttf.h:4991
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:4988
SubStringIterator begin() const
Get iterator to first substring.
SubStringIterator GetSubStringForLine(int line) const
Get iterator to substring of a text object that contains the given line.
SubStringIterator GetSubStringForPoint(Point p) const
Get the portion of a text string that is closest to a point.
SubStringIterator end() const
Get iterator to one past last substring.
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
A text engine used to create text objects.
Definition SDL3pp_ttf.h:3856
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Text created with CreateText().
Definition SDL3pp_ttf.h:5006
~Text()
Destructor.
Definition SDL3pp_ttf.h:5047
constexpr Text(TextRaw resource) noexcept
Constructs from raw Text.
Definition SDL3pp_ttf.h:5016
constexpr Text & operator=(Text &&other) noexcept
Assignment operator.
Definition SDL3pp_ttf.h:5050
constexpr Text(Text &&other) noexcept
Move constructor.
Definition SDL3pp_ttf.h:5022