SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_ttf.h
1#ifndef SDL3PP_TTF_H_
2#define SDL3PP_TTF_H_
3
4#include "SDL3pp_gpu.h"
5#include "SDL3pp_render.h"
6#include "SDL3pp_surface.h"
7#include "SDL3pp_version.h"
8#include "SDL3pp_video.h"
9
10#if !defined(SDL3PP_DISABLE_TTF) && !defined(SDL3PP_ENABLE_TTF) && \
11 __has_include(<SDL3_ttf/SDL_ttf.h>)
12#define SDL3PP_ENABLE_TTF
13#endif
14
15#if defined(SDL3PP_ENABLE_TTF) || defined(SDL3PP_DOC)
16
17#include <SDL3_ttf/SDL_ttf.h>
18
19namespace SDL {
20
32// Forward decl
33struct Font;
34
36using FontRaw = TTF_Font*;
37
38// Forward decl
39struct FontRef;
40
43{
45
48 : value(value)
49 {
50 }
51
53 constexpr FontParam(std::nullptr_t _ = nullptr)
54 : value(nullptr)
55 {
56 }
57
59 constexpr explicit operator bool() const { return !!value; }
60
62 constexpr auto operator<=>(const FontParam& other) const = default;
63
65 constexpr operator FontRaw() const { return value; }
66};
67
68// Forward decl
69struct TextEngine;
70
72using TextEngineRaw = TTF_TextEngine*;
73
76{
78
81 : value(value)
82 {
83 }
84
86 constexpr TextEngineParam(std::nullptr_t _ = nullptr)
87 : value(nullptr)
88 {
89 }
90
92 constexpr explicit operator bool() const { return !!value; }
93
95 constexpr auto operator<=>(const TextEngineParam& other) const = default;
96
98 constexpr operator TextEngineRaw() const { return value; }
99};
100
101// Forward decl
102struct Text;
103
105using TextRaw = TTF_Text*;
106
107// Forward decl
108struct TextRef;
109
112{
114
117 : value(value)
118 {
119 }
120
122 constexpr TextParam(std::nullptr_t _ = nullptr)
123 : value(nullptr)
124 {
125 }
126
128 constexpr explicit operator bool() const { return !!value; }
129
131 constexpr auto operator<=>(const TextParam& other) const = default;
132
134 constexpr operator TextRaw() const { return value; }
135};
136
137#ifdef SDL3PP_DOC
138
144#define SDL_TTF_MAJOR_VERSION
145
146#define SDL_TTF_MINOR_VERSION
147
148#define SDL_TTF_MICRO_VERSION
149
151
155#define SDL_TTF_VERSION \
156 SDL_VERSIONNUM( \
157 SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_MICRO_VERSION)
158
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))
167
168#endif // SDL3PP_DOC
169
170namespace TTF {
171
181inline int Version() { return TTF_Version(); }
182
198inline void Init() { CheckError(TTF_Init()); }
199
220inline void Quit() { TTF_Quit(); }
221
244inline int WasInit() { return TTF_WasInit(); }
245
246} // namespace TTF
247
263inline void GetFreeTypeVersion(int* major, int* minor, int* patch)
264{
265 TTF_GetFreeTypeVersion(major, minor, patch);
266}
267
281inline void GetHarfBuzzVersion(int* major, int* minor, int* patch)
282{
283 TTF_GetHarfBuzzVersion(major, minor, patch);
284}
285
287using TextData = TTF_TextData;
288
302
303constexpr FontStyleFlags STYLE_NORMAL = TTF_STYLE_NORMAL;
304
305constexpr FontStyleFlags STYLE_BOLD = TTF_STYLE_BOLD;
306
307constexpr FontStyleFlags STYLE_ITALIC = TTF_STYLE_ITALIC;
308
310 TTF_STYLE_UNDERLINE;
311
313 TTF_STYLE_STRIKETHROUGH;
314
327using HintingFlags = TTF_HintingFlags;
328
329constexpr HintingFlags HINTING_INVALID = TTF_HINTING_INVALID;
330
332 TTF_HINTING_NORMAL;
333
335constexpr HintingFlags HINTING_LIGHT = TTF_HINTING_LIGHT;
336
341constexpr HintingFlags HINTING_MONO = TTF_HINTING_MONO;
342
344constexpr HintingFlags HINTING_NONE = TTF_HINTING_NONE;
345
347constexpr HintingFlags HINTING_LIGHT_SUBPIXEL = TTF_HINTING_LIGHT_SUBPIXEL;
348
354using HorizontalAlignment = TTF_HorizontalAlignment;
355
357 TTF_HORIZONTAL_ALIGN_INVALID;
358
360 TTF_HORIZONTAL_ALIGN_LEFT;
361
363 TTF_HORIZONTAL_ALIGN_CENTER;
364
366 TTF_HORIZONTAL_ALIGN_RIGHT;
367
379using Direction = TTF_Direction;
380
381constexpr Direction DIRECTION_INVALID = TTF_DIRECTION_INVALID;
382
383constexpr Direction DIRECTION_LTR = TTF_DIRECTION_LTR;
384
385constexpr Direction DIRECTION_RTL = TTF_DIRECTION_RTL;
386
387constexpr Direction DIRECTION_TTB = TTF_DIRECTION_TTB;
388
389constexpr Direction DIRECTION_BTT = TTF_DIRECTION_BTT;
390
396using ImageType = TTF_ImageType;
397
398constexpr ImageType IMAGE_INVALID = TTF_IMAGE_INVALID;
399
401 TTF_IMAGE_ALPHA;
402
404 TTF_IMAGE_COLOR;
405
407constexpr ImageType IMAGE_SDF = TTF_IMAGE_SDF;
408
416class Font
417{
418 FontRaw m_resource = nullptr;
419
420public:
422 constexpr Font() = default;
423
431 constexpr explicit Font(const FontRaw resource)
432 : m_resource(resource)
433 {
434 }
435
437 constexpr Font(const Font& other) = delete;
438
440 constexpr Font(Font&& other)
441 : Font(other.release())
442 {
443 }
444
445 constexpr Font(const FontRef& other) = delete;
446
447 constexpr Font(FontRef&& other) = delete;
448
467 Font(StringParam file, float ptsize)
468 : m_resource(CheckError(TTF_OpenFont(file, ptsize)))
469 {
470 }
471
495 Font(IOStreamParam src, float ptsize, bool closeio = false)
496 : m_resource(CheckError(TTF_OpenFontIO(src, closeio, ptsize)))
497 {
498 }
499
544 : m_resource(CheckError(TTF_OpenFontWithProperties(props)))
545 {
546 }
547
549 ~Font() { TTF_CloseFont(m_resource); }
550
553 {
554 std::swap(m_resource, other.m_resource);
555 return *this;
556 }
557
559 constexpr FontRaw get() const { return m_resource; }
560
562 constexpr FontRaw release()
563 {
564 auto r = m_resource;
565 m_resource = nullptr;
566 return r;
567 }
568
570 constexpr auto operator<=>(const Font& other) const = default;
571
573 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
574
576 constexpr explicit operator bool() const { return !!m_resource; }
577
579 constexpr operator FontParam() const { return {m_resource}; }
580
601 void Close();
602
619 Font Copy() const;
620
643
658 Uint32 GetGeneration() const;
659
681 void AddFallback(FontParam fallback);
682
698 void RemoveFallback(FontParam fallback);
699
714 void ClearFallbacks();
715
732 void SetSize(float ptsize);
733
753 void SetSizeDPI(float ptsize, int hdpi, int vdpi);
754
769 float GetSize() const;
770
785 void GetDPI(int* hdpi, int* vdpi) const;
786
810 void SetStyle(FontStyleFlags style);
811
831 FontStyleFlags GetStyle() const;
832
853 void SetOutline(int outline);
854
866 int GetOutline() const;
867
891 void SetHinting(HintingFlags hinting);
892
902 int GetNumFaces() const;
903
924 HintingFlags GetHinting() const;
925
948 void SetSDF(bool enabled);
949
961 bool GetSDF() const;
962
963#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
964
975 int GetWeight() const;
976
977#endif // SDL_TTF_VERSION_ATLEAST(3, 2, 2)
978
994
1007
1019 int GetHeight() const;
1020
1032 int GetAscent() const;
1033
1045 int GetDescent() const;
1046
1061 void SetLineSkip(int lineskip);
1062
1074 int GetLineSkip() const;
1075
1095 void SetKerning(bool enabled);
1096
1108 bool GetKerning() const;
1109
1125 bool IsFixedWidth() const;
1126
1140 bool IsScalable() const;
1141
1157 const char* GetFamilyName() const;
1158
1174 const char* GetStyleName() const;
1175
1192 void SetDirection(Direction direction);
1193
1206 Direction GetDirection() const;
1207
1227 void SetScript(Uint32 script);
1228
1243 Uint32 GetScript() const;
1244
1260 static Uint32 GetGlyphScript(Uint32 ch);
1261
1279 void SetLanguage(StringParam language_bcp47);
1280
1292 bool HasGlyph(Uint32 ch) const;
1293
1308 Surface GetGlyphImage(Uint32 ch, ImageType* image_type) const;
1309
1328 ImageType* image_type) const;
1329
1357 void GetGlyphMetrics(Uint32 ch,
1358 int* minx,
1359 int* maxx,
1360 int* miny,
1361 int* maxy,
1362 int* advance) const;
1363
1377 int GetGlyphKerning(Uint32 previous_ch, Uint32 ch) const;
1378
1394 Point GetStringSize(std::string_view text) const
1395 {
1396 Point p;
1397 GetStringSize(text, &p.x, &p.y);
1398 return p;
1399 }
1400
1417 void GetStringSize(std::string_view text, int* w, int* h) const;
1418
1440 Point GetStringSizeWrapped(std::string_view text, int wrap_width) const
1441 {
1442 Point p;
1443 GetStringSizeWrapped(text, wrap_width, &p.x, &p.y);
1444 return p;
1445 }
1446
1469 void GetStringSizeWrapped(std::string_view text,
1470 int wrap_width,
1471 int* w,
1472 int* h) const;
1473
1496 void MeasureString(std::string_view text,
1497 int max_width,
1498 int* measured_width,
1499 size_t* measured_length) const;
1500
1533 Surface RenderText_Solid(std::string_view text, Color fg) const;
1534
1566 Surface RenderText_Solid_Wrapped(std::string_view text,
1567 Color fg,
1568 int wrapLength) const;
1569
1597
1631 Surface RenderText_Shaded(std::string_view text, Color fg, Color bg) const;
1632
1666 Surface RenderText_Shaded_Wrapped(std::string_view text,
1667 Color fg,
1668 Color bg,
1669 int wrap_width) const;
1670
1700
1732 Surface RenderText_Blended(std::string_view text, Color fg) const;
1733
1765 Surface RenderText_Blended_Wrapped(std::string_view text,
1766 Color fg,
1767 int wrap_width) const;
1768
1796
1829 Surface RenderText_LCD(std::string_view text, Color fg, Color bg) const;
1830
1864 Surface RenderText_LCD_Wrapped(std::string_view text,
1865 Color fg,
1866 Color bg,
1867 int wrap_width) const;
1868
1898};
1899
1902{
1911 : Font(resource.value)
1912 {
1913 }
1914
1916 FontRef(const FontRef& other)
1917 : Font(other.get())
1918 {
1919 }
1920
1923};
1924
1933
1935 TTF_SUBSTRING_DIRECTION_MASK;
1937
1939 TTF_SUBSTRING_TEXT_START;
1941
1943constexpr SubStringFlags SUBSTRING_LINE_START = TTF_SUBSTRING_LINE_START;
1944
1946constexpr SubStringFlags SUBSTRING_LINE_END = TTF_SUBSTRING_LINE_END;
1947
1949 TTF_SUBSTRING_TEXT_END;
1950
1956using GPUTextEngineWinding = TTF_GPUTextEngineWinding;
1957
1959 TTF_GPU_TEXTENGINE_WINDING_INVALID;
1960
1962 TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE;
1963
1965 TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE;
1966
1973{
1974 TextEngineRaw m_resource = nullptr;
1975
1976public:
1978 constexpr TextEngine() = default;
1979
1987 constexpr explicit TextEngine(const TextEngineRaw resource)
1988 : m_resource(resource)
1989 {
1990 }
1991
1993 constexpr TextEngine(const TextEngine& other) = delete;
1994
1996 constexpr TextEngine(TextEngine&& other)
1997 : TextEngine(other.release())
1998 {
1999 }
2000
2002 virtual ~TextEngine() = default;
2003
2006 {
2007 std::swap(m_resource, other.m_resource);
2008 return *this;
2009 }
2010
2012 TextEngine& operator=(const TextEngine& other) = delete;
2013
2015 constexpr TextEngineRaw get() const { return m_resource; }
2016
2019 {
2020 auto r = m_resource;
2021 m_resource = nullptr;
2022 return r;
2023 }
2024
2026 constexpr auto operator<=>(const TextEngine& other) const = default;
2027
2029 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
2030
2032 constexpr explicit operator bool() const { return !!m_resource; }
2033
2035 constexpr operator TextEngineParam() const { return {m_resource}; }
2036
2038 virtual void Destroy() = 0;
2039
2056 Text CreateText(FontParam font, std::string_view text);
2057};
2058
2061{
2076 : TextEngine(TTF_CreateSurfaceTextEngine())
2077 {
2078 }
2079
2081
2095 void Destroy() final;
2096};
2097
2100{
2118 : TextEngine(TTF_CreateRendererTextEngine(renderer))
2119 {
2120 }
2121
2147 : TextEngine(TTF_CreateRendererTextEngineWithProperties(props))
2148 {
2149 }
2150
2152
2166 void Destroy() final;
2167};
2168
2171{
2190 : TextEngine(TTF_CreateGPUTextEngine(device))
2191 {
2192 }
2193
2219 : TextEngine(TTF_CreateGPUTextEngineWithProperties(props))
2220 {
2221 }
2222
2223 ~GPUTextEngine() { Destroy(); }
2224
2238 void SetGPUWinding(GPUTextEngineWinding winding);
2239
2254 GPUTextEngineWinding GetGPUWinding() const;
2255
2269 void Destroy() final;
2270};
2271
2279using GPUAtlasDrawSequence = TTF_GPUAtlasDrawSequence;
2280
2293using SubString = TTF_SubString;
2294
2295// Forward decl
2296struct SubStringIterator;
2297
2318inline Font OpenFont(StringParam file, float ptsize)
2319{
2320 return Font(std::move(file), ptsize);
2321}
2322
2348inline Font OpenFont(IOStreamParam src, float ptsize, bool closeio = false)
2349{
2350 return Font(src, ptsize, closeio);
2351}
2352
2397{
2398 return Font(props);
2399}
2400
2401namespace prop::Font {
2402
2403constexpr auto CREATE_FILENAME_STRING = TTF_PROP_FONT_CREATE_FILENAME_STRING;
2404
2405constexpr auto CREATE_IOSTREAM_POINTER = TTF_PROP_FONT_CREATE_IOSTREAM_POINTER;
2406
2407constexpr auto CREATE_IOSTREAM_OFFSET_NUMBER =
2408 TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER;
2409
2410constexpr auto CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN =
2411 TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN;
2412
2413constexpr auto CREATE_SIZE_FLOAT = TTF_PROP_FONT_CREATE_SIZE_FLOAT;
2414
2415constexpr auto CREATE_FACE_NUMBER = TTF_PROP_FONT_CREATE_FACE_NUMBER;
2416
2417constexpr auto CREATE_HORIZONTAL_DPI_NUMBER =
2418 TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER;
2419
2420constexpr auto CREATE_VERTICAL_DPI_NUMBER =
2421 TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER;
2422
2423constexpr auto CREATE_EXISTING_FONT_POINTER =
2424 TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER;
2425
2426constexpr auto OUTLINE_LINE_CAP_NUMBER = TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER;
2427
2428constexpr auto OUTLINE_LINE_JOIN_NUMBER =
2429 TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER;
2430
2431constexpr auto OUTLINE_MITER_LIMIT_NUMBER =
2432 TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER;
2433
2434} // namespace prop::Font
2435
2455inline Font CopyFont(FontParam existing_font)
2456{
2457 return Font(CheckError(TTF_CopyFont(existing_font)));
2458}
2459
2460inline Font Font::Copy() const { return SDL::CopyFont(m_resource); }
2461
2485{
2486 return {CheckError(TTF_GetFontProperties(font))};
2487}
2488
2490{
2491 return SDL::GetFontProperties(m_resource);
2492}
2493
2510{
2511 return TTF_GetFontGeneration(font);
2512}
2513
2515{
2516 return SDL::GetFontGeneration(m_resource);
2517}
2518
2541inline void AddFallbackFont(FontParam font, FontParam fallback)
2542{
2543 CheckError(TTF_AddFallbackFont(font, fallback));
2544}
2545
2546inline void Font::AddFallback(FontParam fallback)
2547{
2548 SDL::AddFallbackFont(m_resource, fallback);
2549}
2550
2567inline void RemoveFallbackFont(FontParam font, FontParam fallback)
2568{
2569 TTF_RemoveFallbackFont(font, fallback);
2570}
2571
2572inline void Font::RemoveFallback(FontParam fallback)
2573{
2574 SDL::RemoveFallbackFont(m_resource, fallback);
2575}
2576
2592inline void ClearFallbackFonts(FontParam font) { TTF_ClearFallbackFonts(font); }
2593
2594inline void Font::ClearFallbacks() { SDL::ClearFallbackFonts(m_resource); }
2595
2613inline void SetFontSize(FontParam font, float ptsize)
2614{
2615 CheckError(TTF_SetFontSize(font, ptsize));
2616}
2617
2618inline void Font::SetSize(float ptsize)
2619{
2620 SDL::SetFontSize(m_resource, ptsize);
2621}
2622
2643inline void SetFontSizeDPI(FontParam font, float ptsize, int hdpi, int vdpi)
2644{
2645 CheckError(TTF_SetFontSizeDPI(font, ptsize, hdpi, vdpi));
2646}
2647
2648inline void Font::SetSizeDPI(float ptsize, int hdpi, int vdpi)
2649{
2650 SDL::SetFontSizeDPI(m_resource, ptsize, hdpi, vdpi);
2651}
2652
2668inline float GetFontSize(FontParam font) { return TTF_GetFontSize(font); }
2669
2670inline float Font::GetSize() const { return SDL::GetFontSize(m_resource); }
2671
2687inline void GetFontDPI(FontParam font, int* hdpi, int* vdpi)
2688{
2689 CheckError(TTF_GetFontDPI(font, hdpi, vdpi));
2690}
2691
2692inline void Font::GetDPI(int* hdpi, int* vdpi) const
2693{
2694 SDL::GetFontDPI(m_resource, hdpi, vdpi);
2695}
2696
2721inline void SetFontStyle(FontParam font, FontStyleFlags style)
2722{
2723 TTF_SetFontStyle(font, style);
2724}
2725
2727{
2728 SDL::SetFontStyle(m_resource, style);
2729}
2730
2752{
2753 return TTF_GetFontStyle(font);
2754}
2755
2757{
2758 return SDL::GetFontStyle(m_resource);
2759}
2760
2782inline void SetFontOutline(FontParam font, int outline)
2783{
2784 CheckError(TTF_SetFontOutline(font, outline));
2785}
2786
2787inline void Font::SetOutline(int outline)
2788{
2789 SDL::SetFontOutline(m_resource, outline);
2790}
2791
2804inline int GetFontOutline(FontParam font) { return TTF_GetFontOutline(font); }
2805
2806inline int Font::GetOutline() const { return SDL::GetFontOutline(m_resource); }
2807
2832inline void SetFontHinting(FontParam font, HintingFlags hinting)
2833{
2834 TTF_SetFontHinting(font, hinting);
2835}
2836
2837inline void Font::SetHinting(HintingFlags hinting)
2838{
2839 SDL::SetFontHinting(m_resource, hinting);
2840}
2841
2852inline int GetNumFontFaces(FontParam font) { return TTF_GetNumFontFaces(font); }
2853
2854inline int Font::GetNumFaces() const
2855{
2856 return SDL::GetNumFontFaces(m_resource);
2857}
2858
2881{
2882 return TTF_GetFontHinting(font);
2883}
2884
2886{
2887 return SDL::GetFontHinting(m_resource);
2888}
2889
2913inline void SetFontSDF(FontParam font, bool enabled)
2914{
2915 CheckError(TTF_SetFontSDF(font, enabled));
2916}
2917
2918inline void Font::SetSDF(bool enabled) { SDL::SetFontSDF(m_resource, enabled); }
2919
2932inline bool GetFontSDF(FontParam font) { return TTF_GetFontSDF(font); }
2933
2934inline bool Font::GetSDF() const { return SDL::GetFontSDF(m_resource); }
2935
2936#if SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2937
2949inline int GetFontWeight(FontParam font) { return TTF_GetFontWeight(font); }
2950
2951inline int Font::GetWeight() const { return SDL::GetFontWeight(m_resource); }
2952
2953#endif // SDL_TTF_VERSION_ATLEAST(3, 2, 2)
2954
2956#define SDL_FONT_WEIGHT_THIN TTF_FONT_WEIGHT_THIN
2957
2959#define SDL_FONT_WEIGHT_EXTRA_LIGHT TTF_FONT_WEIGHT_EXTRA_LIGHT
2960
2962#define SDL_FONT_WEIGHT_LIGHT TTF_FONT_WEIGHT_LIGHT
2963
2965#define SDL_FONT_WEIGHT_NORMAL TTF_FONT_WEIGHT_NORMAL
2966
2968#define SDL_FONT_WEIGHT_MEDIUM TTF_FONT_WEIGHT_MEDIUM
2969
2971#define SDL_FONT_WEIGHT_SEMI_BOLD TTF_FONT_WEIGHT_SEMI_BOLD
2972
2974#define SDL_FONT_WEIGHT_BOLD TTF_FONT_WEIGHT_BOLD
2975
2977#define SDL_FONT_WEIGHT_EXTRA_BOLD TTF_FONT_WEIGHT_EXTRA_BOLD
2978
2980#define SDL_FONT_WEIGHT_BLACK TTF_FONT_WEIGHT_BLACK
2981
2983#define SDL_FONT_WEIGHT_EXTRA_BLACK TTF_FONT_WEIGHT_EXTRA_BLACK
2984
3001{
3002 TTF_SetFontWrapAlignment(font, align);
3003}
3004
3006{
3007 SDL::SetFontWrapAlignment(m_resource, align);
3008}
3009
3023{
3024 return TTF_GetFontWrapAlignment(font);
3025}
3026
3028{
3029 return SDL::GetFontWrapAlignment(m_resource);
3030}
3031
3044inline int GetFontHeight(FontParam font) { return TTF_GetFontHeight(font); }
3045
3046inline int Font::GetHeight() const { return SDL::GetFontHeight(m_resource); }
3047
3060inline int GetFontAscent(FontParam font) { return TTF_GetFontAscent(font); }
3061
3062inline int Font::GetAscent() const { return SDL::GetFontAscent(m_resource); }
3063
3076inline int GetFontDescent(FontParam font) { return TTF_GetFontDescent(font); }
3077
3078inline int Font::GetDescent() const { return SDL::GetFontDescent(m_resource); }
3079
3095inline void SetFontLineSkip(FontParam font, int lineskip)
3096{
3097 TTF_SetFontLineSkip(font, lineskip);
3098}
3099
3100inline void Font::SetLineSkip(int lineskip)
3101{
3102 SDL::SetFontLineSkip(m_resource, lineskip);
3103}
3104
3117inline int GetFontLineSkip(FontParam font) { return TTF_GetFontLineSkip(font); }
3118
3119inline int Font::GetLineSkip() const
3120{
3121 return SDL::GetFontLineSkip(m_resource);
3122}
3123
3144inline void SetFontKerning(FontParam font, bool enabled)
3145{
3146 TTF_SetFontKerning(font, enabled);
3147}
3148
3149inline void Font::SetKerning(bool enabled)
3150{
3151 SDL::SetFontKerning(m_resource, enabled);
3152}
3153
3166inline bool GetFontKerning(FontParam font) { return TTF_GetFontKerning(font); }
3167
3168inline bool Font::GetKerning() const { return SDL::GetFontKerning(m_resource); }
3169
3187{
3188 return TTF_FontIsFixedWidth(font);
3189}
3190
3191inline bool Font::IsFixedWidth() const
3192{
3193 return SDL::FontIsFixedWidth(m_resource);
3194}
3195
3210inline bool FontIsScalable(FontParam font) { return TTF_FontIsScalable(font); }
3211
3212inline bool Font::IsScalable() const { return SDL::FontIsScalable(m_resource); }
3213
3230inline const char* GetFontFamilyName(FontParam font)
3231{
3232 return TTF_GetFontFamilyName(font);
3233}
3234
3235inline const char* Font::GetFamilyName() const
3236{
3237 return SDL::GetFontFamilyName(m_resource);
3238}
3239
3256inline const char* GetFontStyleName(FontParam font)
3257{
3258 return TTF_GetFontStyleName(font);
3259}
3260
3261inline const char* Font::GetStyleName() const
3262{
3263 return SDL::GetFontStyleName(m_resource);
3264}
3265
3283inline void SetFontDirection(FontParam font, Direction direction)
3284{
3285 CheckError(TTF_SetFontDirection(font, direction));
3286}
3287
3288inline void Font::SetDirection(Direction direction)
3289{
3290 SDL::SetFontDirection(m_resource, direction);
3291}
3292
3307{
3308 return TTF_GetFontDirection(font);
3309}
3310
3312{
3313 return SDL::GetFontDirection(m_resource);
3314}
3315
3329{
3330 return TTF_StringToTag(string);
3331}
3332
3348inline void TagToString(Uint32 tag, char* string, size_t size)
3349{
3350 TTF_TagToString(tag, string, size);
3351}
3352
3372inline void SetFontScript(FontParam font, Uint32 script)
3373{
3374 CheckError(TTF_SetFontScript(font, script));
3375}
3376
3377inline void Font::SetScript(Uint32 script)
3378{
3379 SDL::SetFontScript(m_resource, script);
3380}
3381
3397inline Uint32 GetFontScript(FontParam font) { return TTF_GetFontScript(font); }
3398
3399inline Uint32 Font::GetScript() const { return SDL::GetFontScript(m_resource); }
3400
3416inline Uint32 GetGlyphScript(Uint32 ch) { return TTF_GetGlyphScript(ch); }
3417
3419{
3420 return SDL::GetGlyphScript(ch);
3421}
3422
3441inline void SetFontLanguage(FontParam font, StringParam language_bcp47)
3442{
3443 CheckError(TTF_SetFontLanguage(font, language_bcp47));
3444}
3445
3446inline void Font::SetLanguage(StringParam language_bcp47)
3447{
3448 SDL::SetFontLanguage(m_resource, std::move(language_bcp47));
3449}
3450
3463inline bool FontHasGlyph(FontParam font, Uint32 ch)
3464{
3465 return TTF_FontHasGlyph(font, ch);
3466}
3467
3468inline bool Font::HasGlyph(Uint32 ch) const
3469{
3470 return SDL::FontHasGlyph(m_resource, ch);
3471}
3472
3488inline Surface GetGlyphImage(FontParam font, Uint32 ch, ImageType* image_type)
3489{
3490 return Surface{TTF_GetGlyphImage(font, ch, image_type)};
3491}
3492
3493inline Surface Font::GetGlyphImage(Uint32 ch, ImageType* image_type) const
3494{
3495 return SDL::GetGlyphImage(m_resource, ch, image_type);
3496}
3497
3517 Uint32 glyph_index,
3518 ImageType* image_type)
3519{
3520 return Surface(TTF_GetGlyphImageForIndex(font, glyph_index, image_type));
3521}
3522
3524 ImageType* image_type) const
3525{
3526 return SDL::GetGlyphImageForIndex(m_resource, glyph_index, image_type);
3527}
3528
3558 Uint32 ch,
3559 int* minx,
3560 int* maxx,
3561 int* miny,
3562 int* maxy,
3563 int* advance)
3564{
3565 CheckError(TTF_GetGlyphMetrics(font, ch, minx, maxx, miny, maxy, advance));
3566}
3567
3569 int* minx,
3570 int* maxx,
3571 int* miny,
3572 int* maxy,
3573 int* advance) const
3574{
3575 SDL::GetGlyphMetrics(m_resource, ch, minx, maxx, miny, maxy, advance);
3576}
3577
3592inline int GetGlyphKerning(FontParam font, Uint32 previous_ch, Uint32 ch)
3593{
3594 if (int r; TTF_GetGlyphKerning(font, previous_ch, ch, &r)) return r;
3595 throw Error();
3596}
3597
3598inline int Font::GetGlyphKerning(Uint32 previous_ch, Uint32 ch) const
3599{
3600 return SDL::GetGlyphKerning(m_resource, previous_ch, ch);
3601}
3602
3620inline void GetStringSize(FontParam font, std::string_view text, int* w, int* h)
3621{
3622 CheckError(TTF_GetStringSize(font, text.data(), text.size(), w, h));
3623}
3624
3625inline void Font::GetStringSize(std::string_view text, int* w, int* h) const
3626{
3627 SDL::GetStringSize(m_resource, text, w, h);
3628}
3629
3654 std::string_view text,
3655 int wrap_width,
3656 int* w,
3657 int* h)
3658{
3659 CheckError(
3660 TTF_GetStringSizeWrapped(font, text.data(), text.size(), wrap_width, w, h));
3661}
3662
3663inline void Font::GetStringSizeWrapped(std::string_view text,
3664 int wrap_width,
3665 int* w,
3666 int* h) const
3667{
3668 SDL::GetStringSizeWrapped(m_resource, text, wrap_width, w, h);
3669}
3670
3694inline void MeasureString(FontParam font,
3695 std::string_view text,
3696 int max_width,
3697 int* measured_width,
3698 size_t* measured_length)
3699{
3700 CheckError(TTF_MeasureString(font,
3701 text.data(),
3702 text.size(),
3703 max_width,
3704 measured_width,
3705 measured_length));
3706}
3707
3708inline void Font::MeasureString(std::string_view text,
3709 int max_width,
3710 int* measured_width,
3711 size_t* measured_length) const
3712{
3714 m_resource, text, max_width, measured_width, measured_length);
3715}
3716
3750inline Surface RenderText_Solid(FontParam font, std::string_view text, Color fg)
3751{
3752 return Surface{TTF_RenderText_Solid(font, text.data(), text.size(), fg)};
3753}
3754
3755inline Surface Font::RenderText_Solid(std::string_view text, Color fg) const
3756{
3757 return SDL::RenderText_Solid(m_resource, text, fg);
3758}
3759
3793 std::string_view text,
3794 Color fg,
3795 int wrapLength)
3796{
3797 return Surface(TTF_RenderText_Solid_Wrapped(
3798 font, text.data(), text.size(), fg, wrapLength));
3799}
3800
3801inline Surface Font::RenderText_Solid_Wrapped(std::string_view text,
3802 Color fg,
3803 int wrapLength) const
3804{
3805 return SDL::RenderText_Solid_Wrapped(m_resource, text, fg, wrapLength);
3806}
3807
3836{
3837 return Surface(TTF_RenderGlyph_Solid(font, ch, fg));
3838}
3839
3841{
3842 return SDL::RenderGlyph_Solid(m_resource, ch, fg);
3843}
3844
3880 std::string_view text,
3881 Color fg,
3882 Color bg)
3883{
3884 return Surface(TTF_RenderText_Shaded(font, text.data(), text.size(), fg, bg));
3885}
3886
3887inline Surface Font::RenderText_Shaded(std::string_view text,
3888 Color fg,
3889 Color bg) const
3890{
3891 return SDL::RenderText_Shaded(m_resource, text, fg, bg);
3892}
3893
3929 std::string_view text,
3930 Color fg,
3931 Color bg,
3932 int wrap_width)
3933{
3934 return Surface(TTF_RenderText_Shaded_Wrapped(
3935 font, text.data(), text.size(), fg, bg, wrap_width));
3936}
3937
3938inline Surface Font::RenderText_Shaded_Wrapped(std::string_view text,
3939 Color fg,
3940 Color bg,
3941 int wrap_width) const
3942{
3943 return SDL::RenderText_Shaded_Wrapped(m_resource, text, fg, bg, wrap_width);
3944}
3945
3976 Uint32 ch,
3977 ColorRaw fg,
3978 ColorRaw bg)
3979{
3980 return Surface(TTF_RenderGlyph_Shaded(font, ch, fg, bg));
3981}
3982
3984 ColorRaw fg,
3985 ColorRaw bg) const
3986{
3987 return SDL::RenderGlyph_Shaded(m_resource, ch, fg, bg);
3988}
3989
4023 std::string_view text,
4024 Color fg)
4025{
4026 return Surface(TTF_RenderText_Blended(font, text.data(), text.size(), fg));
4027}
4028
4029inline Surface Font::RenderText_Blended(std::string_view text, Color fg) const
4030{
4031 return SDL::RenderText_Blended(m_resource, text, fg);
4032}
4033
4067 std::string_view text,
4068 Color fg,
4069 int wrap_width)
4070{
4071 return Surface(TTF_RenderText_Blended_Wrapped(
4072 font, text.data(), text.size(), fg, wrap_width));
4073}
4074
4075inline Surface Font::RenderText_Blended_Wrapped(std::string_view text,
4076 Color fg,
4077 int wrap_width) const
4078{
4079 return SDL::RenderText_Blended_Wrapped(m_resource, text, fg, wrap_width);
4080}
4081
4110{
4111 return Surface(TTF_RenderGlyph_Blended(font, ch, fg));
4112}
4113
4115{
4116 return SDL::RenderGlyph_Blended(m_resource, ch, fg);
4117}
4118
4153 std::string_view text,
4154 Color fg,
4155 Color bg)
4156{
4157 return Surface(TTF_RenderText_LCD(font, text.data(), text.size(), fg, bg));
4158}
4159
4160inline Surface Font::RenderText_LCD(std::string_view text,
4161 Color fg,
4162 Color bg) const
4163{
4164 return SDL::RenderText_LCD(m_resource, text, fg, bg);
4165}
4166
4202 std::string_view text,
4203 Color fg,
4204 Color bg,
4205 int wrap_width)
4206{
4207 return Surface(TTF_RenderText_LCD_Wrapped(
4208 font, text.data(), text.size(), fg, bg, wrap_width));
4209}
4210
4211inline Surface Font::RenderText_LCD_Wrapped(std::string_view text,
4212 Color fg,
4213 Color bg,
4214 int wrap_width) const
4215{
4216 return SDL::RenderText_LCD_Wrapped(m_resource, text, fg, bg, wrap_width);
4217}
4218
4249 Uint32 ch,
4250 ColorRaw fg,
4251 ColorRaw bg)
4252{
4253 return Surface(TTF_RenderGlyph_LCD(font, ch, fg, bg));
4254}
4255
4257{
4258 return SDL::RenderGlyph_LCD(m_resource, ch, fg, bg);
4259}
4260
4272class Text
4273{
4274 TextRaw m_resource = nullptr;
4275
4276public:
4278 constexpr Text() = default;
4279
4287 constexpr explicit Text(const TextRaw resource)
4288 : m_resource(resource)
4289 {
4290 }
4291
4293 constexpr Text(const Text& other) = delete;
4294
4296 constexpr Text(Text&& other)
4297 : Text(other.release())
4298 {
4299 }
4300
4301 constexpr Text(const TextRef& other) = delete;
4302
4303 constexpr Text(TextRef&& other) = delete;
4304
4322 Text(TextEngineParam engine, FontParam font, std::string_view text)
4323 : m_resource(TTF_CreateText(engine, font, text.data(), text.size()))
4324 {
4325 }
4326
4328 ~Text() { TTF_DestroyText(m_resource); }
4329
4332 {
4333 std::swap(m_resource, other.m_resource);
4334 return *this;
4335 }
4336
4338 constexpr TextRaw get() const { return m_resource; }
4339
4341 constexpr TextRaw release()
4342 {
4343 auto r = m_resource;
4344 m_resource = nullptr;
4345 return r;
4346 }
4347
4349 constexpr auto operator<=>(const Text& other) const = default;
4350
4352 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
4353
4355 constexpr explicit operator bool() const { return !!m_resource; }
4356
4358 constexpr operator TextParam() const { return {m_resource}; }
4359
4371 void Destroy();
4372
4392 void DrawSurface(Point p, SurfaceParam surface) const;
4393
4413 void DrawRenderer(FPoint p) const;
4414
4441 GPUAtlasDrawSequence* GetGPUDrawData() const;
4442
4454 PropertiesRef GetProperties() const;
4455
4471 void SetEngine(TextEngineParam engine);
4472
4486 TextEngineParam GetEngine() const;
4487
4508 bool SetFont(FontParam font);
4509
4523 FontRef GetFont() const;
4524
4539 void SetDirection(Direction direction);
4540
4553 Direction GetDirection() const;
4554
4571 void SetScript(Uint32 script);
4572
4590 Uint32 GetScript() const;
4591
4608 void SetColor(Color c);
4609
4626 void SetColorFloat(FColor c);
4627
4649 void GetColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const;
4650
4665 Color GetColor() const;
4666
4688 void GetColorFloat(float* r, float* g, float* b, float* a) const;
4689
4704 FColor GetColorFloat() const;
4705
4723 bool SetPosition(Point p);
4724
4740 bool GetPosition(int* x, int* y) const;
4741
4756 Point GetPosition() const;
4757
4774 void SetWrapWidth(int wrap_width);
4775
4790 int GetWrapWidth() const;
4791
4813 void SetWrapWhitespaceVisible(bool visible);
4814
4828 bool IsWrapWhitespaceVisible() const;
4829
4847 void SetString(std::string_view string);
4848
4870 void InsertString(int offset, std::string_view string);
4871
4889 void AppendString(std::string_view string);
4890
4913 void DeleteString(int offset, int length);
4914
4932 void GetSize(int* w, int* h) const;
4933
4950 Point GetSize() const;
4951
4971 void GetSubString(int offset, SubString* substring) const;
4972
4977
4982
4999
5019 void GetSubStringForLine(int line, SubString* substring) const;
5020
5033 {
5034 return GetSubStringsForRange(0);
5035 }
5036
5052 OwnArray<SubString*> GetSubStringsForRange(int offset, int length = -1) const;
5053
5070
5087 void GetSubStringForPoint(Point p, SubString* substring) const;
5088
5105 void GetPreviousSubString(const SubString& substring,
5106 SubString* previous) const;
5107
5123 void GetNextSubString(const SubString& substring, SubString* next) const;
5124
5139 void Update();
5140
5145 const char* GetText() const { return m_resource->text; }
5146
5148 int GetNumLines() const { return m_resource->num_lines; }
5149};
5150
5153{
5161 TextRef(TextParam resource = nullptr)
5162 : Text(resource.value)
5163 {
5164 }
5165
5167 TextRef(const TextRef& other)
5168 : Text(other.get())
5169 {
5170 }
5171
5173 ~TextRef() { release(); }
5174};
5175
5181{
5182 TextRef m_text;
5183
5184 SubString m_subString;
5185
5186 constexpr SubStringIterator(TextRef text)
5187 : m_text(text)
5188 , m_subString(0)
5189 {
5190 }
5191
5192public:
5196 {
5197 }
5198
5200 constexpr operator bool() const { return bool(m_text); }
5201
5203 constexpr const SubString& operator*() const { return m_subString; }
5204
5206 constexpr const SubString* operator->() const { return &m_subString; }
5207
5209 constexpr bool operator==(const SubStringIterator& other) const
5210 {
5211 return m_subString.offset == other.m_subString.offset;
5212 }
5213
5216 {
5217 m_text.GetNextSubString(m_subString, &m_subString);
5218 return *this;
5219 }
5220
5223 {
5224 auto curr = *this;
5225 m_text.GetNextSubString(m_subString, &m_subString);
5226 return curr;
5227 }
5228
5231 {
5232 m_text.GetPreviousSubString(m_subString, &m_subString);
5233 return *this;
5234 }
5235
5238 {
5239 auto curr = *this;
5240 m_text.GetPreviousSubString(m_subString, &m_subString);
5241 return curr;
5242 }
5243
5244 friend class Text;
5245};
5246
5261{
5262 return SurfaceTextEngine();
5263}
5264
5285inline void DrawSurfaceText(TextParam text, Point p, SurfaceParam surface)
5286{
5287 CheckError(TTF_DrawSurfaceText(text, p.x, p.y, surface));
5288}
5289
5290inline void Text::DrawSurface(Point p, SurfaceParam surface) const
5291{
5292 SDL::DrawSurfaceText(m_resource, p, surface);
5293}
5294
5312{
5313 TTF_DestroySurfaceTextEngine(engine);
5314}
5315
5317{
5319}
5320
5338{
5339 return RendererTextEngine(renderer);
5340}
5341
5367 PropertiesParam props)
5368{
5369 return RendererTextEngine(props);
5370}
5371
5372namespace prop::RendererTextEngine {
5373
5374constexpr auto RENDERER_POINTER =
5375 TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER;
5376
5377constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5378 TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER;
5379
5380} // namespace prop::RendererTextEngine
5381
5403{
5404 CheckError(TTF_DrawRendererText(text, p.x, p.y));
5405}
5406
5407inline void Text::DrawRenderer(FPoint p) const
5408{
5409 SDL::DrawRendererText(m_resource, p);
5410}
5411
5429{
5430 TTF_DestroyRendererTextEngine(engine);
5431}
5432
5434{
5436}
5437
5456{
5457 return GPUTextEngine(device);
5458}
5459
5485{
5486 return GPUTextEngine(props);
5487}
5488
5489namespace prop::GpuTextEngine {
5490
5491constexpr auto DEVICE_POINTER = TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER;
5492
5493constexpr auto ATLAS_TEXTURE_SIZE_NUMBER =
5494 TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER;
5495
5496} // namespace prop::GpuTextEngine
5497
5526{
5527 return TTF_GetGPUTextDrawData(text);
5528}
5529
5531{
5532 return SDL::GetGPUTextDrawData(m_resource);
5533}
5534
5552{
5553 TTF_DestroyGPUTextEngine(engine);
5554}
5555
5557
5574 GPUTextEngineWinding winding)
5575{
5576 TTF_SetGPUTextEngineWinding(engine, winding);
5577}
5578
5580{
5582}
5583
5601{
5602 return TTF_GetGPUTextEngineWinding(engine);
5603}
5604
5606{
5608}
5609
5628 FontParam font,
5629 std::string_view text)
5630{
5631 return Text(engine, font, text);
5632}
5633
5634inline Text TextEngine::CreateText(FontParam font, std::string_view text)
5635{
5636 return Text(m_resource, font, text);
5637}
5638
5652{
5653 return {CheckError(TTF_GetTextProperties(text))};
5654}
5655
5657{
5658 return SDL::GetTextProperties(m_resource);
5659}
5660
5677inline void SetTextEngine(TextParam text, TextEngineParam engine)
5678{
5679 CheckError(TTF_SetTextEngine(text, engine));
5680}
5681
5683{
5684 SDL::SetTextEngine(m_resource, engine);
5685}
5686
5702{
5703 return CheckError(TTF_GetTextEngine(text));
5704}
5705
5707{
5708 return SDL::GetTextEngine(m_resource);
5709}
5710
5732inline bool SetTextFont(TextParam text, FontParam font)
5733{
5734 return TTF_SetTextFont(text, font);
5735}
5736
5737inline bool Text::SetFont(FontParam font)
5738{
5739 return SDL::SetTextFont(m_resource, font);
5740}
5741
5757{
5758 return {CheckError(TTF_GetTextFont(text))};
5759}
5760
5761inline FontRef Text::GetFont() const { return SDL::GetTextFont(m_resource); }
5762
5778inline void SetTextDirection(TextParam text, Direction direction)
5779{
5780 CheckError(TTF_SetTextDirection(text, direction));
5781}
5782
5783inline void Text::SetDirection(Direction direction)
5784{
5785 SDL::SetTextDirection(m_resource, direction);
5786}
5787
5802{
5803 return TTF_GetTextDirection(text);
5804}
5805
5807{
5808 return SDL::GetTextDirection(m_resource);
5809}
5810
5828inline void SetTextScript(TextParam text, Uint32 script)
5829{
5830 CheckError(TTF_SetTextScript(text, script));
5831}
5832
5833inline void Text::SetScript(Uint32 script)
5834{
5835 SDL::SetTextScript(m_resource, script);
5836}
5837
5856inline Uint32 GetTextScript(TextParam text) { return TTF_GetTextScript(text); }
5857
5858inline Uint32 Text::GetScript() const { return SDL::GetTextScript(m_resource); }
5859
5877inline void SetTextColor(TextParam text, Color c)
5878{
5879 CheckError(TTF_SetTextColor(text, c.r, c.g, c.b, c.a));
5880}
5881
5882inline void Text::SetColor(Color c) { SDL::SetTextColor(m_resource, c); }
5883
5902{
5903 CheckError(TTF_SetTextColorFloat(text, c.r, c.g, c.b, c.a));
5904}
5905
5907{
5908 SDL::SetTextColorFloat(m_resource, c);
5909}
5910
5933inline void GetTextColor(TextParam text, Uint8* r, Uint8* g, Uint8* b, Uint8* a)
5934{
5935 CheckError(TTF_GetTextColor(text, r, g, b, a));
5936}
5937
5954{
5955 Color c;
5956 GetTextColor(text, &c.r, &c.g, &c.b, &c.a);
5957 return c;
5958}
5959
5960inline void Text::GetColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const
5961{
5962 SDL::GetTextColor(m_resource, r, g, b, a);
5963}
5964
5965inline Color Text::GetColor() const { return SDL::GetTextColor(m_resource); }
5966
5990 float* r,
5991 float* g,
5992 float* b,
5993 float* a)
5994{
5995 CheckError(TTF_GetTextColorFloat(text, r, g, b, a));
5996}
5997
6014{
6015 FColor c;
6016 GetTextColorFloat(text, &c.r, &c.g, &c.b, &c.a);
6017 return c;
6018}
6019
6020inline void Text::GetColorFloat(float* r, float* g, float* b, float* a) const
6021{
6022 SDL::GetTextColorFloat(m_resource, r, g, b, a);
6023}
6024
6026{
6027 return SDL::GetTextColorFloat(m_resource);
6028}
6029
6048inline bool SetTextPosition(TextParam text, Point p)
6049{
6050 return TTF_SetTextPosition(text, p.x, p.y);
6051}
6052
6054{
6055 return SDL::SetTextPosition(m_resource, p);
6056}
6057
6074inline bool GetTextPosition(TextParam text, int* x, int* y)
6075{
6076 return TTF_GetTextPosition(text, x, y);
6077}
6078
6096{
6097 Point p;
6098 CheckError(GetTextPosition(text, &p.x, &p.y));
6099 return p;
6100}
6101
6102inline bool Text::GetPosition(int* x, int* y) const
6103{
6104 return SDL::GetTextPosition(m_resource, x, y);
6105}
6106
6108{
6109 return SDL::GetTextPosition(m_resource);
6110}
6111
6129inline void SetTextWrapWidth(TextParam text, int wrap_width)
6130{
6131 CheckError(TTF_SetTextWrapWidth(text, wrap_width));
6132}
6133
6134inline void Text::SetWrapWidth(int wrap_width)
6135{
6136 SDL::SetTextWrapWidth(m_resource, wrap_width);
6137}
6138
6155{
6156 int w;
6157 CheckError(TTF_GetTextWrapWidth(text, &w));
6158 return w;
6159}
6160
6161inline int Text::GetWrapWidth() const
6162{
6163 return SDL::GetTextWrapWidth(m_resource);
6164}
6165
6188inline void SetTextWrapWhitespaceVisible(TextParam text, bool visible)
6189{
6190 CheckError(TTF_SetTextWrapWhitespaceVisible(text, visible));
6191}
6192
6193inline void Text::SetWrapWhitespaceVisible(bool visible)
6194{
6195 SDL::SetTextWrapWhitespaceVisible(m_resource, visible);
6196}
6197
6213{
6214 return TTF_TextWrapWhitespaceVisible(text);
6215}
6216
6218{
6219 return SDL::TextWrapWhitespaceVisible(m_resource);
6220}
6221
6240inline void SetTextString(TextParam text, std::string_view string)
6241{
6242 CheckError(TTF_SetTextString(text, string.data(), string.size()));
6243}
6244
6245inline void Text::SetString(std::string_view string)
6246{
6247 SDL::SetTextString(m_resource, string);
6248}
6249
6273 int offset,
6274 std::string_view string)
6275{
6276 CheckError(TTF_InsertTextString(text, offset, string.data(), string.size()));
6277}
6278
6279inline void Text::InsertString(int offset, std::string_view string)
6280{
6281 SDL::InsertTextString(m_resource, offset, string);
6282}
6283
6302inline void AppendTextString(TextParam text, std::string_view string)
6303{
6304 CheckError(TTF_AppendTextString(text, string.data(), string.size()));
6305}
6306
6307inline void Text::AppendString(std::string_view string)
6308{
6309 SDL::AppendTextString(m_resource, string);
6310}
6311
6335inline void DeleteTextString(TextParam text, int offset, int length)
6336{
6337 CheckError(TTF_DeleteTextString(text, offset, length));
6338}
6339
6340inline void Text::DeleteString(int offset, int length)
6341{
6342 SDL::DeleteTextString(m_resource, offset, length);
6343}
6344
6363inline void GetTextSize(TextParam text, int* w, int* h)
6364{
6365 CheckError(TTF_GetTextSize(text, w, h));
6366}
6367
6385{
6386 Point p;
6387 GetTextSize(text, &p.x, &p.y);
6388 return p;
6389}
6390
6391inline void Text::GetSize(int* w, int* h) const
6392{
6393 SDL::GetTextSize(m_resource, w, h);
6394}
6395
6396inline Point Text::GetSize() const { return SDL::GetTextSize(m_resource); }
6397
6418inline void GetTextSubString(TextParam text, int offset, SubString* substring)
6419{
6420 CheckError(TTF_GetTextSubString(text, offset, substring));
6421}
6422
6423inline void Text::GetSubString(int offset, SubString* substring) const
6424{
6425 SDL::GetTextSubString(m_resource, offset, substring);
6426}
6427
6449 int line,
6450 SubString* substring)
6451{
6452 CheckError(TTF_GetTextSubStringForLine(text, line, substring));
6453}
6454
6455inline void Text::GetSubStringForLine(int line, SubString* substring) const
6456{
6457 SDL::GetTextSubStringForLine(m_resource, line, substring);
6458}
6459
6477 int offset,
6478 int length)
6479{
6480 int count = 0;
6481 auto data = TTF_GetTextSubStringsForRange(text, offset, length, &count);
6482 return OwnArray<SubString*>{data, size_t(count)};
6483}
6484
6486 int length) const
6487{
6488 return SDL::GetTextSubStringsForRange(m_resource, offset, length);
6489}
6490
6509 Point p,
6510 SubString* substring)
6511{
6512 CheckError(TTF_GetTextSubStringForPoint(text, p.x, p.y, substring));
6513}
6514
6515inline void Text::GetSubStringForPoint(Point p, SubString* substring) const
6516{
6517 SDL::GetTextSubStringForPoint(m_resource, p, substring);
6518}
6519
6538 const SubString& substring,
6539 SubString* previous)
6540{
6541 CheckError(TTF_GetPreviousTextSubString(text, &substring, previous));
6542}
6543
6544inline void Text::GetPreviousSubString(const SubString& substring,
6545 SubString* previous) const
6546{
6547 SDL::GetPreviousTextSubString(m_resource, substring, previous);
6548}
6549
6567 const SubString& substring,
6568 SubString* next)
6569{
6570 CheckError(TTF_GetNextTextSubString(text, &substring, next));
6571}
6572
6573inline void Text::GetNextSubString(const SubString& substring,
6574 SubString* next) const
6575{
6576 SDL::GetNextTextSubString(m_resource, substring, next);
6577}
6578
6594inline void UpdateText(TextParam text) { CheckError(TTF_UpdateText(text)); }
6595
6596inline void Text::Update() { SDL::UpdateText(m_resource); }
6597
6610inline void DestroyText(TextRaw text) { TTF_DestroyText(text); }
6611
6612inline void Text::Destroy() { DestroyText(release()); }
6613
6636inline void CloseFont(FontRaw font) { TTF_CloseFont(font); }
6637
6638inline void Font::Close() { CloseFont(release()); }
6639
6641
6642} // namespace SDL
6643
6644#endif // defined(SDL3PP_ENABLE_TTF) || defined(SDL3PP_DOC)
6645
6646#endif /* SDL3PP_TTF_H_ */
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