5#include "SDL3pp_render.h"
6#include "SDL3pp_surface.h"
7#include "SDL3pp_version.h"
8#include "SDL3pp_video.h"
10#if !defined(SDL3PP_DISABLE_TTF) && !defined(SDL3PP_ENABLE_TTF) && \
11 __has_include(<SDL3_ttf/SDL_ttf.h>)
12#define SDL3PP_ENABLE_TTF
15#if defined(SDL3PP_ENABLE_TTF) || defined(SDL3PP_DOC)
17#include <SDL3_ttf/SDL_ttf.h>
59 constexpr explicit operator bool()
const {
return !!
value; }
92 constexpr explicit operator bool()
const {
return !!
value; }
128 constexpr explicit operator bool()
const {
return !!
value; }
144#define SDL_TTF_MAJOR_VERSION
146#define SDL_TTF_MINOR_VERSION
148#define SDL_TTF_MICRO_VERSION
155#define SDL_TTF_VERSION \
157 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
162#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
163 ((SDL_TTF_MAJOR_VERSION >= X) && \
164 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
165 (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || \
166 SDL_TTF_MICRO_VERSION >= Z))
181inline int Version() {
return TTF_Version(); }
220inline void Quit() { TTF_Quit(); }
244inline int WasInit() {
return TTF_WasInit(); }
265 TTF_GetFreeTypeVersion(major, minor, patch);
283 TTF_GetHarfBuzzVersion(major, minor, patch);
313 TTF_STYLE_STRIKETHROUGH;
357 TTF_HORIZONTAL_ALIGN_INVALID;
360 TTF_HORIZONTAL_ALIGN_LEFT;
363 TTF_HORIZONTAL_ALIGN_CENTER;
366 TTF_HORIZONTAL_ALIGN_RIGHT;
432 : m_resource(resource)
468 : m_resource(
CheckError(TTF_OpenFont(file, ptsize)))
496 : m_resource(
CheckError(TTF_OpenFontIO(src, closeio, ptsize)))
544 : m_resource(
CheckError(TTF_OpenFontWithProperties(props)))
549 ~Font() { TTF_CloseFont(m_resource); }
554 std::swap(m_resource, other.m_resource);
565 m_resource =
nullptr;
573 constexpr bool operator==(std::nullptr_t _)
const {
return !m_resource; }
576 constexpr explicit operator bool()
const {
return !!m_resource; }
579 constexpr operator FontParam()
const {
return {m_resource}; }
753 void SetSizeDPI(
float ptsize,
int hdpi,
int vdpi);
785 void GetDPI(
int* hdpi,
int* vdpi)
const;
948 void SetSDF(
bool enabled);
963#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
1362 int* advance)
const;
1417 void GetStringSize(std::string_view text,
int* w,
int* h)
const;
1498 int* measured_width,
1499 size_t* measured_length)
const;
1568 int wrapLength)
const;
1669 int wrap_width)
const;
1767 int wrap_width)
const;
1867 int wrap_width)
const;
1911 :
Font(resource.value)
1935 TTF_SUBSTRING_DIRECTION_MASK;
1939 TTF_SUBSTRING_TEXT_START;
1949 TTF_SUBSTRING_TEXT_END;
1959 TTF_GPU_TEXTENGINE_WINDING_INVALID;
1962 TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE;
1965 TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE;
1988 : m_resource(resource)
2007 std::swap(m_resource, other.m_resource);
2020 auto r = m_resource;
2021 m_resource =
nullptr;
2029 constexpr bool operator==(std::nullptr_t _)
const {
return !m_resource; }
2032 constexpr explicit operator bool()
const {
return !!m_resource; }
2118 :
TextEngine(TTF_CreateRendererTextEngine(renderer))
2147 :
TextEngine(TTF_CreateRendererTextEngineWithProperties(props))
2190 :
TextEngine(TTF_CreateGPUTextEngine(device))
2219 :
TextEngine(TTF_CreateGPUTextEngineWithProperties(props))
2320 return Font(std::move(file), ptsize);
2350 return Font(src, ptsize, closeio);
2401namespace prop::Font {
2403constexpr auto CREATE_FILENAME_STRING = TTF_PROP_FONT_CREATE_FILENAME_STRING;
2405constexpr auto CREATE_IOSTREAM_POINTER = TTF_PROP_FONT_CREATE_IOSTREAM_POINTER;
2407constexpr auto CREATE_IOSTREAM_OFFSET_NUMBER =
2408 TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER;
2410constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
2411 TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
2413constexpr auto CREATE_SIZE_FLOAT = TTF_PROP_FONT_CREATE_SIZE_FLOAT;
2415constexpr auto CREATE_FACE_NUMBER = TTF_PROP_FONT_CREATE_FACE_NUMBER;
2417constexpr auto CREATE_HORIZONTAL_DPI_NUMBER =
2418 TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER;
2420constexpr auto CREATE_VERTICAL_DPI_NUMBER =
2421 TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER;
2423constexpr auto CREATE_EXISTING_FONT_POINTER =
2424 TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER;
2426constexpr auto OUTLINE_LINE_CAP_NUMBER = TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER;
2428constexpr auto OUTLINE_LINE_JOIN_NUMBER =
2429 TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER;
2431constexpr auto OUTLINE_MITER_LIMIT_NUMBER =
2432 TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER;
2486 return {
CheckError(TTF_GetFontProperties(font))};
2511 return TTF_GetFontGeneration(font);
2543 CheckError(TTF_AddFallbackFont(font, fallback));
2569 TTF_RemoveFallbackFont(font, fallback);
2645 CheckError(TTF_SetFontSizeDPI(font, ptsize, hdpi, vdpi));
2689 CheckError(TTF_GetFontDPI(font, hdpi, vdpi));
2723 TTF_SetFontStyle(font, style);
2753 return TTF_GetFontStyle(font);
2784 CheckError(TTF_SetFontOutline(font, outline));
2834 TTF_SetFontHinting(font, hinting);
2882 return TTF_GetFontHinting(font);
2936#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2956#define SDL_FONT_WEIGHT_THIN TTF_FONT_WEIGHT_THIN
2959#define SDL_FONT_WEIGHT_EXTRA_LIGHT TTF_FONT_WEIGHT_EXTRA_LIGHT
2962#define SDL_FONT_WEIGHT_LIGHT TTF_FONT_WEIGHT_LIGHT
2965#define SDL_FONT_WEIGHT_NORMAL TTF_FONT_WEIGHT_NORMAL
2968#define SDL_FONT_WEIGHT_MEDIUM TTF_FONT_WEIGHT_MEDIUM
2971#define SDL_FONT_WEIGHT_SEMI_BOLD TTF_FONT_WEIGHT_SEMI_BOLD
2974#define SDL_FONT_WEIGHT_BOLD TTF_FONT_WEIGHT_BOLD
2977#define SDL_FONT_WEIGHT_EXTRA_BOLD TTF_FONT_WEIGHT_EXTRA_BOLD
2980#define SDL_FONT_WEIGHT_BLACK TTF_FONT_WEIGHT_BLACK
2983#define SDL_FONT_WEIGHT_EXTRA_BLACK TTF_FONT_WEIGHT_EXTRA_BLACK
3002 TTF_SetFontWrapAlignment(font, align);
3024 return TTF_GetFontWrapAlignment(font);
3097 TTF_SetFontLineSkip(font, lineskip);
3146 TTF_SetFontKerning(font, enabled);
3188 return TTF_FontIsFixedWidth(font);
3232 return TTF_GetFontFamilyName(font);
3258 return TTF_GetFontStyleName(font);
3285 CheckError(TTF_SetFontDirection(font, direction));
3308 return TTF_GetFontDirection(font);
3330 return TTF_StringToTag(
string);
3350 TTF_TagToString(tag,
string, size);
3443 CheckError(TTF_SetFontLanguage(font, language_bcp47));
3465 return TTF_FontHasGlyph(font, ch);
3490 return Surface{TTF_GetGlyphImage(font, ch, image_type)};
3520 return Surface(TTF_GetGlyphImageForIndex(font, glyph_index, image_type));
3565 CheckError(TTF_GetGlyphMetrics(font, ch, minx, maxx, miny, maxy, advance));
3594 if (
int r; TTF_GetGlyphKerning(font, previous_ch, ch, &r))
return r;
3622 CheckError(TTF_GetStringSize(font, text.data(), text.size(), w, h));
3654 std::string_view text,
3660 TTF_GetStringSizeWrapped(font, text.data(), text.size(), wrap_width, w, h));
3695 std::string_view text,
3697 int* measured_width,
3698 size_t* measured_length)
3710 int* measured_width,
3711 size_t* measured_length)
const
3714 m_resource, text, max_width, measured_width, measured_length);
3752 return Surface{TTF_RenderText_Solid(font, text.data(), text.size(), fg)};
3793 std::string_view text,
3797 return Surface(TTF_RenderText_Solid_Wrapped(
3798 font, text.data(), text.size(), fg, wrapLength));
3803 int wrapLength)
const
3837 return Surface(TTF_RenderGlyph_Solid(font, ch, fg));
3880 std::string_view text,
3884 return Surface(TTF_RenderText_Shaded(font, text.data(), text.size(), fg, bg));
3929 std::string_view text,
3934 return Surface(TTF_RenderText_Shaded_Wrapped(
3935 font, text.data(), text.size(), fg, bg, wrap_width));
3941 int wrap_width)
const
3980 return Surface(TTF_RenderGlyph_Shaded(font, ch, fg, bg));
4023 std::string_view text,
4026 return Surface(TTF_RenderText_Blended(font, text.data(), text.size(), fg));
4067 std::string_view text,
4071 return Surface(TTF_RenderText_Blended_Wrapped(
4072 font, text.data(), text.size(), fg, wrap_width));
4077 int wrap_width)
const
4111 return Surface(TTF_RenderGlyph_Blended(font, ch, fg));
4153 std::string_view text,
4157 return Surface(TTF_RenderText_LCD(font, text.data(), text.size(), fg, bg));
4202 std::string_view text,
4207 return Surface(TTF_RenderText_LCD_Wrapped(
4208 font, text.data(), text.size(), fg, bg, wrap_width));
4214 int wrap_width)
const
4253 return Surface(TTF_RenderGlyph_LCD(font, ch, fg, bg));
4288 : m_resource(resource)
4297 :
Text(other.release())
4323 : m_resource(TTF_CreateText(engine, font, text.data(), text.size()))
4328 ~Text() { TTF_DestroyText(m_resource); }
4333 std::swap(m_resource, other.m_resource);
4343 auto r = m_resource;
4344 m_resource =
nullptr;
4352 constexpr bool operator==(std::nullptr_t _)
const {
return !m_resource; }
4355 constexpr explicit operator bool()
const {
return !!m_resource; }
4358 constexpr operator TextParam()
const {
return {m_resource}; }
4413 void DrawRenderer(
FPoint p)
const;
4571 void SetScript(
Uint32 script);
4590 Uint32 GetScript()
const;
4608 void SetColor(
Color c);
4626 void SetColorFloat(
FColor c);
4688 void GetColorFloat(
float* r,
float* g,
float* b,
float* a)
const;
4704 FColor GetColorFloat()
const;
4723 bool SetPosition(
Point p);
4740 bool GetPosition(
int* x,
int* y)
const;
4756 Point GetPosition()
const;
4774 void SetWrapWidth(
int wrap_width);
4790 int GetWrapWidth()
const;
4813 void SetWrapWhitespaceVisible(
bool visible);
4828 bool IsWrapWhitespaceVisible()
const;
4847 void SetString(std::string_view
string);
4870 void InsertString(
int offset, std::string_view
string);
4889 void AppendString(std::string_view
string);
4913 void DeleteString(
int offset,
int length);
4932 void GetSize(
int* w,
int* h)
const;
4950 Point GetSize()
const;
4971 void GetSubString(
int offset,
SubString* substring)
const;
5019 void GetSubStringForLine(
int line,
SubString* substring)
const;
5034 return GetSubStringsForRange(0);
5105 void GetPreviousSubString(
const SubString& substring,
5145 const char*
GetText()
const {
return m_resource->text; }
5162 :
Text(resource.value)
5200 constexpr operator bool()
const {
return bool(m_text); }
5211 return m_subString.offset == other.m_subString.offset;
5287 CheckError(TTF_DrawSurfaceText(text, p.x, p.y, surface));
5313 TTF_DestroySurfaceTextEngine(engine);
5372namespace prop::RendererTextEngine {
5374constexpr auto RENDERER_POINTER =
5375 TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER;
5377constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5378 TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER;
5404 CheckError(TTF_DrawRendererText(text, p.x, p.y));
5430 TTF_DestroyRendererTextEngine(engine);
5489namespace prop::GpuTextEngine {
5491constexpr auto DEVICE_POINTER = TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER;
5493constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5494 TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER;
5527 return TTF_GetGPUTextDrawData(text);
5553 TTF_DestroyGPUTextEngine(engine);
5576 TTF_SetGPUTextEngineWinding(engine, winding);
5602 return TTF_GetGPUTextEngineWinding(engine);
5629 std::string_view text)
5631 return Text(engine, font, text);
5636 return Text(m_resource, font, text);
5653 return {
CheckError(TTF_GetTextProperties(text))};
5734 return TTF_SetTextFont(text, font);
5780 CheckError(TTF_SetTextDirection(text, direction));
5803 return TTF_GetTextDirection(text);
5879 CheckError(TTF_SetTextColor(text, c.r, c.g, c.b, c.a));
5903 CheckError(TTF_SetTextColorFloat(text, c.r, c.g, c.b, c.a));
5935 CheckError(TTF_GetTextColor(text, r, g, b, a));
5995 CheckError(TTF_GetTextColorFloat(text, r, g, b, a));
6050 return TTF_SetTextPosition(text, p.x, p.y);
6076 return TTF_GetTextPosition(text, x, y);
6131 CheckError(TTF_SetTextWrapWidth(text, wrap_width));
6190 CheckError(TTF_SetTextWrapWhitespaceVisible(text, visible));
6214 return TTF_TextWrapWhitespaceVisible(text);
6242 CheckError(TTF_SetTextString(text,
string.data(),
string.size()));
6274 std::string_view
string)
6276 CheckError(TTF_InsertTextString(text, offset,
string.data(),
string.size()));
6304 CheckError(TTF_AppendTextString(text,
string.data(),
string.size()));
6337 CheckError(TTF_DeleteTextString(text, offset, length));
6420 CheckError(TTF_GetTextSubString(text, offset, substring));
6452 CheckError(TTF_GetTextSubStringForLine(text, line, substring));
6481 auto data = TTF_GetTextSubStringsForRange(text, offset, length, &count);
6512 CheckError(TTF_GetTextSubStringForPoint(text, p.x, p.y, substring));
6541 CheckError(TTF_GetPreviousTextSubString(text, &substring, previous));
6570 CheckError(TTF_GetNextTextSubString(text, &substring, next));
An exception that returns GetError()
Definition: SDL3pp_error.h:165
The internal structure containing font information.
Definition: SDL3pp_ttf.h:417
~Font()
Destructor.
Definition: SDL3pp_ttf.h:549
constexpr Font()=default
Default ctor.
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_ttf.h:573
Font(IOStreamParam src, float ptsize, bool closeio=false)
Create a font from an IOStream, using a specified point size.
Definition: SDL3pp_ttf.h:495
Font(PropertiesParam props)
Create a font with the specified properties.
Definition: SDL3pp_ttf.h:543
Point GetStringSize(std::string_view text) const
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:1394
Font(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition: SDL3pp_ttf.h:467
constexpr auto operator<=>(const Font &other) const =default
Comparison.
constexpr FontRaw release()
Retrieves underlying FontRaw and clear this.
Definition: SDL3pp_ttf.h:562
Font & operator=(Font other)
Assignment operator.
Definition: SDL3pp_ttf.h:552
constexpr Font(Font &&other)
Move constructor.
Definition: SDL3pp_ttf.h:440
constexpr FontRaw get() const
Retrieves underlying FontRaw.
Definition: SDL3pp_ttf.h:559
constexpr Font(const FontRaw resource)
Constructs from FontParam.
Definition: SDL3pp_ttf.h:431
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:1440
Base class for SDL memory allocated array wrap.
Definition: SDL3pp_ownPtr.h:44
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
Iterator for substrings.
Definition: SDL3pp_ttf.h:5181
constexpr SubStringIterator()
Default constructor.
Definition: SDL3pp_ttf.h:5194
constexpr SubStringIterator & operator--()
Decrement operator.
Definition: SDL3pp_ttf.h:5230
constexpr const SubString & operator*() const
Retrieve SubString.
Definition: SDL3pp_ttf.h:5203
constexpr const SubString * operator->() const
Retrieve SubString.
Definition: SDL3pp_ttf.h:5206
constexpr bool operator==(const SubStringIterator &other) const
Comparison.
Definition: SDL3pp_ttf.h:5209
constexpr SubStringIterator operator--(int)
Decrement operator.
Definition: SDL3pp_ttf.h:5237
constexpr SubStringIterator operator++(int)
Increment operator.
Definition: SDL3pp_ttf.h:5222
constexpr SubStringIterator & operator++()
Increment operator.
Definition: SDL3pp_ttf.h:5215
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:195
A resource engine.
Definition: SDL3pp_ttf.h:1973
TextEngine & operator=(TextEngine &&other)
Assignment operator.
Definition: SDL3pp_ttf.h:2005
TextEngine & operator=(const TextEngine &other)=delete
Assignment operator.
constexpr TextEngine(const TextEngine &other)=delete
Copy constructor.
constexpr auto operator<=>(const TextEngine &other) const =default
Comparison.
virtual void Destroy()=0
frees up textEngine. Pure virtual
constexpr TextEngine()=default
Default ctor.
constexpr TextEngine(const TextEngineRaw resource)
Constructs from TextEngineParam.
Definition: SDL3pp_ttf.h:1987
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_ttf.h:2029
constexpr TextEngine(TextEngine &&other)
Move constructor.
Definition: SDL3pp_ttf.h:1996
virtual ~TextEngine()=default
Destructor.
constexpr TextEngineRaw release()
Retrieves underlying TextEngineRaw and clear this.
Definition: SDL3pp_ttf.h:2018
constexpr TextEngineRaw get() const
Retrieves underlying TextEngineRaw.
Definition: SDL3pp_ttf.h:2015
Text created with Text.Text()
Definition: SDL3pp_ttf.h:4273
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:5145
int GetNumLines() const
The number of lines in the text, 0 if it's empty.
Definition: SDL3pp_ttf.h:5148
SubStringIterator GetSubStringForPoint(Point p) const
Get the portion of a text string that is closest to a point.
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_ttf.h:4352
constexpr Text()=default
Default ctor.
Text & operator=(Text other)
Assignment operator.
Definition: SDL3pp_ttf.h:4331
SubStringIterator begin() const
Get iterator to first substring.
constexpr Text(Text &&other)
Move constructor.
Definition: SDL3pp_ttf.h:4296
constexpr auto operator<=>(const Text &other) const =default
Comparison.
SubStringIterator end() const
Get iterator to one past last substring.
~Text()
Destructor.
Definition: SDL3pp_ttf.h:4328
constexpr TextRaw release()
Retrieves underlying TextRaw and clear this.
Definition: SDL3pp_ttf.h:4341
constexpr Text(const TextRaw resource)
Constructs from TextParam.
Definition: SDL3pp_ttf.h:4287
OwnArray< SubString * > GetSubStrings() const
Get all substrings of a text object.
Definition: SDL3pp_ttf.h:5032
Text(TextEngineParam engine, FontParam font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition: SDL3pp_ttf.h:4322
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 TextRaw get() const
Retrieves underlying TextRaw.
Definition: SDL3pp_ttf.h:4338
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:198
Color GetColor(Uint32 pixel, const PixelFormatDetails &format, PaletteConstParam palette={})
Get RGBA values from a pixel in the specified format.
Definition: SDL3pp_pixels.h:3049
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition: SDL3pp_pixels.h:84
Point GetPosition() const
Get the position of a text object.
Definition: SDL3pp_ttf.h:6107
FontRef GetFont() const
Get the font used by a text object.
Definition: SDL3pp_ttf.h:5761
void GetTextColor(TextParam text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color of a text object.
Definition: SDL3pp_ttf.h:5933
void SetFontLanguage(FontParam font, StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3441
const char * GetFontFamilyName(FontParam font)
Query a font's family name.
Definition: SDL3pp_ttf.h:3230
constexpr FontStyleFlags STYLE_NORMAL
No special style.
Definition: SDL3pp_ttf.h:303
Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition: SDL3pp_ttf.h:3416
void SetFontLineSkip(FontParam font, int lineskip)
Set the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:3095
constexpr SubStringFlags SUBSTRING_LINE_END
This substring contains the end of line line_index
Definition: SDL3pp_ttf.h:1946
constexpr HintingFlags HINTING_LIGHT
Light hinting applies subtle adjustments to improve rendering.
Definition: SDL3pp_ttf.h:335
void DrawSurface(Point p, SurfaceParam surface) const
Draw text to an SDL surface.
Definition: SDL3pp_ttf.h:5290
constexpr HorizontalAlignment HORIZONTAL_ALIGN_CENTER
CENTER.
Definition: SDL3pp_ttf.h:362
void Destroy() final
Destroy a text engine created for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5316
void SetFontSDF(FontParam font, bool enabled)
Enable Signed Distance Field rendering for a font.
Definition: SDL3pp_ttf.h:2913
constexpr HorizontalAlignment HORIZONTAL_ALIGN_RIGHT
RIGHT.
Definition: SDL3pp_ttf.h:365
Surface RenderGlyph_Solid(FontParam font, Uint32 ch, ColorRaw fg)
Render a single 32-bit glyph at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3835
int GetFontHeight(FontParam font)
Query the total height of a font.
Definition: SDL3pp_ttf.h:3044
void Destroy() final
Destroy a text engine created for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5433
TTF_GPUAtlasDrawSequence GPUAtlasDrawSequence
Draw sequence returned by Text.GetGPUDrawData.
Definition: SDL3pp_ttf.h:2279
void GetPreviousSubString(const SubString &substring, SubString *previous) const
Get the previous substring in a text object.
Definition: SDL3pp_ttf.h:6544
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE
COUNTER_CLOCKWISE.
Definition: SDL3pp_ttf.h:1964
void MeasureString(FontParam font, std::string_view text, int max_width, int *measured_width, size_t *measured_length)
Calculate how much of a UTF-8 string will fit in a given width.
Definition: SDL3pp_ttf.h:3694
bool IsFixedWidth() const
Query whether a font is fixed-width.
Definition: SDL3pp_ttf.h:3191
TTF_Font * FontRaw
Alias to raw representation for Font.
Definition: SDL3pp_ttf.h:36
RendererTextEngine CreateRendererTextEngine(RendererParam renderer)
Create a text engine for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5337
constexpr SubStringFlags SUBSTRING_TEXT_START
This substring contains the beginning of the text.
Definition: SDL3pp_ttf.h:1938
const char * GetStyleName() const
Query a font's style name.
Definition: SDL3pp_ttf.h:3261
static Uint32 GetGlyphScript(Uint32 ch)
Get the script used by a 32-bit codepoint.
Definition: SDL3pp_ttf.h:3418
Surface RenderText_Shaded(FontParam font, std::string_view text, Color fg, Color bg)
Render UTF-8 text at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3879
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:4160
HintingFlags GetFontHinting(FontParam font)
Query a font's current FreeType hinter setting.
Definition: SDL3pp_ttf.h:2880
void SetFontScript(FontParam font, Uint32 script)
Set the script to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3372
int GetFontWeight(FontParam font)
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition: SDL3pp_ttf.h:2949
void SetSizeDPI(float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2648
void SetLanguage(StringParam language_bcp47)
Set language to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3446
void RemoveFallback(FontParam fallback)
Remove a fallback font.
Definition: SDL3pp_ttf.h:2572
void SetTextScript(TextParam text, Uint32 script)
Set the script to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5828
int GetFontOutline(FontParam font)
Query a font's current outline.
Definition: SDL3pp_ttf.h:2804
void DestroyRendererTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:5428
void DrawRenderer(FPoint p) const
Draw text to an SDL renderer.
Definition: SDL3pp_ttf.h:5407
constexpr SubStringFlags SUBSTRING_LINE_START
This substring contains the beginning of line line_index
Definition: SDL3pp_ttf.h:1943
void DestroyText(TextRaw text)
Destroy a text object created by a text engine.
Definition: SDL3pp_ttf.h:6610
void GetStringSize(FontParam font, std::string_view text, int *w, int *h)
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:3620
OwnArray< SubString * > GetTextSubStringsForRange(TextParam text, int offset, int length)
Get the substrings of a text object that contain a range of text.
Definition: SDL3pp_ttf.h:6476
constexpr Direction DIRECTION_LTR
Left to Right.
Definition: SDL3pp_ttf.h:383
constexpr ImageType IMAGE_COLOR
The color channels have image data.
Definition: SDL3pp_ttf.h:403
bool SetFont(FontParam font)
Set the font used by a text object.
Definition: SDL3pp_ttf.h:5737
Direction GetFontDirection(FontParam font)
Get the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3306
Text CreateText(FontParam font, std::string_view text)
Create a text object from UTF-8 text and a text engine.
Definition: SDL3pp_ttf.h:5634
void DeleteTextString(TextParam text, int offset, int length)
Delete UTF-8 text from a text object.
Definition: SDL3pp_ttf.h:6335
Uint32 StringToTag(StringParam string)
Convert from a 4 character string to a 32-bit tag.
Definition: SDL3pp_ttf.h:3328
HintingFlags GetHinting() const
Query a font's current FreeType hinter setting.
Definition: SDL3pp_ttf.h:2885
Surface GetGlyphImage(Uint32 ch, ImageType *image_type) const
Get the pixel image for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3493
void SetFontSizeDPI(FontParam font, float ptsize, int hdpi, int vdpi)
Set font size dynamically with target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2643
Uint32 SubStringFlags
Flags for SubString.
Definition: SDL3pp_ttf.h:1932
const char * GetFamilyName() const
Query a font's family name.
Definition: SDL3pp_ttf.h:3235
void ClearFallbacks()
Remove all fallback fonts.
Definition: SDL3pp_ttf.h:2594
void SetString(std::string_view string)
Set the UTF-8 text used by a text object.
Definition: SDL3pp_ttf.h:6245
Direction GetDirection() const
Get the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5806
TTF_HintingFlags HintingFlags
Hinting flags for TTF (TrueType Fonts)
Definition: SDL3pp_ttf.h:327
int GetWrapWidth() const
Get whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6161
Point GetSize() const
Get the size of a text object.
Definition: SDL3pp_ttf.h:6396
bool FontHasGlyph(FontParam font, Uint32 ch)
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3463
void SetStyle(FontStyleFlags style)
Set a font's current style.
Definition: SDL3pp_ttf.h:2726
RendererTextEngine CreateRendererTextEngineWithProperties(PropertiesParam props)
Create a text engine for drawing text on an SDL renderer, with the specified properties.
Definition: SDL3pp_ttf.h:5366
Surface GetGlyphImageForIndex(Uint32 glyph_index, ImageType *image_type) const
Get the pixel image for a character index.
Definition: SDL3pp_ttf.h:3523
void SetWrapWhitespaceVisible(bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition: SDL3pp_ttf.h:6193
void SetDirection(Direction direction)
Set the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5783
constexpr ImageType IMAGE_INVALID
INVALID.
Definition: SDL3pp_ttf.h:398
FontStyleFlags GetStyle() const
Query a font's current style.
Definition: SDL3pp_ttf.h:2756
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:3801
void GetHarfBuzzVersion(int *major, int *minor, int *patch)
Query the version of the HarfBuzz library in use.
Definition: SDL3pp_ttf.h:281
void SetOutline(int outline)
Set a font's current outline.
Definition: SDL3pp_ttf.h:2787
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:4075
constexpr HintingFlags HINTING_INVALID
INVALID.
Definition: SDL3pp_ttf.h:329
int GetHeight() const
Query the total height of a font.
Definition: SDL3pp_ttf.h:3046
bool GetKerning() const
Query whether or not kerning is enabled for a font.
Definition: SDL3pp_ttf.h:3168
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:3755
GPUTextEngine CreateGPUTextEngineWithProperties(PropertiesParam props)
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
Definition: SDL3pp_ttf.h:5484
void DestroySurfaceTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5311
int GetOutline() const
Query a font's current outline.
Definition: SDL3pp_ttf.h:2806
PropertiesRef GetTextProperties(TextParam text)
Get the properties associated with a text object.
Definition: SDL3pp_ttf.h:5651
bool GetFontKerning(FontParam font)
Query whether or not kerning is enabled for a font.
Definition: SDL3pp_ttf.h:3166
Uint32 FontStyleFlags
Font style flags for Font.
Definition: SDL3pp_ttf.h:301
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:5579
void SetFontKerning(FontParam font, bool enabled)
Set if kerning is enabled for a font.
Definition: SDL3pp_ttf.h:3144
Font CopyFont(FontParam existing_font)
Create a copy of an existing font.
Definition: SDL3pp_ttf.h:2455
GPUAtlasDrawSequence * GetGPUTextDrawData(TextParam text)
Get the geometry data needed for drawing the text.
Definition: SDL3pp_ttf.h:5525
void GetGlyphMetrics(FontParam font, Uint32 ch, int *minx, int *maxx, int *miny, int *maxy, int *advance)
Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3557
void SetColor(Color c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5882
bool IsWrapWhitespaceVisible() const
Return whether whitespace is shown when wrapping a text object.
Definition: SDL3pp_ttf.h:6217
float GetSize() const
Get the size of a font.
Definition: SDL3pp_ttf.h:2670
int GetGlyphKerning(Uint32 previous_ch, Uint32 ch) const
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition: SDL3pp_ttf.h:3598
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:4029
void InsertTextString(TextParam text, int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition: SDL3pp_ttf.h:6272
void GetTextSubStringForLine(TextParam text, int line, SubString *substring)
Get the substring of a text object that contains the given line.
Definition: SDL3pp_ttf.h:6448
Surface RenderText_Solid(FontParam font, std::string_view text, Color fg)
Render UTF-8 text at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3750
int GetFontLineSkip(FontParam font)
Query the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:3117
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:4114
constexpr Direction DIRECTION_BTT
Bottom to Top.
Definition: SDL3pp_ttf.h:389
constexpr HintingFlags HINTING_MONO
Monochrome hinting adjusts the font for better rendering at lower resolutions.
Definition: SDL3pp_ttf.h:341
GPUTextEngine CreateGPUTextEngine(GPUDeviceParam device)
Create a text engine for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5455
void SetSDF(bool enabled)
Enable Signed Distance Field rendering for a font.
Definition: SDL3pp_ttf.h:2918
Font OpenFontWithProperties(PropertiesParam props)
Create a font with the specified properties.
Definition: SDL3pp_ttf.h:2396
void GetFontDPI(FontParam font, int *hdpi, int *vdpi)
Get font target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2687
void SetScript(Uint32 script)
Set the script to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5833
void SetWrapWidth(int wrap_width)
Set whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6134
constexpr FontStyleFlags STYLE_ITALIC
Italic style.
Definition: SDL3pp_ttf.h:307
Uint32 GetFontGeneration(FontParam font)
Get the font generation.
Definition: SDL3pp_ttf.h:2509
void DrawRendererText(TextParam text, FPoint p)
Draw text to an SDL renderer.
Definition: SDL3pp_ttf.h:5402
void SetLineSkip(int lineskip)
Set the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:3100
void AppendTextString(TextParam text, std::string_view string)
Append UTF-8 text to a text object.
Definition: SDL3pp_ttf.h:6302
bool GetSDF() const
Query whether Signed Distance Field rendering is enabled for a font.
Definition: SDL3pp_ttf.h:2934
FontRef GetTextFont(TextParam text)
Get the font used by a text object.
Definition: SDL3pp_ttf.h:5756
void SetKerning(bool enabled)
Set if kerning is enabled for a font.
Definition: SDL3pp_ttf.h:3149
float GetFontSize(FontParam font)
Get the size of a font.
Definition: SDL3pp_ttf.h:2668
bool IsScalable() const
Query whether a font is scalable or not.
Definition: SDL3pp_ttf.h:3212
void SetFontDirection(FontParam font, Direction direction)
Set the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3283
Uint32 GetFontScript(FontParam font)
Get the script used for text shaping a font.
Definition: SDL3pp_ttf.h:3397
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:4211
void GetFreeTypeVersion(int *major, int *minor, int *patch)
Query the version of the FreeType library in use.
Definition: SDL3pp_ttf.h:263
void TagToString(Uint32 tag, char *string, size_t size)
Convert from a 32-bit tag to a 4 character string.
Definition: SDL3pp_ttf.h:3348
void DrawSurfaceText(TextParam text, Point p, SurfaceParam surface)
Draw text to an SDL surface.
Definition: SDL3pp_ttf.h:5285
TTF_GPUTextEngineWinding GPUTextEngineWinding
The winding order of the vertices returned by Text.GetGPUDrawData.
Definition: SDL3pp_ttf.h:1956
constexpr FontStyleFlags STYLE_BOLD
Bold style.
Definition: SDL3pp_ttf.h:305
constexpr FontStyleFlags STYLE_STRIKETHROUGH
Strikethrough text.
Definition: SDL3pp_ttf.h:312
void GetNextSubString(const SubString &substring, SubString *next) const
Get the next substring in a text object.
Definition: SDL3pp_ttf.h:6573
bool FontIsScalable(FontParam font)
Query whether a font is scalable or not.
Definition: SDL3pp_ttf.h:3210
void SetColorFloat(FColor c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5906
bool GetTextPosition(TextParam text, int *x, int *y)
Get the position of a text object.
Definition: SDL3pp_ttf.h:6074
constexpr Direction DIRECTION_RTL
Right to Left.
Definition: SDL3pp_ttf.h:385
TTF_ImageType ImageType
The type of data in a glyph image.
Definition: SDL3pp_ttf.h:396
Direction GetDirection() const
Get the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3311
GPUTextEngineWinding GetGPUWinding() const
Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engin...
Definition: SDL3pp_ttf.h:5605
Uint32 GetGeneration() const
Get the font generation.
Definition: SDL3pp_ttf.h:2514
void SetFontSize(FontParam font, float ptsize)
Set a font's size dynamically.
Definition: SDL3pp_ttf.h:2613
int GetDescent() const
Query the offset from the baseline to the bottom of a font.
Definition: SDL3pp_ttf.h:3078
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:3840
Direction GetTextDirection(TextParam text)
Get the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5801
TTF_TextEngine * TextEngineRaw
Alias to raw representation for TextEngine.
Definition: SDL3pp_ttf.h:72
int GetFontDescent(FontParam font)
Query the offset from the baseline to the bottom of a font.
Definition: SDL3pp_ttf.h:3076
void GetTextSubString(TextParam text, int offset, SubString *substring)
Get the substring of a text object that surrounds a text offset.
Definition: SDL3pp_ttf.h:6418
void Update()
Update the layout of a text object.
Definition: SDL3pp_ttf.h:6596
void GetStringSizeWrapped(FontParam font, std::string_view text, int wrap_width, int *w, int *h)
Calculate the dimensions of a rendered string of UTF-8 text.
Definition: SDL3pp_ttf.h:3653
constexpr HintingFlags HINTING_NORMAL
Normal hinting applies standard grid-fitting.
Definition: SDL3pp_ttf.h:331
int GetGlyphKerning(FontParam font, Uint32 previous_ch, Uint32 ch)
Query the kerning size between the glyphs of two UNICODE codepoints.
Definition: SDL3pp_ttf.h:3592
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:3708
constexpr HorizontalAlignment HORIZONTAL_ALIGN_INVALID
INVALID.
Definition: SDL3pp_ttf.h:356
TextEngineParam GetEngine() const
Get the text engine used by a text object.
Definition: SDL3pp_ttf.h:5706
void SetTextString(TextParam text, std::string_view string)
Set the UTF-8 text used by a text object.
Definition: SDL3pp_ttf.h:6240
void SetTextDirection(TextParam text, Direction direction)
Set the direction to be used for text shaping a text object.
Definition: SDL3pp_ttf.h:5778
Surface RenderText_Shaded_Wrapped(FontParam font, std::string_view text, Color fg, Color bg, int wrap_width)
Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3928
bool HasGlyph(Uint32 ch) const
Check whether a glyph is provided by the font for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3468
constexpr Direction DIRECTION_INVALID
INVALID.
Definition: SDL3pp_ttf.h:381
Uint32 GetTextScript(TextParam text)
Get the script used for text shaping a text object.
Definition: SDL3pp_ttf.h:5856
int GetTextWrapWidth(TextParam text)
Get whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6154
FontStyleFlags GetFontStyle(FontParam font)
Query a font's current style.
Definition: SDL3pp_ttf.h:2751
const char * GetFontStyleName(FontParam font)
Query a font's style name.
Definition: SDL3pp_ttf.h:3256
constexpr HintingFlags HINTING_NONE
No hinting, the font is rendered without any grid-fitting.
Definition: SDL3pp_ttf.h:344
TTF_SubString SubString
The representation of a substring within text.
Definition: SDL3pp_ttf.h:2293
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:3983
constexpr ImageType IMAGE_ALPHA
The color channels are white.
Definition: SDL3pp_ttf.h:400
void SetWrapAlignment(HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:3005
TextEngineParam GetTextEngine(TextParam text)
Get the text engine used by a text object.
Definition: SDL3pp_ttf.h:5701
void SetTextWrapWhitespaceVisible(TextParam text, bool visible)
Set whether whitespace should be visible when wrapping a text object.
Definition: SDL3pp_ttf.h:6188
void GetTextColorFloat(TextParam text, float *r, float *g, float *b, float *a)
Get the color of a text object.
Definition: SDL3pp_ttf.h:5989
void ClearFallbackFonts(FontParam font)
Remove all fallback fonts.
Definition: SDL3pp_ttf.h:2592
void UpdateText(TextParam text)
Update the layout of a text object.
Definition: SDL3pp_ttf.h:6594
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:3938
void SetFontStyle(FontParam font, FontStyleFlags style)
Set a font's current style.
Definition: SDL3pp_ttf.h:2721
Surface RenderText_Blended_Wrapped(FontParam font, std::string_view text, Color fg, int wrap_width)
Render word-wrapped UTF-8 text at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:4066
void GetNextTextSubString(TextParam text, const SubString &substring, SubString *next)
Get the next substring in a text object.
Definition: SDL3pp_ttf.h:6566
void SetGPUTextEngineWinding(TextEngineParam engine, GPUTextEngineWinding winding)
Sets the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engi...
Definition: SDL3pp_ttf.h:5573
HorizontalAlignment GetFontWrapAlignment(FontParam font)
Query a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:3022
int GetWeight() const
Query a font's weight, in terms of the lightness/heaviness of the strokes.
Definition: SDL3pp_ttf.h:2951
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:3887
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_INVALID
INVALID.
Definition: SDL3pp_ttf.h:1958
void SetDirection(Direction direction)
Set the direction to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3288
void SetScript(Uint32 script)
Set the script to be used for text shaping by a font.
Definition: SDL3pp_ttf.h:3377
bool FontIsFixedWidth(FontParam font)
Query whether a font is fixed-width.
Definition: SDL3pp_ttf.h:3186
int GetLineSkip() const
Query the spacing between lines of text for a font.
Definition: SDL3pp_ttf.h:3119
void Close()
Dispose of a previously-created font.
Definition: SDL3pp_ttf.h:6638
bool GetFontSDF(FontParam font)
Query whether Signed Distance Field rendering is enabled for a font.
Definition: SDL3pp_ttf.h:2932
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:4256
void InsertString(int offset, std::string_view string)
Insert UTF-8 text into a text object.
Definition: SDL3pp_ttf.h:6279
HorizontalAlignment GetWrapAlignment() const
Query a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:3027
void AddFallback(FontParam fallback)
Add a fallback font.
Definition: SDL3pp_ttf.h:2546
void DestroyGPUTextEngine(TextEngineRaw engine)
Destroy a text engine created for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5551
Surface RenderText_Blended(FontParam font, std::string_view text, Color fg)
Render UTF-8 text at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:4022
bool TextWrapWhitespaceVisible(TextParam text)
Return whether whitespace is shown when wrapping a text object.
Definition: SDL3pp_ttf.h:6212
int GetFontAscent(FontParam font)
Query the offset from the baseline to the top of a font.
Definition: SDL3pp_ttf.h:3060
GPUTextEngineWinding GetGPUTextEngineWinding(TextEngineParam engine)
Get the winding order of the vertices returned by Text.GetGPUDrawData for a particular GPU text engin...
Definition: SDL3pp_ttf.h:5600
TTF_TextData TextData
Internal data for Text.
Definition: SDL3pp_ttf.h:287
void AddFallbackFont(FontParam font, FontParam fallback)
Add a fallback font.
Definition: SDL3pp_ttf.h:2541
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:6485
void GetSubString(int offset, SubString *substring) const
Get the substring of a text object that surrounds a text offset.
Definition: SDL3pp_ttf.h:6423
void SetTextWrapWidth(TextParam text, int wrap_width)
Set whether wrapping is enabled on a text object.
Definition: SDL3pp_ttf.h:6129
constexpr FontStyleFlags STYLE_UNDERLINE
Underlined text.
Definition: SDL3pp_ttf.h:309
void AppendString(std::string_view string)
Append UTF-8 text to a text object.
Definition: SDL3pp_ttf.h:6307
constexpr SubStringFlags SUBSTRING_TEXT_END
This substring contains the end of the text.
Definition: SDL3pp_ttf.h:1948
Font Copy() const
Create a copy of an existing font.
Definition: SDL3pp_ttf.h:2460
constexpr SubStringFlags SUBSTRING_DIRECTION_MASK
The mask for the flow direction for this substring.
Definition: SDL3pp_ttf.h:1934
Surface RenderText_Solid_Wrapped(FontParam font, std::string_view text, Color fg, int wrapLength)
Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3792
TTF_HorizontalAlignment HorizontalAlignment
The horizontal alignment used when rendering wrapped text.
Definition: SDL3pp_ttf.h:354
PropertiesRef GetProperties() const
Get the properties associated with a text object.
Definition: SDL3pp_ttf.h:5656
constexpr Direction DIRECTION_TTB
Top to Bottom.
Definition: SDL3pp_ttf.h:387
int GetNumFaces() const
Query the number of faces of a font.
Definition: SDL3pp_ttf.h:2854
void SetTextColor(TextParam text, Color c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5877
void RemoveFallbackFont(FontParam font, FontParam fallback)
Remove a fallback font.
Definition: SDL3pp_ttf.h:2567
Color GetColor() const
Get the color of a text object.
Definition: SDL3pp_ttf.h:5965
Surface RenderGlyph_LCD(FontParam font, Uint32 ch, ColorRaw fg, ColorRaw bg)
Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:4248
void SetEngine(TextEngineParam engine)
Set the text engine used by a text object.
Definition: SDL3pp_ttf.h:5682
bool SetPosition(Point p)
Set the position of a text object.
Definition: SDL3pp_ttf.h:6053
void GetPreviousTextSubString(TextParam text, const SubString &substring, SubString *previous)
Get the previous substring in a text object.
Definition: SDL3pp_ttf.h:6537
void SetSize(float ptsize)
Set a font's size dynamically.
Definition: SDL3pp_ttf.h:2618
constexpr HintingFlags HINTING_LIGHT_SUBPIXEL
Light hinting with subpixel rendering for more precise font edges.
Definition: SDL3pp_ttf.h:347
void DeleteString(int offset, int length)
Delete UTF-8 text from a text object.
Definition: SDL3pp_ttf.h:6340
void GetTextSize(TextParam text, int *w, int *h)
Get the size of a text object.
Definition: SDL3pp_ttf.h:6363
void SetFontOutline(FontParam font, int outline)
Set a font's current outline.
Definition: SDL3pp_ttf.h:2782
SurfaceTextEngine CreateSurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:5260
void GetDPI(int *hdpi, int *vdpi) const
Get font target resolutions, in dots per inch.
Definition: SDL3pp_ttf.h:2692
Font OpenFont(StringParam file, float ptsize)
Create a font from a file, using a specified point size.
Definition: SDL3pp_ttf.h:2318
void Destroy()
Destroy a text object created by a text engine.
Definition: SDL3pp_ttf.h:6612
PropertiesRef GetFontProperties(FontParam font)
Get the properties associated with a font.
Definition: SDL3pp_ttf.h:2484
Surface GetGlyphImageForIndex(FontParam font, Uint32 glyph_index, ImageType *image_type)
Get the pixel image for a character index.
Definition: SDL3pp_ttf.h:3516
Surface RenderText_LCD(FontParam font, std::string_view text, Color fg, Color bg)
Render UTF-8 text at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:4152
void SetFontWrapAlignment(FontParam font, HorizontalAlignment align)
Set a font's current wrap alignment option.
Definition: SDL3pp_ttf.h:3000
void SetHinting(HintingFlags hinting)
Set a font's current hinter setting.
Definition: SDL3pp_ttf.h:2837
GPUAtlasDrawSequence * GetGPUDrawData() const
Get the geometry data needed for drawing the text.
Definition: SDL3pp_ttf.h:5530
TTF_Text * TextRaw
Alias to raw representation for Text.
Definition: SDL3pp_ttf.h:105
FColor GetColorFloat() const
Get the color of a text object.
Definition: SDL3pp_ttf.h:6025
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:3568
Uint32 GetScript() const
Get the script used for text shaping a font.
Definition: SDL3pp_ttf.h:3399
constexpr HorizontalAlignment HORIZONTAL_ALIGN_LEFT
LEFT.
Definition: SDL3pp_ttf.h:359
void SetTextEngine(TextParam text, TextEngineParam engine)
Set the text engine used by a text object.
Definition: SDL3pp_ttf.h:5677
void CloseFont(FontRaw font)
Dispose of a previously-created font.
Definition: SDL3pp_ttf.h:6636
int GetAscent() const
Query the offset from the baseline to the top of a font.
Definition: SDL3pp_ttf.h:3062
PropertiesRef GetProperties()
Get the properties associated with a font.
Definition: SDL3pp_ttf.h:2489
Uint32 GetScript() const
Get the script used for text shaping a text object.
Definition: SDL3pp_ttf.h:5858
bool SetTextFont(TextParam text, FontParam font)
Set the font used by a text object.
Definition: SDL3pp_ttf.h:5732
Surface RenderText_LCD_Wrapped(FontParam font, std::string_view text, Color fg, Color bg, int wrap_width)
Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:4201
int GetNumFontFaces(FontParam font)
Query the number of faces of a font.
Definition: SDL3pp_ttf.h:2852
Surface RenderGlyph_Shaded(FontParam font, Uint32 ch, ColorRaw fg, ColorRaw bg)
Render a single UNICODE codepoint at high quality to a new 8-bit surface.
Definition: SDL3pp_ttf.h:3975
Surface GetGlyphImage(FontParam font, Uint32 ch, ImageType *image_type)
Get the pixel image for a UNICODE codepoint.
Definition: SDL3pp_ttf.h:3488
TTF_Direction Direction
Direction flags.
Definition: SDL3pp_ttf.h:379
Surface RenderGlyph_Blended(FontParam font, Uint32 ch, ColorRaw fg)
Render a single UNICODE codepoint at high quality to a new ARGB surface.
Definition: SDL3pp_ttf.h:4109
void GetTextSubStringForPoint(TextParam text, Point p, SubString *substring)
Get the portion of a text string that is closest to a point.
Definition: SDL3pp_ttf.h:6508
bool SetTextPosition(TextParam text, Point p)
Set the position of a text object.
Definition: SDL3pp_ttf.h:6048
constexpr ImageType IMAGE_SDF
The alpha channel has signed distance field information.
Definition: SDL3pp_ttf.h:407
void SetFontHinting(FontParam font, HintingFlags hinting)
Set a font's current hinter setting.
Definition: SDL3pp_ttf.h:2832
void Destroy() final
Destroy a text engine created for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:5556
constexpr GPUTextEngineWinding GPU_TEXTENGINE_WINDING_CLOCKWISE
CLOCKWISE.
Definition: SDL3pp_ttf.h:1961
void SetTextColorFloat(TextParam text, FColor c)
Set the color of a text object.
Definition: SDL3pp_ttf.h:5901
Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:328
Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:260
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition: SDL3pp_pixels.h:2191
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2364
The structure that defines a point (using floating point values).
Definition: SDL3pp_rect.h:509
Safely wrap Font for non owning parameters.
Definition: SDL3pp_ttf.h:43
constexpr FontParam(FontRaw value)
Constructs from FontRaw.
Definition: SDL3pp_ttf.h:47
constexpr FontParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:53
FontRaw value
parameter's FontRaw
Definition: SDL3pp_ttf.h:44
constexpr auto operator<=>(const FontParam &other) const =default
Comparison.
Semi-safe reference for Font.
Definition: SDL3pp_ttf.h:1902
FontRef(FontParam resource)
Constructs from FontParam.
Definition: SDL3pp_ttf.h:1910
~FontRef()
Destructor.
Definition: SDL3pp_ttf.h:1922
FontRef(const FontRef &other)
Copy constructor.
Definition: SDL3pp_ttf.h:1916
Safely wrap GPUDevice for non owning parameters.
Definition: SDL3pp_gpu.h:311
A GPU based text engine.
Definition: SDL3pp_ttf.h:2171
GPUTextEngine(PropertiesParam props)
Create a text engine for drawing text with the SDL GPU API, with the specified properties.
Definition: SDL3pp_ttf.h:2218
GPUTextEngine(GPUDeviceParam device)
Create a text engine for drawing text with the SDL GPU API.
Definition: SDL3pp_ttf.h:2189
Safely wrap IOStream for non owning parameters.
Definition: SDL3pp_iostream.h:34
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:701
Safely wrap Renderer for non owning parameters.
Definition: SDL3pp_render.h:53
A renderer based text engine.
Definition: SDL3pp_ttf.h:2100
RendererTextEngine(PropertiesParam props)
Create a text engine for drawing text on an SDL renderer, with the specified properties.
Definition: SDL3pp_ttf.h:2146
RendererTextEngine(RendererParam renderer)
Create a text engine for drawing text on an SDL renderer.
Definition: SDL3pp_ttf.h:2117
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:46
A surface based text engine.
Definition: SDL3pp_ttf.h:2061
SurfaceTextEngine()
Create a text engine for drawing text on SDL surfaces.
Definition: SDL3pp_ttf.h:2075
Safely wrap TextEngine for non owning parameters.
Definition: SDL3pp_ttf.h:76
constexpr TextEngineParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:86
constexpr auto operator<=>(const TextEngineParam &other) const =default
Comparison.
constexpr TextEngineParam(TextEngineRaw value)
Constructs from TextEngineRaw.
Definition: SDL3pp_ttf.h:80
TextEngineRaw value
parameter's TextEngineRaw
Definition: SDL3pp_ttf.h:77
Safely wrap Text for non owning parameters.
Definition: SDL3pp_ttf.h:112
constexpr auto operator<=>(const TextParam &other) const =default
Comparison.
constexpr TextParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_ttf.h:122
constexpr TextParam(TextRaw value)
Constructs from TextRaw.
Definition: SDL3pp_ttf.h:116
TextRaw value
parameter's TextRaw
Definition: SDL3pp_ttf.h:113
Semi-safe reference for Text.
Definition: SDL3pp_ttf.h:5153
TextRef(TextParam resource=nullptr)
Constructs from TextParam.
Definition: SDL3pp_ttf.h:5161
TextRef(const TextRef &other)
Copy constructor.
Definition: SDL3pp_ttf.h:5167
~TextRef()
Destructor.
Definition: SDL3pp_ttf.h:5173