native_audio 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/assets/include/GL/glew.h +26427 -26427
  3. data/assets/include/GLES2/gl2.h +656 -656
  4. data/assets/include/GLES2/gl2ext.h +3949 -3949
  5. data/assets/include/GLES2/gl2ext_angle.h +701 -701
  6. data/assets/include/GLES2/gl2platform.h +27 -27
  7. data/assets/include/GLES3/gl3.h +1192 -1192
  8. data/assets/include/GLES3/gl31.h +1507 -1507
  9. data/assets/include/GLES3/gl32.h +1808 -1808
  10. data/assets/include/GLES3/gl3platform.h +27 -27
  11. data/assets/include/KHR/khrplatform.h +290 -290
  12. data/assets/include/SDL2/SDL.h +233 -233
  13. data/assets/include/SDL2/SDL_assert.h +326 -326
  14. data/assets/include/SDL2/SDL_atomic.h +415 -415
  15. data/assets/include/SDL2/SDL_audio.h +1500 -1500
  16. data/assets/include/SDL2/SDL_bits.h +126 -126
  17. data/assets/include/SDL2/SDL_blendmode.h +198 -198
  18. data/assets/include/SDL2/SDL_clipboard.h +141 -141
  19. data/assets/include/SDL2/SDL_config.h +61 -61
  20. data/assets/include/SDL2/SDL_config_android.h +194 -194
  21. data/assets/include/SDL2/SDL_config_emscripten.h +218 -218
  22. data/assets/include/SDL2/SDL_config_iphoneos.h +217 -217
  23. data/assets/include/SDL2/SDL_config_macosx.h +277 -277
  24. data/assets/include/SDL2/SDL_config_minimal.h +95 -95
  25. data/assets/include/SDL2/SDL_config_ngage.h +89 -89
  26. data/assets/include/SDL2/SDL_config_os2.h +207 -207
  27. data/assets/include/SDL2/SDL_config_pandora.h +141 -141
  28. data/assets/include/SDL2/SDL_config_windows.h +331 -331
  29. data/assets/include/SDL2/SDL_config_wingdk.h +253 -253
  30. data/assets/include/SDL2/SDL_config_winrt.h +220 -220
  31. data/assets/include/SDL2/SDL_config_xbox.h +235 -235
  32. data/assets/include/SDL2/SDL_copying.h +20 -20
  33. data/assets/include/SDL2/SDL_cpuinfo.h +594 -594
  34. data/assets/include/SDL2/SDL_egl.h +2352 -2352
  35. data/assets/include/SDL2/SDL_endian.h +348 -348
  36. data/assets/include/SDL2/SDL_error.h +163 -163
  37. data/assets/include/SDL2/SDL_events.h +1166 -1166
  38. data/assets/include/SDL2/SDL_filesystem.h +149 -149
  39. data/assets/include/SDL2/SDL_gamecontroller.h +1074 -1074
  40. data/assets/include/SDL2/SDL_gesture.h +117 -117
  41. data/assets/include/SDL2/SDL_guid.h +100 -100
  42. data/assets/include/SDL2/SDL_haptic.h +1341 -1341
  43. data/assets/include/SDL2/SDL_hidapi.h +451 -451
  44. data/assets/include/SDL2/SDL_hints.h +2569 -2569
  45. data/assets/include/SDL2/SDL_image.h +2173 -2173
  46. data/assets/include/SDL2/SDL_joystick.h +1066 -1066
  47. data/assets/include/SDL2/SDL_keyboard.h +353 -353
  48. data/assets/include/SDL2/SDL_keycode.h +358 -358
  49. data/assets/include/SDL2/SDL_loadso.h +115 -115
  50. data/assets/include/SDL2/SDL_locale.h +103 -103
  51. data/assets/include/SDL2/SDL_log.h +404 -404
  52. data/assets/include/SDL2/SDL_main.h +275 -275
  53. data/assets/include/SDL2/SDL_messagebox.h +193 -193
  54. data/assets/include/SDL2/SDL_metal.h +113 -113
  55. data/assets/include/SDL2/SDL_misc.h +79 -79
  56. data/assets/include/SDL2/SDL_mixer.h +2784 -2784
  57. data/assets/include/SDL2/SDL_mouse.h +465 -465
  58. data/assets/include/SDL2/SDL_mutex.h +471 -471
  59. data/assets/include/SDL2/SDL_name.h +33 -33
  60. data/assets/include/SDL2/SDL_opengl.h +2132 -2132
  61. data/assets/include/SDL2/SDL_opengl_glext.h +13209 -13209
  62. data/assets/include/SDL2/SDL_opengles.h +39 -39
  63. data/assets/include/SDL2/SDL_opengles2.h +52 -52
  64. data/assets/include/SDL2/SDL_opengles2_gl2.h +656 -656
  65. data/assets/include/SDL2/SDL_opengles2_gl2ext.h +4033 -4033
  66. data/assets/include/SDL2/SDL_opengles2_gl2platform.h +27 -27
  67. data/assets/include/SDL2/SDL_opengles2_khrplatform.h +311 -311
  68. data/assets/include/SDL2/SDL_pixels.h +644 -644
  69. data/assets/include/SDL2/SDL_platform.h +261 -261
  70. data/assets/include/SDL2/SDL_power.h +88 -88
  71. data/assets/include/SDL2/SDL_quit.h +58 -58
  72. data/assets/include/SDL2/SDL_rect.h +376 -376
  73. data/assets/include/SDL2/SDL_render.h +1919 -1919
  74. data/assets/include/SDL2/SDL_revision.h +6 -6
  75. data/assets/include/SDL2/SDL_rwops.h +841 -841
  76. data/assets/include/SDL2/SDL_scancode.h +438 -438
  77. data/assets/include/SDL2/SDL_sensor.h +322 -322
  78. data/assets/include/SDL2/SDL_shape.h +155 -155
  79. data/assets/include/SDL2/SDL_stdinc.h +830 -830
  80. data/assets/include/SDL2/SDL_surface.h +997 -997
  81. data/assets/include/SDL2/SDL_system.h +623 -623
  82. data/assets/include/SDL2/SDL_syswm.h +386 -386
  83. data/assets/include/SDL2/SDL_test.h +69 -69
  84. data/assets/include/SDL2/SDL_test_assert.h +105 -105
  85. data/assets/include/SDL2/SDL_test_common.h +236 -236
  86. data/assets/include/SDL2/SDL_test_compare.h +69 -69
  87. data/assets/include/SDL2/SDL_test_crc32.h +124 -124
  88. data/assets/include/SDL2/SDL_test_font.h +168 -168
  89. data/assets/include/SDL2/SDL_test_fuzzer.h +386 -386
  90. data/assets/include/SDL2/SDL_test_harness.h +134 -134
  91. data/assets/include/SDL2/SDL_test_images.h +78 -78
  92. data/assets/include/SDL2/SDL_test_log.h +67 -67
  93. data/assets/include/SDL2/SDL_test_md5.h +129 -129
  94. data/assets/include/SDL2/SDL_test_memory.h +63 -63
  95. data/assets/include/SDL2/SDL_test_random.h +115 -115
  96. data/assets/include/SDL2/SDL_thread.h +464 -464
  97. data/assets/include/SDL2/SDL_timer.h +222 -222
  98. data/assets/include/SDL2/SDL_touch.h +150 -150
  99. data/assets/include/SDL2/SDL_ttf.h +2316 -2316
  100. data/assets/include/SDL2/SDL_types.h +29 -29
  101. data/assets/include/SDL2/SDL_version.h +204 -204
  102. data/assets/include/SDL2/SDL_video.h +2150 -2150
  103. data/assets/include/SDL2/SDL_vulkan.h +215 -215
  104. data/assets/include/SDL2/begin_code.h +187 -187
  105. data/assets/include/SDL2/close_code.h +40 -40
  106. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libFLAC.a +0 -0
  107. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2.a +0 -0
  108. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libSDL2_mixer.a +0 -0
  109. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libglew32.a +0 -0
  110. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmodplug.a +0 -0
  111. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libmpg123.a +0 -0
  112. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libogg.a +0 -0
  113. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopus.a +0 -0
  114. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libopusfile.a +0 -0
  115. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libsndfile.a +0 -0
  116. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libssp.a +1 -1
  117. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libstdc++.a +0 -0
  118. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbis.a +0 -0
  119. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libvorbisfile.a +0 -0
  120. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libz.a +0 -0
  121. data/assets/windows/mingw-w64-ucrt-x86_64/lib/libzstd.a +0 -0
  122. data/assets/windows/mingw-w64-x86_64/lib/libFLAC.a +0 -0
  123. data/assets/windows/mingw-w64-x86_64/lib/libSDL2.a +0 -0
  124. data/assets/windows/mingw-w64-x86_64/lib/libSDL2_mixer.a +0 -0
  125. data/assets/windows/mingw-w64-x86_64/lib/libglew32.a +0 -0
  126. data/assets/windows/mingw-w64-x86_64/lib/libmodplug.a +0 -0
  127. data/assets/windows/mingw-w64-x86_64/lib/libmpg123.a +0 -0
  128. data/assets/windows/mingw-w64-x86_64/lib/libogg.a +0 -0
  129. data/assets/windows/mingw-w64-x86_64/lib/libopus.a +0 -0
  130. data/assets/windows/mingw-w64-x86_64/lib/libopusfile.a +0 -0
  131. data/assets/windows/mingw-w64-x86_64/lib/libsndfile.a +0 -0
  132. data/assets/windows/mingw-w64-x86_64/lib/libssp.a +1 -1
  133. data/assets/windows/mingw-w64-x86_64/lib/libstdc++.a +0 -0
  134. data/assets/windows/mingw-w64-x86_64/lib/libvorbis.a +0 -0
  135. data/assets/windows/mingw-w64-x86_64/lib/libvorbisfile.a +0 -0
  136. data/assets/windows/mingw-w64-x86_64/lib/libz.a +0 -0
  137. data/assets/windows/mingw-w64-x86_64/lib/libzstd.a +0 -0
  138. data/ext/audio.c +80 -80
  139. data/ext/extconf.h +3 -3
  140. data/ext/extconf.rb +173 -177
  141. data/lib/audio.bundle +0 -0
  142. data/lib/audio.so +0 -0
  143. data/lib/native_audio.rb +50 -50
  144. metadata +4 -9
  145. data/ext/Makefile +0 -270
  146. data/ext/audio.o +0 -0
  147. data/ext/mkmf.log +0 -7
@@ -1,2316 +1,2316 @@
1
- /*
2
- SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts
3
- Copyright (C) 2001-2022 Sam Lantinga <slouken@libsdl.org>
4
-
5
- This software is provided 'as-is', without any express or implied
6
- warranty. In no event will the authors be held liable for any damages
7
- arising from the use of this software.
8
-
9
- Permission is granted to anyone to use this software for any purpose,
10
- including commercial applications, and to alter it and redistribute it
11
- freely, subject to the following restrictions:
12
-
13
- 1. The origin of this software must not be misrepresented; you must not
14
- claim that you wrote the original software. If you use this software
15
- in a product, an acknowledgment in the product documentation would be
16
- appreciated but is not required.
17
- 2. Altered source versions must be plainly marked as such, and must not be
18
- misrepresented as being the original software.
19
- 3. This notice may not be removed or altered from any source distribution.
20
- */
21
-
22
-
23
- /**
24
- * \file SDL_ttf.h
25
- *
26
- * Header file for SDL_ttf library
27
- *
28
- * This library is a wrapper around the excellent FreeType 2.0 library,
29
- * available at: https://www.freetype.org/
30
- *
31
- * Note: In many places, SDL_ttf will say "glyph" when it means "code point."
32
- * Unicode is hard, we learn as we go, and we apologize for adding to the
33
- * confusion.
34
- *
35
- */
36
- #ifndef SDL_TTF_H_
37
- #define SDL_TTF_H_
38
-
39
- #include "SDL.h"
40
- #include "begin_code.h"
41
-
42
- /* Set up for C function definitions, even when using C++ */
43
- #ifdef __cplusplus
44
- extern "C" {
45
- #endif
46
-
47
- /**
48
- * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
49
- */
50
- #define SDL_TTF_MAJOR_VERSION 2
51
- #define SDL_TTF_MINOR_VERSION 20
52
- #define SDL_TTF_PATCHLEVEL 1
53
-
54
- /**
55
- * This macro can be used to fill a version structure with the compile-time
56
- * version of the SDL_ttf library.
57
- */
58
- #define SDL_TTF_VERSION(X) \
59
- { \
60
- (X)->major = SDL_TTF_MAJOR_VERSION; \
61
- (X)->minor = SDL_TTF_MINOR_VERSION; \
62
- (X)->patch = SDL_TTF_PATCHLEVEL; \
63
- }
64
-
65
- /**
66
- * Backwards compatibility
67
- */
68
- #define TTF_MAJOR_VERSION SDL_TTF_MAJOR_VERSION
69
- #define TTF_MINOR_VERSION SDL_TTF_MINOR_VERSION
70
- #define TTF_PATCHLEVEL SDL_TTF_PATCHLEVEL
71
- #define TTF_VERSION(X) SDL_TTF_VERSION(X)
72
-
73
- #if SDL_TTF_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3
74
- /**
75
- * This is the version number macro for the current SDL_ttf version.
76
- *
77
- * In versions higher than 2.9.0, the minor version overflows into
78
- * the thousands digit: for example, 2.23.0 is encoded as 4300.
79
- * This macro will not be available in SDL 3.x or SDL_ttf 3.x.
80
- *
81
- * \deprecated, use SDL_TTF_VERSION_ATLEAST or SDL_TTF_VERSION instead.
82
- */
83
- #define SDL_TTF_COMPILEDVERSION \
84
- SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL)
85
- #endif /* SDL_TTF_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3 */
86
-
87
- /**
88
- * This macro will evaluate to true if compiled with SDL_ttf at least X.Y.Z.
89
- */
90
- #define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
91
- ((SDL_TTF_MAJOR_VERSION >= X) && \
92
- (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
93
- (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || SDL_TTF_PATCHLEVEL >= Z))
94
-
95
- /* Make sure this is defined (only available in newer SDL versions) */
96
- #ifndef SDL_DEPRECATED
97
- #define SDL_DEPRECATED
98
- #endif
99
-
100
- /**
101
- * Query the version of SDL_ttf that the program is linked against.
102
- *
103
- * This function gets the version of the dynamically linked SDL_ttf library.
104
- * This is separate from the SDL_TTF_VERSION() macro, which tells you what
105
- * version of the SDL_ttf headers you compiled against.
106
- *
107
- * This returns static internal data; do not free or modify it!
108
- *
109
- * \returns a pointer to the version information.
110
- *
111
- * \since This function is available since SDL_ttf 2.0.12.
112
- */
113
- extern DECLSPEC const SDL_version * SDLCALL TTF_Linked_Version(void);
114
-
115
- /**
116
- * Query the version of the FreeType library in use.
117
- *
118
- * TTF_Init() should be called before calling this function.
119
- *
120
- * \param major to be filled in with the major version number. Can be NULL.
121
- * \param minor to be filled in with the minor version number. Can be NULL.
122
- * \param patch to be filled in with the param version number. Can be NULL.
123
- *
124
- * \since This function is available since SDL_ttf 2.0.18.
125
- *
126
- * \sa TTF_Init
127
- */
128
- extern DECLSPEC void SDLCALL TTF_GetFreeTypeVersion(int *major, int *minor, int *patch);
129
-
130
- /**
131
- * Query the version of the HarfBuzz library in use.
132
- *
133
- * If HarfBuzz is not available, the version reported is 0.0.0.
134
- *
135
- * \param major to be filled in with the major version number. Can be NULL.
136
- * \param minor to be filled in with the minor version number. Can be NULL.
137
- * \param patch to be filled in with the param version number. Can be NULL.
138
- *
139
- * \since This function is available since SDL_ttf 2.0.18.
140
- */
141
- extern DECLSPEC void SDLCALL TTF_GetHarfBuzzVersion(int *major, int *minor, int *patch);
142
-
143
- /**
144
- * ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark)
145
- */
146
- #define UNICODE_BOM_NATIVE 0xFEFF
147
- #define UNICODE_BOM_SWAPPED 0xFFFE
148
-
149
- /**
150
- * Tell SDL_ttf whether UNICODE text is generally byteswapped.
151
- *
152
- * A UNICODE BOM character in a string will override this setting for the
153
- * remainder of that string.
154
- *
155
- * \param swapped boolean to indicate whether text is byteswapped
156
- *
157
- * \since This function is available since SDL_ttf 2.0.12.
158
- */
159
- extern DECLSPEC void SDLCALL TTF_ByteSwappedUNICODE(SDL_bool swapped);
160
-
161
- /**
162
- * The internal structure containing font information. Opaque data!
163
- */
164
- typedef struct _TTF_Font TTF_Font;
165
-
166
- /**
167
- * Initialize SDL_ttf.
168
- *
169
- * You must successfully call this function before it is safe to call any
170
- * other function in this library, with one exception: a human-readable error
171
- * message can be retrieved from TTF_GetError() if this function fails.
172
- *
173
- * SDL must be initialized before calls to functions in this library, because
174
- * this library uses utility functions from the SDL library.
175
- *
176
- * It is safe to call this more than once; the library keeps a counter of init
177
- * calls, and decrements it on each call to TTF_Quit, so you must pair your
178
- * init and quit calls.
179
- *
180
- * \returns 0 on success, -1 on error.
181
- *
182
- * \since This function is available since SDL_ttf 2.0.12.
183
- *
184
- * \sa TTF_Quit
185
- */
186
- extern DECLSPEC int SDLCALL TTF_Init(void);
187
-
188
- /**
189
- * Create a font from a file, using a specified point size.
190
- *
191
- * Some .fon fonts will have several sizes embedded in the file, so the point
192
- * size becomes the index of choosing which size. If the value is too high,
193
- * the last indexed size will be the default.
194
- *
195
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
196
- *
197
- * \param file path to font file.
198
- * \param ptsize point size to use for the newly-opened font.
199
- * \returns a valid TTF_Font, or NULL on error.
200
- *
201
- * \since This function is available since SDL_ttf 2.0.12.
202
- *
203
- * \sa TTF_CloseFont
204
- */
205
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFont(const char *file, int ptsize);
206
-
207
- /**
208
- * Create a font from a file, using a specified face index.
209
- *
210
- * Some .fon fonts will have several sizes embedded in the file, so the point
211
- * size becomes the index of choosing which size. If the value is too high,
212
- * the last indexed size will be the default.
213
- *
214
- * Some fonts have multiple "faces" included. The index specifies which face
215
- * to use from the font file. Font files with only one face should specify
216
- * zero for the index.
217
- *
218
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
219
- *
220
- * \param file path to font file.
221
- * \param ptsize point size to use for the newly-opened font.
222
- * \param index index of the face in the font file.
223
- * \returns a valid TTF_Font, or NULL on error.
224
- *
225
- * \since This function is available since SDL_ttf 2.0.12.
226
- *
227
- * \sa TTF_CloseFont
228
- */
229
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndex(const char *file, int ptsize, long index);
230
-
231
- /**
232
- * Create a font from an SDL_RWops, using a specified point size.
233
- *
234
- * Some .fon fonts will have several sizes embedded in the file, so the point
235
- * size becomes the index of choosing which size. If the value is too high,
236
- * the last indexed size will be the default.
237
- *
238
- * If `freesrc` is non-zero, the RWops will be closed before returning,
239
- * whether this function succeeds or not. SDL_ttf reads everything it needs
240
- * from the RWops during this call in any case.
241
- *
242
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
243
- *
244
- * \param src an SDL_RWops to provide a font file's data.
245
- * \param freesrc non-zero to close the RWops before returning, zero to leave
246
- * it open.
247
- * \param ptsize point size to use for the newly-opened font.
248
- * \returns a valid TTF_Font, or NULL on error.
249
- *
250
- * \since This function is available since SDL_ttf 2.0.12.
251
- *
252
- * \sa TTF_CloseFont
253
- */
254
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontRW(SDL_RWops *src, int freesrc, int ptsize);
255
-
256
- /**
257
- * Create a font from an SDL_RWops, using a specified face index.
258
- *
259
- * Some .fon fonts will have several sizes embedded in the file, so the point
260
- * size becomes the index of choosing which size. If the value is too high,
261
- * the last indexed size will be the default.
262
- *
263
- * If `freesrc` is non-zero, the RWops will be closed before returning,
264
- * whether this function succeeds or not. SDL_ttf reads everything it needs
265
- * from the RWops during this call in any case.
266
- *
267
- * Some fonts have multiple "faces" included. The index specifies which face
268
- * to use from the font file. Font files with only one face should specify
269
- * zero for the index.
270
- *
271
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
272
- *
273
- * \param src an SDL_RWops to provide a font file's data.
274
- * \param freesrc non-zero to close the RWops before returning, zero to leave
275
- * it open.
276
- * \param ptsize point size to use for the newly-opened font.
277
- * \param index index of the face in the font file.
278
- * \returns a valid TTF_Font, or NULL on error.
279
- *
280
- * \since This function is available since SDL_ttf 2.0.12.
281
- *
282
- * \sa TTF_CloseFont
283
- */
284
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexRW(SDL_RWops *src, int freesrc, int ptsize, long index);
285
-
286
- /**
287
- * Create a font from a file, using target resolutions (in DPI).
288
- *
289
- * DPI scaling only applies to scalable fonts (e.g. TrueType).
290
- *
291
- * Some .fon fonts will have several sizes embedded in the file, so the point
292
- * size becomes the index of choosing which size. If the value is too high,
293
- * the last indexed size will be the default.
294
- *
295
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
296
- *
297
- * \param file path to font file.
298
- * \param ptsize point size to use for the newly-opened font.
299
- * \param hdpi the target horizontal DPI.
300
- * \param vdpi the target vertical DPI.
301
- * \returns a valid TTF_Font, or NULL on error.
302
- *
303
- * \since This function is available since SDL_ttf 2.0.18.
304
- *
305
- * \sa TTF_CloseFont
306
- */
307
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPI(const char *file, int ptsize, unsigned int hdpi, unsigned int vdpi);
308
-
309
- /**
310
- * Create a font from a file, using target resolutions (in DPI).
311
- *
312
- * DPI scaling only applies to scalable fonts (e.g. TrueType).
313
- *
314
- * Some .fon fonts will have several sizes embedded in the file, so the point
315
- * size becomes the index of choosing which size. If the value is too high,
316
- * the last indexed size will be the default.
317
- *
318
- * Some fonts have multiple "faces" included. The index specifies which face
319
- * to use from the font file. Font files with only one face should specify
320
- * zero for the index.
321
- *
322
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
323
- *
324
- * \param file path to font file.
325
- * \param ptsize point size to use for the newly-opened font.
326
- * \param index index of the face in the font file.
327
- * \param hdpi the target horizontal DPI.
328
- * \param vdpi the target vertical DPI.
329
- * \returns a valid TTF_Font, or NULL on error.
330
- *
331
- * \since This function is available since SDL_ttf 2.0.18.
332
- *
333
- * \sa TTF_CloseFont
334
- */
335
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPI(const char *file, int ptsize, long index, unsigned int hdpi, unsigned int vdpi);
336
-
337
- /**
338
- * Opens a font from an SDL_RWops with target resolutions (in DPI).
339
- *
340
- * DPI scaling only applies to scalable fonts (e.g. TrueType).
341
- *
342
- * Some .fon fonts will have several sizes embedded in the file, so the point
343
- * size becomes the index of choosing which size. If the value is too high,
344
- * the last indexed size will be the default.
345
- *
346
- * If `freesrc` is non-zero, the RWops will be closed before returning,
347
- * whether this function succeeds or not. SDL_ttf reads everything it needs
348
- * from the RWops during this call in any case.
349
- *
350
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
351
- *
352
- * \param src an SDL_RWops to provide a font file's data.
353
- * \param freesrc non-zero to close the RWops before returning, zero to leave
354
- * it open.
355
- * \param ptsize point size to use for the newly-opened font.
356
- * \param hdpi the target horizontal DPI.
357
- * \param vdpi the target vertical DPI.
358
- * \returns a valid TTF_Font, or NULL on error.
359
- *
360
- * \since This function is available since SDL_ttf 2.0.18.
361
- *
362
- * \sa TTF_CloseFont
363
- */
364
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPIRW(SDL_RWops *src, int freesrc, int ptsize, unsigned int hdpi, unsigned int vdpi);
365
-
366
- /**
367
- * Opens a font from an SDL_RWops with target resolutions (in DPI).
368
- *
369
- * DPI scaling only applies to scalable fonts (e.g. TrueType).
370
- *
371
- * Some .fon fonts will have several sizes embedded in the file, so the point
372
- * size becomes the index of choosing which size. If the value is too high,
373
- * the last indexed size will be the default.
374
- *
375
- * If `freesrc` is non-zero, the RWops will be closed before returning,
376
- * whether this function succeeds or not. SDL_ttf reads everything it needs
377
- * from the RWops during this call in any case.
378
- *
379
- * Some fonts have multiple "faces" included. The index specifies which face
380
- * to use from the font file. Font files with only one face should specify
381
- * zero for the index.
382
- *
383
- * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
384
- *
385
- * \param src an SDL_RWops to provide a font file's data.
386
- * \param freesrc non-zero to close the RWops before returning, zero to leave
387
- * it open.
388
- * \param ptsize point size to use for the newly-opened font.
389
- * \param index index of the face in the font file.
390
- * \param hdpi the target horizontal DPI.
391
- * \param vdpi the target vertical DPI.
392
- * \returns a valid TTF_Font, or NULL on error.
393
- *
394
- * \since This function is available since SDL_ttf 2.0.18.
395
- *
396
- * \sa TTF_CloseFont
397
- */
398
- extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPIRW(SDL_RWops *src, int freesrc, int ptsize, long index, unsigned int hdpi, unsigned int vdpi);
399
-
400
- /**
401
- * Set a font's size dynamically.
402
- *
403
- * This clears already-generated glyphs, if any, from the cache.
404
- *
405
- * \param font the font to resize.
406
- * \param ptsize the new point size.
407
- * \returns 0 if successful, -1 on error
408
- *
409
- * \since This function is available since SDL_ttf 2.0.18.
410
- */
411
- extern DECLSPEC int SDLCALL TTF_SetFontSize(TTF_Font *font, int ptsize);
412
-
413
- /**
414
- * Set font size dynamically with target resolutions (in DPI).
415
- *
416
- * This clears already-generated glyphs, if any, from the cache.
417
- *
418
- * \param font the font to resize.
419
- * \param ptsize the new point size.
420
- * \param hdpi the target horizontal DPI.
421
- * \param vdpi the target vertical DPI.
422
- * \returns 0 if successful, -1 on error.
423
- *
424
- * \since This function is available since SDL_ttf 2.0.18.
425
- */
426
- extern DECLSPEC int SDLCALL TTF_SetFontSizeDPI(TTF_Font *font, int ptsize, unsigned int hdpi, unsigned int vdpi);
427
-
428
- /**
429
- * Font style flags
430
- */
431
- #define TTF_STYLE_NORMAL 0x00
432
- #define TTF_STYLE_BOLD 0x01
433
- #define TTF_STYLE_ITALIC 0x02
434
- #define TTF_STYLE_UNDERLINE 0x04
435
- #define TTF_STYLE_STRIKETHROUGH 0x08
436
-
437
- /**
438
- * Query a font's current style.
439
- *
440
- * The font styles are a set of bit flags, OR'd together:
441
- *
442
- * - `TTF_STYLE_NORMAL` (is zero)
443
- * - `TTF_STYLE_BOLD`
444
- * - `TTF_STYLE_ITALIC`
445
- * - `TTF_STYLE_UNDERLINE`
446
- * - `TTF_STYLE_STRIKETHROUGH`
447
- *
448
- * \param font the font to query.
449
- * \returns the current font style, as a set of bit flags.
450
- *
451
- * \since This function is available since SDL_ttf 2.0.12.
452
- *
453
- * \sa TTF_SetFontStyle
454
- */
455
- extern DECLSPEC int SDLCALL TTF_GetFontStyle(const TTF_Font *font);
456
-
457
- /**
458
- * Set a font's current style.
459
- *
460
- * Setting the style clears already-generated glyphs, if any, from the cache.
461
- *
462
- * The font styles are a set of bit flags, OR'd together:
463
- *
464
- * - `TTF_STYLE_NORMAL` (is zero)
465
- * - `TTF_STYLE_BOLD`
466
- * - `TTF_STYLE_ITALIC`
467
- * - `TTF_STYLE_UNDERLINE`
468
- * - `TTF_STYLE_STRIKETHROUGH`
469
- *
470
- * \param font the font to set a new style on.
471
- * \param style the new style values to set, OR'd together.
472
- *
473
- * \since This function is available since SDL_ttf 2.0.12.
474
- *
475
- * \sa TTF_GetFontStyle
476
- */
477
- extern DECLSPEC void SDLCALL TTF_SetFontStyle(TTF_Font *font, int style);
478
-
479
- /**
480
- * Query a font's current outline.
481
- *
482
- * \param font the font to query.
483
- * \returns the font's current outline value.
484
- *
485
- * \since This function is available since SDL_ttf 2.0.12.
486
- *
487
- * \sa TTF_SetFontOutline
488
- */
489
- extern DECLSPEC int SDLCALL TTF_GetFontOutline(const TTF_Font *font);
490
-
491
- /**
492
- * Set a font's current outline.
493
- *
494
- * \param font the font to set a new outline on.
495
- * \param outline positive outline value, 0 to default.
496
- *
497
- * \since This function is available since SDL_ttf 2.0.12.
498
- *
499
- * \sa TTF_GetFontOutline
500
- */
501
- extern DECLSPEC void SDLCALL TTF_SetFontOutline(TTF_Font *font, int outline);
502
-
503
-
504
- /**
505
- * Hinting flags
506
- */
507
- #define TTF_HINTING_NORMAL 0
508
- #define TTF_HINTING_LIGHT 1
509
- #define TTF_HINTING_MONO 2
510
- #define TTF_HINTING_NONE 3
511
- #define TTF_HINTING_LIGHT_SUBPIXEL 4
512
-
513
- /**
514
- * Query a font's current FreeType hinter setting.
515
- *
516
- * The hinter setting is a single value:
517
- *
518
- * - `TTF_HINTING_NORMAL`
519
- * - `TTF_HINTING_LIGHT`
520
- * - `TTF_HINTING_MONO`
521
- * - `TTF_HINTING_NONE`
522
- * - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 2.0.18 and later)
523
- *
524
- * \param font the font to query.
525
- * \returns the font's current hinter value.
526
- *
527
- * \since This function is available since SDL_ttf 2.0.12.
528
- *
529
- * \sa TTF_SetFontHinting
530
- */
531
- extern DECLSPEC int SDLCALL TTF_GetFontHinting(const TTF_Font *font);
532
-
533
- /**
534
- * Set a font's current hinter setting.
535
- *
536
- * Setting it clears already-generated glyphs, if any, from the cache.
537
- *
538
- * The hinter setting is a single value:
539
- *
540
- * - `TTF_HINTING_NORMAL`
541
- * - `TTF_HINTING_LIGHT`
542
- * - `TTF_HINTING_MONO`
543
- * - `TTF_HINTING_NONE`
544
- * - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 2.0.18 and later)
545
- *
546
- * \param font the font to set a new hinter setting on.
547
- * \param hinting the new hinter setting.
548
- *
549
- * \since This function is available since SDL_ttf 2.0.12.
550
- *
551
- * \sa TTF_GetFontHinting
552
- */
553
- extern DECLSPEC void SDLCALL TTF_SetFontHinting(TTF_Font *font, int hinting);
554
-
555
- /**
556
- * Special layout option for rendering wrapped text
557
- */
558
- #define TTF_WRAPPED_ALIGN_LEFT 0
559
- #define TTF_WRAPPED_ALIGN_CENTER 1
560
- #define TTF_WRAPPED_ALIGN_RIGHT 2
561
-
562
- /**
563
- * Query a font's current wrap alignment option.
564
- *
565
- * The wrap alignment option can be one of the following:
566
- *
567
- * - `TTF_WRAPPED_ALIGN_LEFT`
568
- * - `TTF_WRAPPED_ALIGN_CENTER`
569
- * - `TTF_WRAPPED_ALIGN_RIGHT`
570
- *
571
- * \param font the font to query.
572
- * \returns the font's current wrap alignment option.
573
- *
574
- * \since This function is available since SDL_ttf 2.20.0.
575
- *
576
- * \sa TTF_SetFontWrappedAlign
577
- */
578
- extern DECLSPEC int SDLCALL TTF_GetFontWrappedAlign(const TTF_Font *font);
579
-
580
- /**
581
- * Set a font's current wrap alignment option.
582
- *
583
- * The wrap alignment option can be one of the following:
584
- *
585
- * - `TTF_WRAPPED_ALIGN_LEFT`
586
- * - `TTF_WRAPPED_ALIGN_CENTER`
587
- * - `TTF_WRAPPED_ALIGN_RIGHT`
588
- *
589
- * \param font the font to set a new wrap alignment option on.
590
- * \param align the new wrap alignment option.
591
- *
592
- * \since This function is available since SDL_ttf 2.20.0.
593
- *
594
- * \sa TTF_GetFontWrappedAlign
595
- */
596
- extern DECLSPEC void SDLCALL TTF_SetFontWrappedAlign(TTF_Font *font, int align);
597
-
598
- /**
599
- * Query the total height of a font.
600
- *
601
- * This is usually equal to point size.
602
- *
603
- * \param font the font to query.
604
- * \returns the font's height.
605
- *
606
- * \since This function is available since SDL_ttf 2.0.12.
607
- */
608
- extern DECLSPEC int SDLCALL TTF_FontHeight(const TTF_Font *font);
609
-
610
- /**
611
- * Query the offset from the baseline to the top of a font.
612
- *
613
- * This is a positive value, relative to the baseline.
614
- *
615
- * \param font the font to query.
616
- * \returns the font's ascent.
617
- *
618
- * \since This function is available since SDL_ttf 2.0.12.
619
- */
620
- extern DECLSPEC int SDLCALL TTF_FontAscent(const TTF_Font *font);
621
-
622
- /**
623
- * Query the offset from the baseline to the bottom of a font.
624
- *
625
- * This is a negative value, relative to the baseline.
626
- *
627
- * \param font the font to query.
628
- * \returns the font's descent.
629
- *
630
- * \since This function is available since SDL_ttf 2.0.12.
631
- */
632
- extern DECLSPEC int SDLCALL TTF_FontDescent(const TTF_Font *font);
633
-
634
- /**
635
- * Query the recommended spacing between lines of text for a font.
636
- *
637
- * \param font the font to query.
638
- * \returns the font's recommended spacing.
639
- *
640
- * \since This function is available since SDL_ttf 2.0.12.
641
- */
642
- extern DECLSPEC int SDLCALL TTF_FontLineSkip(const TTF_Font *font);
643
-
644
- /**
645
- * Query whether or not kerning is allowed for a font.
646
- *
647
- * \param font the font to query.
648
- * \returns non-zero if kerning is enabled, zero otherwise.
649
- *
650
- * \since This function is available since SDL_ttf 2.0.12.
651
- */
652
- extern DECLSPEC int SDLCALL TTF_GetFontKerning(const TTF_Font *font);
653
-
654
- /**
655
- * Set if kerning is allowed for a font.
656
- *
657
- * Newly-opened fonts default to allowing kerning. This is generally a good
658
- * policy unless you have a strong reason to disable it, as it tends to
659
- * produce better rendering (with kerning disabled, some fonts might render
660
- * the word `kerning` as something that looks like `keming` for example).
661
- *
662
- * \param font the font to set kerning on.
663
- * \param allowed non-zero to allow kerning, zero to disallow.
664
- *
665
- * \since This function is available since SDL_ttf 2.0.12.
666
- */
667
- extern DECLSPEC void SDLCALL TTF_SetFontKerning(TTF_Font *font, int allowed);
668
-
669
- /**
670
- * Query the number of faces of a font.
671
- *
672
- * \param font the font to query.
673
- * \returns the number of FreeType font faces.
674
- *
675
- * \since This function is available since SDL_ttf 2.0.12.
676
- */
677
- extern DECLSPEC long SDLCALL TTF_FontFaces(const TTF_Font *font);
678
-
679
- /**
680
- * Query whether a font is fixed-width.
681
- *
682
- * A "fixed-width" font means all glyphs are the same width across; a
683
- * lowercase 'i' will be the same size across as a capital 'W', for example.
684
- * This is common for terminals and text editors, and other apps that treat
685
- * text as a grid. Most other things (WYSIWYG word processors, web pages, etc)
686
- * are more likely to not be fixed-width in most cases.
687
- *
688
- * \param font the font to query.
689
- * \returns non-zero if fixed-width, zero if not.
690
- *
691
- * \since This function is available since SDL_ttf 2.0.12.
692
- */
693
- extern DECLSPEC int SDLCALL TTF_FontFaceIsFixedWidth(const TTF_Font *font);
694
-
695
- /**
696
- * Query a font's family name.
697
- *
698
- * This string is dictated by the contents of the font file.
699
- *
700
- * Note that the returned string is to internal storage, and should not be
701
- * modifed or free'd by the caller. The string becomes invalid, with the rest
702
- * of the font, when `font` is handed to TTF_CloseFont().
703
- *
704
- * \param font the font to query.
705
- * \returns the font's family name.
706
- *
707
- * \since This function is available since SDL_ttf 2.0.12.
708
- */
709
- extern DECLSPEC const char * SDLCALL TTF_FontFaceFamilyName(const TTF_Font *font);
710
-
711
- /**
712
- * Query a font's style name.
713
- *
714
- * This string is dictated by the contents of the font file.
715
- *
716
- * Note that the returned string is to internal storage, and should not be
717
- * modifed or free'd by the caller. The string becomes invalid, with the rest
718
- * of the font, when `font` is handed to TTF_CloseFont().
719
- *
720
- * \param font the font to query.
721
- * \returns the font's style name.
722
- *
723
- * \since This function is available since SDL_ttf 2.0.12.
724
- */
725
- extern DECLSPEC const char * SDLCALL TTF_FontFaceStyleName(const TTF_Font *font);
726
-
727
- /**
728
- * Check whether a glyph is provided by the font for a 16-bit codepoint.
729
- *
730
- * Note that this version of the function takes a 16-bit character code, which
731
- * covers the Basic Multilingual Plane, but is insufficient to cover the
732
- * entire set of possible Unicode values, including emoji glyphs. You should
733
- * use TTF_GlyphIsProvided32() instead, which offers the same functionality
734
- * but takes a 32-bit codepoint instead.
735
- *
736
- * The only reason to use this function is that it was available since the
737
- * beginning of time, more or less.
738
- *
739
- * \param font the font to query.
740
- * \param ch the character code to check.
741
- * \returns non-zero if font provides a glyph for this character, zero if not.
742
- *
743
- * \since This function is available since SDL_ttf 2.0.12.
744
- *
745
- * \sa TTF_GlyphIsProvided32
746
- */
747
- extern DECLSPEC int SDLCALL TTF_GlyphIsProvided(TTF_Font *font, Uint16 ch);
748
-
749
- /**
750
- * Check whether a glyph is provided by the font for a 32-bit codepoint.
751
- *
752
- * This is the same as TTF_GlyphIsProvided(), but takes a 32-bit character
753
- * instead of 16-bit, and thus can query a larger range. If you are sure
754
- * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
755
- * not to use this function exclusively.
756
- *
757
- * \param font the font to query.
758
- * \param ch the character code to check.
759
- * \returns non-zero if font provides a glyph for this character, zero if not.
760
- *
761
- * \since This function is available since SDL_ttf 2.0.18.
762
- */
763
- extern DECLSPEC int SDLCALL TTF_GlyphIsProvided32(TTF_Font *font, Uint32 ch);
764
-
765
- /**
766
- * Query the metrics (dimensions) of a font's 16-bit glyph.
767
- *
768
- * To understand what these metrics mean, here is a useful link:
769
- *
770
- * https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
771
- *
772
- * Note that this version of the function takes a 16-bit character code, which
773
- * covers the Basic Multilingual Plane, but is insufficient to cover the
774
- * entire set of possible Unicode values, including emoji glyphs. You should
775
- * use TTF_GlyphMetrics32() instead, which offers the same functionality but
776
- * takes a 32-bit codepoint instead.
777
- *
778
- * The only reason to use this function is that it was available since the
779
- * beginning of time, more or less.
780
- *
781
- * \param font the font to query.
782
- * \param ch the character code to check.
783
- *
784
- * \since This function is available since SDL_ttf 2.0.12.
785
- *
786
- * \sa TTF_GlyphMetrics32
787
- */
788
- extern DECLSPEC int SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
789
- int *minx, int *maxx,
790
- int *miny, int *maxy, int *advance);
791
-
792
- /**
793
- * Query the metrics (dimensions) of a font's 32-bit glyph.
794
- *
795
- * To understand what these metrics mean, here is a useful link:
796
- *
797
- * https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
798
- *
799
- * This is the same as TTF_GlyphMetrics(), but takes a 32-bit character
800
- * instead of 16-bit, and thus can query a larger range. If you are sure
801
- * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
802
- * not to use this function exclusively.
803
- *
804
- * \param font the font to query.
805
- * \param ch the character code to check.
806
- *
807
- * \since This function is available since SDL_ttf 2.0.18.
808
- */
809
- extern DECLSPEC int SDLCALL TTF_GlyphMetrics32(TTF_Font *font, Uint32 ch,
810
- int *minx, int *maxx,
811
- int *miny, int *maxy, int *advance);
812
-
813
- /**
814
- * Calculate the dimensions of a rendered string of Latin1 text.
815
- *
816
- * This will report the width and height, in pixels, of the space that the
817
- * specified string will take to fully render.
818
- *
819
- * This does not need to render the string to do this calculation.
820
- *
821
- * You almost certainly want TTF_SizeUTF8() unless you're sure you have a
822
- * 1-byte Latin1 encoding. US ASCII characters will work with either function,
823
- * but most other Unicode characters packed into a `const char *` will need
824
- * UTF-8.
825
- *
826
- * \param font the font to query.
827
- * \param text text to calculate, in Latin1 encoding.
828
- * \param w will be filled with width, in pixels, on return.
829
- * \param h will be filled with height, in pixels, on return.
830
- * \returns 0 if successful, -1 on error.
831
- *
832
- * \since This function is available since SDL_ttf 2.0.12.
833
- *
834
- * \sa TTF_SizeUTF8
835
- * \sa TTF_SizeUNICODE
836
- */
837
- extern DECLSPEC int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
838
-
839
- /**
840
- * Calculate the dimensions of a rendered string of UTF-8 text.
841
- *
842
- * This will report the width and height, in pixels, of the space that the
843
- * specified string will take to fully render.
844
- *
845
- * This does not need to render the string to do this calculation.
846
- *
847
- * \param font the font to query.
848
- * \param text text to calculate, in Latin1 encoding.
849
- * \param w will be filled with width, in pixels, on return.
850
- * \param h will be filled with height, in pixels, on return.
851
- * \returns 0 if successful, -1 on error.
852
- *
853
- * \since This function is available since SDL_ttf 2.0.12.
854
- *
855
- * \sa TTF_SizeUNICODE
856
- */
857
- extern DECLSPEC int SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);
858
-
859
- /**
860
- * Calculate the dimensions of a rendered string of UCS-2 text.
861
- *
862
- * This will report the width and height, in pixels, of the space that the
863
- * specified string will take to fully render.
864
- *
865
- * This does not need to render the string to do this calculation.
866
- *
867
- * Please note that this function is named "Unicode" but currently expects
868
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
869
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
870
- * through the UTF-8 version of this function.
871
- *
872
- * \param font the font to query.
873
- * \param text text to calculate, in UCS-2 encoding.
874
- * \param w will be filled with width, in pixels, on return.
875
- * \param h will be filled with height, in pixels, on return.
876
- * \returns 0 if successful, -1 on error.
877
- *
878
- * \since This function is available since SDL_ttf 2.0.12.
879
- *
880
- * \sa TTF_SizeUTF8
881
- */
882
- extern DECLSPEC int SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h);
883
-
884
- /**
885
- * Calculate how much of a Latin1 string will fit in a given width.
886
- *
887
- * This reports the number of characters that can be rendered before reaching
888
- * `measure_width`.
889
- *
890
- * This does not need to render the string to do this calculation.
891
- *
892
- * You almost certainly want TTF_MeasureUTF8() unless you're sure you have a
893
- * 1-byte Latin1 encoding. US ASCII characters will work with either function,
894
- * but most other Unicode characters packed into a `const char *` will need
895
- * UTF-8.
896
- *
897
- * \param font the font to query.
898
- * \param text text to calculate, in Latin1 encoding.
899
- * \param measure_width maximum width, in pixels, available for the string.
900
- * \param count on return, filled with number of characters that can be
901
- * rendered.
902
- * \param extent on return, filled with latest calculated width.
903
- * \returns 0 if successful, -1 on error.
904
- *
905
- * \since This function is available since SDL_ttf 2.0.18.
906
- *
907
- * \sa TTF_MeasureText
908
- * \sa TTF_MeasureUTF8
909
- * \sa TTF_MeasureUNICODE
910
- */
911
- extern DECLSPEC int SDLCALL TTF_MeasureText(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
912
-
913
- /**
914
- * Calculate how much of a UTF-8 string will fit in a given width.
915
- *
916
- * This reports the number of characters that can be rendered before reaching
917
- * `measure_width`.
918
- *
919
- * This does not need to render the string to do this calculation.
920
- *
921
- * \param font the font to query.
922
- * \param text text to calculate, in UTF-8 encoding.
923
- * \param measure_width maximum width, in pixels, available for the string.
924
- * \param count on return, filled with number of characters that can be
925
- * rendered.
926
- * \param extent on return, filled with latest calculated width.
927
- * \returns 0 if successful, -1 on error.
928
- *
929
- * \since This function is available since SDL_ttf 2.0.18.
930
- *
931
- * \sa TTF_MeasureText
932
- * \sa TTF_MeasureUTF8
933
- * \sa TTF_MeasureUNICODE
934
- */
935
- extern DECLSPEC int SDLCALL TTF_MeasureUTF8(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
936
-
937
- /**
938
- * Calculate how much of a UCS-2 string will fit in a given width.
939
- *
940
- * This reports the number of characters that can be rendered before reaching
941
- * `measure_width`.
942
- *
943
- * This does not need to render the string to do this calculation.
944
- *
945
- * Please note that this function is named "Unicode" but currently expects
946
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
947
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
948
- * through the UTF-8 version of this function.
949
- *
950
- * \param font the font to query.
951
- * \param text text to calculate, in UCS-2 encoding.
952
- * \param measure_width maximum width, in pixels, available for the string.
953
- * \param count on return, filled with number of characters that can be
954
- * rendered.
955
- * \param extent on return, filled with latest calculated width.
956
- * \returns 0 if successful, -1 on error.
957
- *
958
- * \since This function is available since SDL_ttf 2.0.18.
959
- *
960
- * \sa TTF_MeasureText
961
- * \sa TTF_MeasureUTF8
962
- * \sa TTF_MeasureUNICODE
963
- */
964
- extern DECLSPEC int SDLCALL TTF_MeasureUNICODE(TTF_Font *font, const Uint16 *text, int measure_width, int *extent, int *count);
965
-
966
- /**
967
- * Render Latin1 text at fast quality to a new 8-bit surface.
968
- *
969
- * This function will allocate a new 8-bit, palettized surface. The surface's
970
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
971
- * will be set to the text color.
972
- *
973
- * This will not word-wrap the string; you'll get a surface with a single line
974
- * of text, as long as the string requires. You can use
975
- * TTF_RenderText_Solid_Wrapped() instead if you need to wrap the output to
976
- * multiple lines.
977
- *
978
- * This will not wrap on newline characters.
979
- *
980
- * You almost certainly want TTF_RenderUTF8_Solid() unless you're sure you
981
- * have a 1-byte Latin1 encoding. US ASCII characters will work with either
982
- * function, but most other Unicode characters packed into a `const char *`
983
- * will need UTF-8.
984
- *
985
- * You can render at other quality levels with TTF_RenderText_Shaded,
986
- * TTF_RenderText_Blended, and TTF_RenderText_LCD.
987
- *
988
- * \param font the font to render with.
989
- * \param text text to render, in Latin1 encoding.
990
- * \param fg the foreground color for the text.
991
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
992
- *
993
- * \since This function is available since SDL_ttf 2.0.12.
994
- *
995
- * \sa TTF_RenderUTF8_Solid
996
- * \sa TTF_RenderUNICODE_Solid
997
- */
998
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid(TTF_Font *font,
999
- const char *text, SDL_Color fg);
1000
-
1001
- /**
1002
- * Render UTF-8 text at fast quality to a new 8-bit surface.
1003
- *
1004
- * This function will allocate a new 8-bit, palettized surface. The surface's
1005
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1006
- * will be set to the text color.
1007
- *
1008
- * This will not word-wrap the string; you'll get a surface with a single line
1009
- * of text, as long as the string requires. You can use
1010
- * TTF_RenderUTF8_Solid_Wrapped() instead if you need to wrap the output to
1011
- * multiple lines.
1012
- *
1013
- * This will not wrap on newline characters.
1014
- *
1015
- * You can render at other quality levels with TTF_RenderUTF8_Shaded,
1016
- * TTF_RenderUTF8_Blended, and TTF_RenderUTF8_LCD.
1017
- *
1018
- * \param font the font to render with.
1019
- * \param text text to render, in UTF-8 encoding.
1020
- * \param fg the foreground color for the text.
1021
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1022
- *
1023
- * \since This function is available since SDL_ttf 2.0.12.
1024
- *
1025
- * \sa TTF_RenderUTF8_Shaded
1026
- * \sa TTF_RenderUTF8_Blended
1027
- * \sa TTF_RenderUTF8_LCD
1028
- */
1029
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid(TTF_Font *font,
1030
- const char *text, SDL_Color fg);
1031
-
1032
- /**
1033
- * Render UCS-2 text at fast quality to a new 8-bit surface.
1034
- *
1035
- * This function will allocate a new 8-bit, palettized surface. The surface's
1036
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1037
- * will be set to the text color.
1038
- *
1039
- * This will not word-wrap the string; you'll get a surface with a single line
1040
- * of text, as long as the string requires. You can use
1041
- * TTF_RenderUNICODE_Solid_Wrapped() instead if you need to wrap the output to
1042
- * multiple lines.
1043
- *
1044
- * This will not wrap on newline characters.
1045
- *
1046
- * Please note that this function is named "Unicode" but currently expects
1047
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1048
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1049
- * through the UTF-8 version of this function.
1050
- *
1051
- * You can render at other quality levels with TTF_RenderUNICODE_Shaded,
1052
- * TTF_RenderUNICODE_Blended, and TTF_RenderUNICODE_LCD.
1053
- *
1054
- * \param font the font to render with.
1055
- * \param text text to render, in UCS-2 encoding.
1056
- * \param fg the foreground color for the text.
1057
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1058
- *
1059
- * \since This function is available since SDL_ttf 2.0.12.
1060
- *
1061
- * \sa TTF_RenderUTF8_Solid
1062
- */
1063
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Solid(TTF_Font *font,
1064
- const Uint16 *text, SDL_Color fg);
1065
-
1066
- /**
1067
- * Render word-wrapped Latin1 text at fast quality to a new 8-bit surface.
1068
- *
1069
- * This function will allocate a new 8-bit, palettized surface. The surface's
1070
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1071
- * will be set to the text color.
1072
- *
1073
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1074
- * it extends beyond `wrapLength` in pixels.
1075
- *
1076
- * If wrapLength is 0, this function will only wrap on newline characters.
1077
- *
1078
- * You almost certainly want TTF_RenderUTF8_Solid_Wrapped() unless you're sure
1079
- * you have a 1-byte Latin1 encoding. US ASCII characters will work with
1080
- * either function, but most other Unicode characters packed into a `const
1081
- * char *` will need UTF-8.
1082
- *
1083
- * You can render at other quality levels with TTF_RenderText_Shaded_Wrapped,
1084
- * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
1085
- *
1086
- * \param font the font to render with.
1087
- * \param text text to render, in Latin1 encoding.
1088
- * \param fg the foreground color for the text.
1089
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1090
- *
1091
- * \since This function is available since SDL_ttf 2.0.18.
1092
- *
1093
- * \sa TTF_RenderUTF8_Solid_Wrapped
1094
- * \sa TTF_RenderUNICODE_Solid_Wrapped
1095
- */
1096
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid_Wrapped(TTF_Font *font,
1097
- const char *text, SDL_Color fg, Uint32 wrapLength);
1098
-
1099
- /**
1100
- * Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
1101
- *
1102
- * This function will allocate a new 8-bit, palettized surface. The surface's
1103
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1104
- * will be set to the text color.
1105
- *
1106
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1107
- * it extends beyond `wrapLength` in pixels.
1108
- *
1109
- * If wrapLength is 0, this function will only wrap on newline characters.
1110
- *
1111
- * You can render at other quality levels with TTF_RenderUTF8_Shaded_Wrapped,
1112
- * TTF_RenderUTF8_Blended_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.
1113
- *
1114
- * \param font the font to render with.
1115
- * \param text text to render, in UTF-8 encoding.
1116
- * \param fg the foreground color for the text.
1117
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1118
- *
1119
- * \since This function is available since SDL_ttf 2.0.18.
1120
- *
1121
- * \sa TTF_RenderUTF8_Shaded_Wrapped
1122
- * \sa TTF_RenderUTF8_Blended_Wrapped
1123
- * \sa TTF_RenderUTF8_LCD_Wrapped
1124
- */
1125
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid_Wrapped(TTF_Font *font,
1126
- const char *text, SDL_Color fg, Uint32 wrapLength);
1127
-
1128
- /**
1129
- * Render word-wrapped UCS-2 text at fast quality to a new 8-bit surface.
1130
- *
1131
- * This function will allocate a new 8-bit, palettized surface. The surface's
1132
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1133
- * will be set to the text color.
1134
- *
1135
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1136
- * it extends beyond `wrapLength` in pixels.
1137
- *
1138
- * If wrapLength is 0, this function will only wrap on newline characters.
1139
- *
1140
- * Please note that this function is named "Unicode" but currently expects
1141
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1142
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1143
- * through the UTF-8 version of this function.
1144
- *
1145
- * You can render at other quality levels with
1146
- * TTF_RenderUNICODE_Shaded_Wrapped, TTF_RenderUNICODE_Blended_Wrapped, and
1147
- * TTF_RenderUNICODE_LCD_Wrapped.
1148
- *
1149
- * \param font the font to render with.
1150
- * \param text text to render, in UCS-2 encoding.
1151
- * \param fg the foreground color for the text.
1152
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1153
- *
1154
- * \since This function is available since SDL_ttf 2.0.18.
1155
- *
1156
- * \sa TTF_RenderUTF8_Solid_Wrapped
1157
- */
1158
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Solid_Wrapped(TTF_Font *font,
1159
- const Uint16 *text, SDL_Color fg, Uint32 wrapLength);
1160
-
1161
- /**
1162
- * Render a single 16-bit glyph at fast quality to a new 8-bit surface.
1163
- *
1164
- * This function will allocate a new 8-bit, palettized surface. The surface's
1165
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1166
- * will be set to the text color.
1167
- *
1168
- * The glyph is rendered without any padding or centering in the X direction,
1169
- * and aligned normally in the Y direction.
1170
- *
1171
- * Note that this version of the function takes a 16-bit character code, which
1172
- * covers the Basic Multilingual Plane, but is insufficient to cover the
1173
- * entire set of possible Unicode values, including emoji glyphs. You should
1174
- * use TTF_RenderGlyph32_Solid() instead, which offers the same functionality
1175
- * but takes a 32-bit codepoint instead.
1176
- *
1177
- * The only reason to use this function is that it was available since the
1178
- * beginning of time, more or less.
1179
- *
1180
- * You can render at other quality levels with TTF_RenderGlyph_Shaded,
1181
- * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
1182
- *
1183
- * \param font the font to render with.
1184
- * \param ch the character to render.
1185
- * \param fg the foreground color for the text.
1186
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1187
- *
1188
- * \since This function is available since SDL_ttf 2.0.12.
1189
- *
1190
- * \sa TTF_RenderGlyph32_Solid
1191
- */
1192
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font,
1193
- Uint16 ch, SDL_Color fg);
1194
-
1195
- /**
1196
- * Render a single 32-bit glyph at fast quality to a new 8-bit surface.
1197
- *
1198
- * This function will allocate a new 8-bit, palettized surface. The surface's
1199
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1200
- * will be set to the text color.
1201
- *
1202
- * The glyph is rendered without any padding or centering in the X direction,
1203
- * and aligned normally in the Y direction.
1204
- *
1205
- * This is the same as TTF_RenderGlyph_Solid(), but takes a 32-bit character
1206
- * instead of 16-bit, and thus can render a larger range. If you are sure
1207
- * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
1208
- * not to use this function exclusively.
1209
- *
1210
- * You can render at other quality levels with TTF_RenderGlyph32_Shaded,
1211
- * TTF_RenderGlyph32_Blended, and TTF_RenderGlyph32_LCD.
1212
- *
1213
- * \param font the font to render with.
1214
- * \param ch the character to render.
1215
- * \param fg the foreground color for the text.
1216
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1217
- *
1218
- * \since This function is available since SDL_ttf 2.0.18.
1219
- *
1220
- * \sa TTF_RenderGlyph32_Shaded
1221
- * \sa TTF_RenderGlyph32_Blended
1222
- * \sa TTF_RenderGlyph32_LCD
1223
- */
1224
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_Solid(TTF_Font *font,
1225
- Uint32 ch, SDL_Color fg);
1226
-
1227
- /**
1228
- * Render Latin1 text at high quality to a new 8-bit surface.
1229
- *
1230
- * This function will allocate a new 8-bit, palettized surface. The surface's
1231
- * 0 pixel will be the specified background color, while other pixels have
1232
- * varying degrees of the foreground color. This function returns the new
1233
- * surface, or NULL if there was an error.
1234
- *
1235
- * This will not word-wrap the string; you'll get a surface with a single line
1236
- * of text, as long as the string requires. You can use
1237
- * TTF_RenderText_Shaded_Wrapped() instead if you need to wrap the output to
1238
- * multiple lines.
1239
- *
1240
- * This will not wrap on newline characters.
1241
- *
1242
- * You almost certainly want TTF_RenderUTF8_Shaded() unless you're sure you
1243
- * have a 1-byte Latin1 encoding. US ASCII characters will work with either
1244
- * function, but most other Unicode characters packed into a `const char *`
1245
- * will need UTF-8.
1246
- *
1247
- * You can render at other quality levels with TTF_RenderText_Solid,
1248
- * TTF_RenderText_Blended, and TTF_RenderText_LCD.
1249
- *
1250
- * \param font the font to render with.
1251
- * \param text text to render, in Latin1 encoding.
1252
- * \param fg the foreground color for the text.
1253
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1254
- *
1255
- * \since This function is available since SDL_ttf 2.0.12.
1256
- *
1257
- * \sa TTF_RenderUTF8_Shaded
1258
- * \sa TTF_RenderUNICODE_Shaded
1259
- */
1260
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font,
1261
- const char *text, SDL_Color fg, SDL_Color bg);
1262
-
1263
- /**
1264
- * Render UTF-8 text at high quality to a new 8-bit surface.
1265
- *
1266
- * This function will allocate a new 8-bit, palettized surface. The surface's
1267
- * 0 pixel will be the specified background color, while other pixels have
1268
- * varying degrees of the foreground color. This function returns the new
1269
- * surface, or NULL if there was an error.
1270
- *
1271
- * This will not word-wrap the string; you'll get a surface with a single line
1272
- * of text, as long as the string requires. You can use
1273
- * TTF_RenderUTF8_Shaded_Wrapped() instead if you need to wrap the output to
1274
- * multiple lines.
1275
- *
1276
- * This will not wrap on newline characters.
1277
- *
1278
- * You can render at other quality levels with TTF_RenderUTF8_Solid,
1279
- * TTF_RenderUTF8_Blended, and TTF_RenderUTF8_LCD.
1280
- *
1281
- * \param font the font to render with.
1282
- * \param text text to render, in UTF-8 encoding.
1283
- * \param fg the foreground color for the text.
1284
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1285
- *
1286
- * \since This function is available since SDL_ttf 2.0.12.
1287
- *
1288
- * \sa TTF_RenderUNICODE_Shaded
1289
- */
1290
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded(TTF_Font *font,
1291
- const char *text, SDL_Color fg, SDL_Color bg);
1292
-
1293
- /**
1294
- * Render UCS-2 text at high quality to a new 8-bit surface.
1295
- *
1296
- * This function will allocate a new 8-bit, palettized surface. The surface's
1297
- * 0 pixel will be the specified background color, while other pixels have
1298
- * varying degrees of the foreground color. This function returns the new
1299
- * surface, or NULL if there was an error.
1300
- *
1301
- * This will not word-wrap the string; you'll get a surface with a single line
1302
- * of text, as long as the string requires. You can use
1303
- * TTF_RenderUNICODE_Shaded_Wrapped() instead if you need to wrap the output
1304
- * to multiple lines.
1305
- *
1306
- * This will not wrap on newline characters.
1307
- *
1308
- * Please note that this function is named "Unicode" but currently expects
1309
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1310
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1311
- * through the UTF-8 version of this function.
1312
- *
1313
- * You can render at other quality levels with TTF_RenderUNICODE_Solid,
1314
- * TTF_RenderUNICODE_Blended, and TTF_RenderUNICODE_LCD.
1315
- *
1316
- * \param font the font to render with.
1317
- * \param text text to render, in UCS-2 encoding.
1318
- * \param fg the foreground color for the text.
1319
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1320
- *
1321
- * \since This function is available since SDL_ttf 2.0.12.
1322
- *
1323
- * \sa TTF_RenderUTF8_Shaded
1324
- */
1325
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Shaded(TTF_Font *font,
1326
- const Uint16 *text, SDL_Color fg, SDL_Color bg);
1327
-
1328
- /**
1329
- * Render word-wrapped Latin1 text at high quality to a new 8-bit surface.
1330
- *
1331
- * This function will allocate a new 8-bit, palettized surface. The surface's
1332
- * 0 pixel will be the specified background color, while other pixels have
1333
- * varying degrees of the foreground color. This function returns the new
1334
- * surface, or NULL if there was an error.
1335
- *
1336
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1337
- * it extends beyond `wrapLength` in pixels.
1338
- *
1339
- * If wrapLength is 0, this function will only wrap on newline characters.
1340
- *
1341
- * You almost certainly want TTF_RenderUTF8_Shaded_Wrapped() unless you're
1342
- * sure you have a 1-byte Latin1 encoding. US ASCII characters will work with
1343
- * either function, but most other Unicode characters packed into a `const
1344
- * char *` will need UTF-8.
1345
- *
1346
- * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1347
- * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
1348
- *
1349
- * \param font the font to render with.
1350
- * \param text text to render, in Latin1 encoding.
1351
- * \param fg the foreground color for the text.
1352
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1353
- *
1354
- * \since This function is available since SDL_ttf 2.0.18.
1355
- *
1356
- * \sa TTF_RenderUTF8_Shaded_Wrapped
1357
- * \sa TTF_RenderUNICODE_Shaded_Wrapped
1358
- */
1359
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded_Wrapped(TTF_Font *font,
1360
- const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1361
-
1362
- /**
1363
- * Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.
1364
- *
1365
- * This function will allocate a new 8-bit, palettized surface. The surface's
1366
- * 0 pixel will be the specified background color, while other pixels have
1367
- * varying degrees of the foreground color. This function returns the new
1368
- * surface, or NULL if there was an error.
1369
- *
1370
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1371
- * it extends beyond `wrapLength` in pixels.
1372
- *
1373
- * If wrapLength is 0, this function will only wrap on newline characters.
1374
- *
1375
- * You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped,
1376
- * TTF_RenderUTF8_Blended_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.
1377
- *
1378
- * \param font the font to render with.
1379
- * \param text text to render, in UTF-8 encoding.
1380
- * \param fg the foreground color for the text.
1381
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1382
- *
1383
- * \since This function is available since SDL_ttf 2.0.18.
1384
- *
1385
- * \sa TTF_RenderUTF8_Solid_Wrapped
1386
- * \sa TTF_RenderUTF8_Blended_Wrapped
1387
- * \sa TTF_RenderUTF8_LCD_Wrapped
1388
- */
1389
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded_Wrapped(TTF_Font *font,
1390
- const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1391
-
1392
- /**
1393
- * Render word-wrapped UCS-2 text at high quality to a new 8-bit surface.
1394
- *
1395
- * This function will allocate a new 8-bit, palettized surface. The surface's
1396
- * 0 pixel will be the specified background color, while other pixels have
1397
- * varying degrees of the foreground color. This function returns the new
1398
- * surface, or NULL if there was an error.
1399
- *
1400
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1401
- * it extends beyond `wrapLength` in pixels.
1402
- *
1403
- * If wrapLength is 0, this function will only wrap on newline characters.
1404
- *
1405
- * Please note that this function is named "Unicode" but currently expects
1406
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1407
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1408
- * through the UTF-8 version of this function.
1409
- *
1410
- * You can render at other quality levels with
1411
- * TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Blended_Wrapped, and
1412
- * TTF_RenderUNICODE_LCD_Wrapped.
1413
- *
1414
- * \param font the font to render with.
1415
- * \param text text to render, in UCS-2 encoding.
1416
- * \param fg the foreground color for the text.
1417
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1418
- *
1419
- * \since This function is available since SDL_ttf 2.0.18.
1420
- *
1421
- * \sa TTF_RenderUTF8_Shaded_Wrapped
1422
- */
1423
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Shaded_Wrapped(TTF_Font *font,
1424
- const Uint16 *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1425
-
1426
- /**
1427
- * Render a single 16-bit glyph at high quality to a new 8-bit surface.
1428
- *
1429
- * This function will allocate a new 8-bit, palettized surface. The surface's
1430
- * 0 pixel will be the specified background color, while other pixels have
1431
- * varying degrees of the foreground color. This function returns the new
1432
- * surface, or NULL if there was an error.
1433
- *
1434
- * The glyph is rendered without any padding or centering in the X direction,
1435
- * and aligned normally in the Y direction.
1436
- *
1437
- * Note that this version of the function takes a 16-bit character code, which
1438
- * covers the Basic Multilingual Plane, but is insufficient to cover the
1439
- * entire set of possible Unicode values, including emoji glyphs. You should
1440
- * use TTF_RenderGlyph32_Shaded() instead, which offers the same functionality
1441
- * but takes a 32-bit codepoint instead.
1442
- *
1443
- * The only reason to use this function is that it was available since the
1444
- * beginning of time, more or less.
1445
- *
1446
- * You can render at other quality levels with TTF_RenderGlyph_Solid,
1447
- * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
1448
- *
1449
- * \param font the font to render with.
1450
- * \param ch the character to render.
1451
- * \param fg the foreground color for the text.
1452
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1453
- *
1454
- * \since This function is available since SDL_ttf 2.0.12.
1455
- *
1456
- * \sa TTF_RenderGlyph32_Shaded
1457
- */
1458
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font,
1459
- Uint16 ch, SDL_Color fg, SDL_Color bg);
1460
-
1461
- /**
1462
- * Render a single 32-bit glyph at high quality to a new 8-bit surface.
1463
- *
1464
- * This function will allocate a new 8-bit, palettized surface. The surface's
1465
- * 0 pixel will be the specified background color, while other pixels have
1466
- * varying degrees of the foreground color. This function returns the new
1467
- * surface, or NULL if there was an error.
1468
- *
1469
- * The glyph is rendered without any padding or centering in the X direction,
1470
- * and aligned normally in the Y direction.
1471
- *
1472
- * This is the same as TTF_RenderGlyph_Shaded(), but takes a 32-bit character
1473
- * instead of 16-bit, and thus can render a larger range. If you are sure
1474
- * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
1475
- * not to use this function exclusively.
1476
- *
1477
- * You can render at other quality levels with TTF_RenderGlyph32_Solid,
1478
- * TTF_RenderGlyph32_Blended, and TTF_RenderGlyph32_LCD.
1479
- *
1480
- * \param font the font to render with.
1481
- * \param ch the character to render.
1482
- * \param fg the foreground color for the text.
1483
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1484
- *
1485
- * \since This function is available since SDL_ttf 2.0.18.
1486
- *
1487
- * \sa TTF_RenderGlyph32_Solid
1488
- * \sa TTF_RenderGlyph32_Blended
1489
- * \sa TTF_RenderGlyph32_LCD
1490
- */
1491
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_Shaded(TTF_Font *font,
1492
- Uint32 ch, SDL_Color fg, SDL_Color bg);
1493
-
1494
- /**
1495
- * Render Latin1 text at high quality to a new ARGB surface.
1496
- *
1497
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1498
- * blending to dither the font with the given color. This function returns the
1499
- * new surface, or NULL if there was an error.
1500
- *
1501
- * This will not word-wrap the string; you'll get a surface with a single line
1502
- * of text, as long as the string requires. You can use
1503
- * TTF_RenderText_Blended_Wrapped() instead if you need to wrap the output to
1504
- * multiple lines.
1505
- *
1506
- * This will not wrap on newline characters.
1507
- *
1508
- * You almost certainly want TTF_RenderUTF8_Blended() unless you're sure you
1509
- * have a 1-byte Latin1 encoding. US ASCII characters will work with either
1510
- * function, but most other Unicode characters packed into a `const char *`
1511
- * will need UTF-8.
1512
- *
1513
- * You can render at other quality levels with TTF_RenderText_Solid,
1514
- * TTF_RenderText_Blended, and TTF_RenderText_LCD.
1515
- *
1516
- * \param font the font to render with.
1517
- * \param text text to render, in Latin1 encoding.
1518
- * \param fg the foreground color for the text.
1519
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1520
- *
1521
- * \since This function is available since SDL_ttf 2.0.12.
1522
- *
1523
- * \sa TTF_RenderUTF8_Shaded
1524
- * \sa TTF_RenderUNICODE_Shaded
1525
- */
1526
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font,
1527
- const char *text, SDL_Color fg);
1528
-
1529
- /**
1530
- * Render UTF-8 text at high quality to a new ARGB surface.
1531
- *
1532
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1533
- * blending to dither the font with the given color. This function returns the
1534
- * new surface, or NULL if there was an error.
1535
- *
1536
- * This will not word-wrap the string; you'll get a surface with a single line
1537
- * of text, as long as the string requires. You can use
1538
- * TTF_RenderUTF8_Blended_Wrapped() instead if you need to wrap the output to
1539
- * multiple lines.
1540
- *
1541
- * This will not wrap on newline characters.
1542
- *
1543
- * You can render at other quality levels with TTF_RenderUTF8_Solid,
1544
- * TTF_RenderUTF8_Shaded, and TTF_RenderUTF8_LCD.
1545
- *
1546
- * \param font the font to render with.
1547
- * \param text text to render, in UTF-8 encoding.
1548
- * \param fg the foreground color for the text.
1549
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1550
- *
1551
- * \since This function is available since SDL_ttf 2.0.12.
1552
- *
1553
- * \sa TTF_RenderUNICODE_Blended
1554
- */
1555
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended(TTF_Font *font,
1556
- const char *text, SDL_Color fg);
1557
-
1558
- /**
1559
- * Render UCS-2 text at high quality to a new ARGB surface.
1560
- *
1561
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1562
- * blending to dither the font with the given color. This function returns the
1563
- * new surface, or NULL if there was an error.
1564
- *
1565
- * This will not word-wrap the string; you'll get a surface with a single line
1566
- * of text, as long as the string requires. You can use
1567
- * TTF_RenderUNICODE_Blended_Wrapped() instead if you need to wrap the output
1568
- * to multiple lines.
1569
- *
1570
- * This will not wrap on newline characters.
1571
- *
1572
- * Please note that this function is named "Unicode" but currently expects
1573
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1574
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1575
- * through the UTF-8 version of this function.
1576
- *
1577
- * You can render at other quality levels with TTF_RenderUNICODE_Solid,
1578
- * TTF_RenderUNICODE_Shaded, and TTF_RenderUNICODE_LCD.
1579
- *
1580
- * \param font the font to render with.
1581
- * \param text text to render, in UCS-2 encoding.
1582
- * \param fg the foreground color for the text.
1583
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1584
- *
1585
- * \since This function is available since SDL_ttf 2.0.12.
1586
- *
1587
- * \sa TTF_RenderUTF8_Blended
1588
- */
1589
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended(TTF_Font *font,
1590
- const Uint16 *text, SDL_Color fg);
1591
-
1592
- /**
1593
- * Render word-wrapped Latin1 text at high quality to a new ARGB surface.
1594
- *
1595
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1596
- * blending to dither the font with the given color. This function returns the
1597
- * new surface, or NULL if there was an error.
1598
- *
1599
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1600
- * it extends beyond `wrapLength` in pixels.
1601
- *
1602
- * If wrapLength is 0, this function will only wrap on newline characters.
1603
- *
1604
- * You almost certainly want TTF_RenderUTF8_Blended_Wrapped() unless you're
1605
- * sure you have a 1-byte Latin1 encoding. US ASCII characters will work with
1606
- * either function, but most other Unicode characters packed into a `const
1607
- * char *` will need UTF-8.
1608
- *
1609
- * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1610
- * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_LCD_Wrapped.
1611
- *
1612
- * \param font the font to render with.
1613
- * \param text text to render, in Latin1 encoding.
1614
- * \param fg the foreground color for the text.
1615
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1616
- *
1617
- * \since This function is available since SDL_ttf 2.0.18.
1618
- *
1619
- * \sa TTF_RenderUTF8_Blended_Wrapped
1620
- * \sa TTF_RenderUNICODE_Blended_Wrapped
1621
- */
1622
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended_Wrapped(TTF_Font *font,
1623
- const char *text, SDL_Color fg, Uint32 wrapLength);
1624
-
1625
- /**
1626
- * Render word-wrapped UTF-8 text at high quality to a new ARGB surface.
1627
- *
1628
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1629
- * blending to dither the font with the given color. This function returns the
1630
- * new surface, or NULL if there was an error.
1631
- *
1632
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1633
- * it extends beyond `wrapLength` in pixels.
1634
- *
1635
- * If wrapLength is 0, this function will only wrap on newline characters.
1636
- *
1637
- * You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped,
1638
- * TTF_RenderUTF8_Shaded_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.
1639
- *
1640
- * \param font the font to render with.
1641
- * \param text text to render, in UTF-8 encoding.
1642
- * \param fg the foreground color for the text.
1643
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1644
- *
1645
- * \since This function is available since SDL_ttf 2.0.18.
1646
- *
1647
- * \sa TTF_RenderUTF8_Solid_Wrapped
1648
- * \sa TTF_RenderUTF8_Shaded_Wrapped
1649
- * \sa TTF_RenderUTF8_LCD_Wrapped
1650
- */
1651
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended_Wrapped(TTF_Font *font,
1652
- const char *text, SDL_Color fg, Uint32 wrapLength);
1653
-
1654
- /**
1655
- * Render word-wrapped UCS-2 text at high quality to a new ARGB surface.
1656
- *
1657
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1658
- * blending to dither the font with the given color. This function returns the
1659
- * new surface, or NULL if there was an error.
1660
- *
1661
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1662
- * it extends beyond `wrapLength` in pixels.
1663
- *
1664
- * If wrapLength is 0, this function will only wrap on newline characters.
1665
- *
1666
- * Please note that this function is named "Unicode" but currently expects
1667
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1668
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1669
- * through the UTF-8 version of this function.
1670
- *
1671
- * You can render at other quality levels with
1672
- * TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Shaded_Wrapped, and
1673
- * TTF_RenderUNICODE_LCD_Wrapped.
1674
- *
1675
- * \param font the font to render with.
1676
- * \param text text to render, in UCS-2 encoding.
1677
- * \param fg the foreground color for the text.
1678
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1679
- *
1680
- * \since This function is available since SDL_ttf 2.0.18.
1681
- *
1682
- * \sa TTF_RenderUTF8_Blended_Wrapped
1683
- */
1684
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended_Wrapped(TTF_Font *font,
1685
- const Uint16 *text, SDL_Color fg, Uint32 wrapLength);
1686
-
1687
- /**
1688
- * Render a single 16-bit glyph at high quality to a new ARGB surface.
1689
- *
1690
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1691
- * blending to dither the font with the given color. This function returns the
1692
- * new surface, or NULL if there was an error.
1693
- *
1694
- * The glyph is rendered without any padding or centering in the X direction,
1695
- * and aligned normally in the Y direction.
1696
- *
1697
- * Note that this version of the function takes a 16-bit character code, which
1698
- * covers the Basic Multilingual Plane, but is insufficient to cover the
1699
- * entire set of possible Unicode values, including emoji glyphs. You should
1700
- * use TTF_RenderGlyph32_Blended() instead, which offers the same
1701
- * functionality but takes a 32-bit codepoint instead.
1702
- *
1703
- * The only reason to use this function is that it was available since the
1704
- * beginning of time, more or less.
1705
- *
1706
- * You can render at other quality levels with TTF_RenderGlyph_Solid,
1707
- * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_LCD.
1708
- *
1709
- * \param font the font to render with.
1710
- * \param ch the character to render.
1711
- * \param fg the foreground color for the text.
1712
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1713
- *
1714
- * \since This function is available since SDL_ttf 2.0.12.
1715
- *
1716
- * \sa TTF_RenderGlyph32_Blended
1717
- */
1718
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font,
1719
- Uint16 ch, SDL_Color fg);
1720
-
1721
- /**
1722
- * Render a single 32-bit glyph at high quality to a new ARGB surface.
1723
- *
1724
- * This function will allocate a new 32-bit, ARGB surface, using alpha
1725
- * blending to dither the font with the given color. This function returns the
1726
- * new surface, or NULL if there was an error.
1727
- *
1728
- * The glyph is rendered without any padding or centering in the X direction,
1729
- * and aligned normally in the Y direction.
1730
- *
1731
- * This is the same as TTF_RenderGlyph_Blended(), but takes a 32-bit character
1732
- * instead of 16-bit, and thus can render a larger range. If you are sure
1733
- * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
1734
- * not to use this function exclusively.
1735
- *
1736
- * You can render at other quality levels with TTF_RenderGlyph32_Solid,
1737
- * TTF_RenderGlyph32_Shaded, and TTF_RenderGlyph32_LCD.
1738
- *
1739
- * \param font the font to render with.
1740
- * \param ch the character to render.
1741
- * \param fg the foreground color for the text.
1742
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1743
- *
1744
- * \since This function is available since SDL_ttf 2.0.18.
1745
- *
1746
- * \sa TTF_RenderGlyph32_Solid
1747
- * \sa TTF_RenderGlyph32_Shaded
1748
- * \sa TTF_RenderGlyph32_LCD
1749
- */
1750
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_Blended(TTF_Font *font,
1751
- Uint32 ch, SDL_Color fg);
1752
-
1753
- /**
1754
- * Render Latin1 text at LCD subpixel quality to a new ARGB surface.
1755
- *
1756
- * This function will allocate a new 32-bit, ARGB surface, and render
1757
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1758
- * returns the new surface, or NULL if there was an error.
1759
- *
1760
- * This will not word-wrap the string; you'll get a surface with a single line
1761
- * of text, as long as the string requires. You can use
1762
- * TTF_RenderText_LCD_Wrapped() instead if you need to wrap the output to
1763
- * multiple lines.
1764
- *
1765
- * This will not wrap on newline characters.
1766
- *
1767
- * You almost certainly want TTF_RenderUTF8_LCD() unless you're sure you have
1768
- * a 1-byte Latin1 encoding. US ASCII characters will work with either
1769
- * function, but most other Unicode characters packed into a `const char *`
1770
- * will need UTF-8.
1771
- *
1772
- * You can render at other quality levels with TTF_RenderText_Solid,
1773
- * TTF_RenderText_Shaded, and TTF_RenderText_Blended.
1774
- *
1775
- * \param font the font to render with.
1776
- * \param text text to render, in Latin1 encoding.
1777
- * \param fg the foreground color for the text.
1778
- * \param bg the background color for the text.
1779
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1780
- *
1781
- * \since This function is available since SDL_ttf 2.20.0.
1782
- *
1783
- * \sa TTF_RenderUTF8_LCD
1784
- * \sa TTF_RenderUNICODE_LCD
1785
- */
1786
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD(TTF_Font *font,
1787
- const char *text, SDL_Color fg, SDL_Color bg);
1788
-
1789
- /**
1790
- * Render UTF-8 text at LCD subpixel quality to a new ARGB surface.
1791
- *
1792
- * This function will allocate a new 32-bit, ARGB surface, and render
1793
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1794
- * returns the new surface, or NULL if there was an error.
1795
- *
1796
- * This will not word-wrap the string; you'll get a surface with a single line
1797
- * of text, as long as the string requires. You can use
1798
- * TTF_RenderUTF8_LCD_Wrapped() instead if you need to wrap the output to
1799
- * multiple lines.
1800
- *
1801
- * This will not wrap on newline characters.
1802
- *
1803
- * You can render at other quality levels with TTF_RenderUTF8_Solid,
1804
- * TTF_RenderUTF8_Shaded, and TTF_RenderUTF8_Blended.
1805
- *
1806
- * \param font the font to render with.
1807
- * \param text text to render, in UTF-8 encoding.
1808
- * \param fg the foreground color for the text.
1809
- * \param bg the background color for the text.
1810
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1811
- *
1812
- * \since This function is available since SDL_ttf 2.20.0.
1813
- *
1814
- * \sa TTF_RenderUNICODE_LCD
1815
- */
1816
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_LCD(TTF_Font *font,
1817
- const char *text, SDL_Color fg, SDL_Color bg);
1818
-
1819
- /**
1820
- * Render UCS-2 text at LCD subpixel quality to a new ARGB surface.
1821
- *
1822
- * This function will allocate a new 32-bit, ARGB surface, and render
1823
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1824
- * returns the new surface, or NULL if there was an error.
1825
- *
1826
- * This will not word-wrap the string; you'll get a surface with a single line
1827
- * of text, as long as the string requires. You can use
1828
- * TTF_RenderUNICODE_LCD_Wrapped() instead if you need to wrap the output to
1829
- * multiple lines.
1830
- *
1831
- * This will not wrap on newline characters.
1832
- *
1833
- * Please note that this function is named "Unicode" but currently expects
1834
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1835
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1836
- * through the UTF-8 version of this function.
1837
- *
1838
- * You can render at other quality levels with TTF_RenderUNICODE_Solid,
1839
- * TTF_RenderUNICODE_Shaded, and TTF_RenderUNICODE_Blended.
1840
- *
1841
- * \param font the font to render with.
1842
- * \param text text to render, in UCS-2 encoding.
1843
- * \param fg the foreground color for the text.
1844
- * \param bg the background color for the text.
1845
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1846
- *
1847
- * \since This function is available since SDL_ttf 2.20.0.
1848
- *
1849
- * \sa TTF_RenderUTF8_LCD
1850
- */
1851
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_LCD(TTF_Font *font,
1852
- const Uint16 *text, SDL_Color fg, SDL_Color bg);
1853
-
1854
- /**
1855
- * Render word-wrapped Latin1 text at LCD subpixel quality to a new ARGB
1856
- * surface.
1857
- *
1858
- * This function will allocate a new 32-bit, ARGB surface, and render
1859
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1860
- * returns the new surface, or NULL if there was an error.
1861
- *
1862
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1863
- * it extends beyond `wrapLength` in pixels.
1864
- *
1865
- * If wrapLength is 0, this function will only wrap on newline characters.
1866
- *
1867
- * You almost certainly want TTF_RenderUTF8_LCD_Wrapped() unless you're sure
1868
- * you have a 1-byte Latin1 encoding. US ASCII characters will work with
1869
- * either function, but most other Unicode characters packed into a `const
1870
- * char *` will need UTF-8.
1871
- *
1872
- * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1873
- * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_Blended_Wrapped.
1874
- *
1875
- * \param font the font to render with.
1876
- * \param text text to render, in Latin1 encoding.
1877
- * \param fg the foreground color for the text.
1878
- * \param bg the background color for the text.
1879
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1880
- *
1881
- * \since This function is available since SDL_ttf 2.20.0.
1882
- *
1883
- * \sa TTF_RenderUTF8_LCD_Wrapped
1884
- * \sa TTF_RenderUNICODE_LCD_Wrapped
1885
- */
1886
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD_Wrapped(TTF_Font *font,
1887
- const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1888
-
1889
- /**
1890
- * Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB
1891
- * surface.
1892
- *
1893
- * This function will allocate a new 32-bit, ARGB surface, and render
1894
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1895
- * returns the new surface, or NULL if there was an error.
1896
- *
1897
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1898
- * it extends beyond `wrapLength` in pixels.
1899
- *
1900
- * If wrapLength is 0, this function will only wrap on newline characters.
1901
- *
1902
- * You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped,
1903
- * TTF_RenderUTF8_Shaded_Wrapped, and TTF_RenderUTF8_Blended_Wrapped.
1904
- *
1905
- * \param font the font to render with.
1906
- * \param text text to render, in UTF-8 encoding.
1907
- * \param fg the foreground color for the text.
1908
- * \param bg the background color for the text.
1909
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1910
- *
1911
- * \since This function is available since SDL_ttf 2.20.0.
1912
- *
1913
- * \sa TTF_RenderUTF8_Solid_Wrapped
1914
- * \sa TTF_RenderUTF8_Shaded_Wrapped
1915
- * \sa TTF_RenderUTF8_Blended_Wrapped
1916
- */
1917
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_LCD_Wrapped(TTF_Font *font,
1918
- const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1919
-
1920
- /**
1921
- * Render word-wrapped UCS-2 text at LCD subpixel quality to a new ARGB
1922
- * surface.
1923
- *
1924
- * This function will allocate a new 32-bit, ARGB surface, and render
1925
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1926
- * returns the new surface, or NULL if there was an error.
1927
- *
1928
- * Text is wrapped to multiple lines on line endings and on word boundaries if
1929
- * it extends beyond `wrapLength` in pixels.
1930
- *
1931
- * If wrapLength is 0, this function will only wrap on newline characters.
1932
- *
1933
- * Please note that this function is named "Unicode" but currently expects
1934
- * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1935
- * large Unicode values, such as emoji glyphs. These codepoints are accessible
1936
- * through the UTF-8 version of this function.
1937
- *
1938
- * You can render at other quality levels with
1939
- * TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Shaded_Wrapped, and
1940
- * TTF_RenderUNICODE_Blended_Wrapped.
1941
- *
1942
- * \param font the font to render with.
1943
- * \param text text to render, in UCS-2 encoding.
1944
- * \param fg the foreground color for the text.
1945
- * \param bg the background color for the text.
1946
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1947
- *
1948
- * \since This function is available since SDL_ttf 2.20.0.
1949
- *
1950
- * \sa TTF_RenderUTF8_LCD_Wrapped
1951
- */
1952
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_LCD_Wrapped(TTF_Font *font,
1953
- const Uint16 *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1954
-
1955
- /**
1956
- * Render a single 16-bit glyph at LCD subpixel quality to a new ARGB surface.
1957
- *
1958
- * This function will allocate a new 32-bit, ARGB surface, and render
1959
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1960
- * returns the new surface, or NULL if there was an error.
1961
- *
1962
- * The glyph is rendered without any padding or centering in the X direction,
1963
- * and aligned normally in the Y direction.
1964
- *
1965
- * Note that this version of the function takes a 16-bit character code, which
1966
- * covers the Basic Multilingual Plane, but is insufficient to cover the
1967
- * entire set of possible Unicode values, including emoji glyphs. You should
1968
- * use TTF_RenderGlyph32_LCD() instead, which offers the same functionality
1969
- * but takes a 32-bit codepoint instead.
1970
- *
1971
- * This function only exists for consistency with the existing API at the time
1972
- * of its addition.
1973
- *
1974
- * You can render at other quality levels with TTF_RenderGlyph_Solid,
1975
- * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_Blended.
1976
- *
1977
- * \param font the font to render with.
1978
- * \param ch the character to render.
1979
- * \param fg the foreground color for the text.
1980
- * \param bg the background color for the text.
1981
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1982
- *
1983
- * \since This function is available since SDL_ttf 2.20.0.
1984
- *
1985
- * \sa TTF_RenderGlyph32_LCD
1986
- */
1987
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_LCD(TTF_Font *font,
1988
- Uint16 ch, SDL_Color fg, SDL_Color bg);
1989
-
1990
- /**
1991
- * Render a single 32-bit glyph at LCD subpixel quality to a new ARGB surface.
1992
- *
1993
- * This function will allocate a new 32-bit, ARGB surface, and render
1994
- * alpha-blended text using FreeType's LCD subpixel rendering. This function
1995
- * returns the new surface, or NULL if there was an error.
1996
- *
1997
- * The glyph is rendered without any padding or centering in the X direction,
1998
- * and aligned normally in the Y direction.
1999
- *
2000
- * This is the same as TTF_RenderGlyph_LCD(), but takes a 32-bit character
2001
- * instead of 16-bit, and thus can render a larger range. Between the two, you
2002
- * should always use this function.
2003
- *
2004
- * You can render at other quality levels with TTF_RenderGlyph32_Solid,
2005
- * TTF_RenderGlyph32_Shaded, and TTF_RenderGlyph32_Blended.
2006
- *
2007
- * \param font the font to render with.
2008
- * \param ch the character to render.
2009
- * \param fg the foreground color for the text.
2010
- * \param bg the background color for the text.
2011
- * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
2012
- *
2013
- * \since This function is available since SDL_ttf 2.20.0.
2014
- *
2015
- * \sa TTF_RenderGlyph32_Solid
2016
- * \sa TTF_RenderGlyph32_Shaded
2017
- * \sa TTF_RenderGlyph32_Blended
2018
- */
2019
- extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_LCD(TTF_Font *font,
2020
- Uint32 ch, SDL_Color fg, SDL_Color bg);
2021
-
2022
-
2023
- /* For compatibility with previous versions, here are the old functions */
2024
- #define TTF_RenderText(font, text, fg, bg) \
2025
- TTF_RenderText_Shaded(font, text, fg, bg)
2026
- #define TTF_RenderUTF8(font, text, fg, bg) \
2027
- TTF_RenderUTF8_Shaded(font, text, fg, bg)
2028
- #define TTF_RenderUNICODE(font, text, fg, bg) \
2029
- TTF_RenderUNICODE_Shaded(font, text, fg, bg)
2030
-
2031
- /**
2032
- * Dispose of a previously-created font.
2033
- *
2034
- * Call this when done with a font. This function will free any resources
2035
- * associated with it.
2036
- *
2037
- * The font is not valid after being passed to this function. String pointers
2038
- * from functions that return information on this font, such as
2039
- * TTF_FontFaceFamilyName() and TTF_FontFaceStyleName(), are no longer valid
2040
- * after this call, as well.
2041
- *
2042
- * \param font the font to dispose of.
2043
- *
2044
- * \since This function is available since SDL_ttf 2.0.12.
2045
- *
2046
- * \sa TTF_OpenFontIndexDPIRW
2047
- * \sa TTF_OpenFontRW
2048
- * \sa TTF_OpenFontDPI
2049
- * \sa TTF_OpenFontDPIRW
2050
- * \sa TTF_OpenFontIndex
2051
- * \sa TTF_OpenFontIndexDPI
2052
- * \sa TTF_OpenFontIndexDPIRW
2053
- * \sa TTF_OpenFontIndexRW
2054
- */
2055
- extern DECLSPEC void SDLCALL TTF_CloseFont(TTF_Font *font);
2056
-
2057
- /**
2058
- * Deinitialize SDL_ttf.
2059
- *
2060
- * You must call this when done with the library, to free internal resources.
2061
- * It is safe to call this when the library isn't initialized, as it will just
2062
- * return immediately.
2063
- *
2064
- * Once you have as many quit calls as you have had successful calls to
2065
- * TTF_Init, the library will actually deinitialize.
2066
- *
2067
- * Please note that this does not automatically close any fonts that are still
2068
- * open at the time of deinitialization, and it is possibly not safe to close
2069
- * them afterwards, as parts of the library will no longer be initialized to
2070
- * deal with it. A well-written program should call TTF_CloseFont() on any
2071
- * open fonts before calling this function!
2072
- *
2073
- * \since This function is available since SDL_ttf 2.0.12.
2074
- */
2075
- extern DECLSPEC void SDLCALL TTF_Quit(void);
2076
-
2077
- /**
2078
- * Check if SDL_ttf is initialized.
2079
- *
2080
- * This reports the number of times the library has been initialized by a call
2081
- * to TTF_Init(), without a paired deinitialization request from TTF_Quit().
2082
- *
2083
- * In short: if it's greater than zero, the library is currently initialized
2084
- * and ready to work. If zero, it is not initialized.
2085
- *
2086
- * Despite the return value being a signed integer, this function should not
2087
- * return a negative number.
2088
- *
2089
- * \returns the current number of initialization calls, that need to
2090
- * eventually be paired with this many calls to TTF_Quit().
2091
- *
2092
- * \since This function is available since SDL_ttf 2.0.12.
2093
- *
2094
- * \sa TTF_Init
2095
- * \sa TTF_Quit
2096
- */
2097
- extern DECLSPEC int SDLCALL TTF_WasInit(void);
2098
-
2099
- /**
2100
- * Query the kerning size of two glyphs indices.
2101
- *
2102
- * \deprecated This function accidentally requires FreeType font indexes,
2103
- * not codepoints, which we don't expose through this API, so
2104
- * it could give wildly incorrect results, especially with
2105
- * non-ASCII values. Going forward, please use
2106
- * TTF_GetFontKerningSizeGlyphs() instead, which does what you
2107
- * probably expected this function to do.
2108
- *
2109
- * \param font the font to query.
2110
- * \param prev_index the font index, NOT codepoint, of the previous character.
2111
- * \param index the font index, NOT codepoint, of the current character.
2112
- * \returns The kerning size between the two specified characters, in pixels, or -1 on error.
2113
- *
2114
- * \since This function is available since SDL_ttf 2.0.12.
2115
- *
2116
- * \sa TTF_GetFontKerningSizeGlyphs
2117
- */
2118
- extern SDL_DEPRECATED DECLSPEC int TTF_GetFontKerningSize(TTF_Font *font, int prev_index, int index);
2119
-
2120
- /**
2121
- * Query the kerning size of two 16-bit glyphs.
2122
- *
2123
- * Note that this version of the function takes 16-bit character
2124
- * codes, which covers the Basic Multilingual Plane, but is insufficient
2125
- * to cover the entire set of possible Unicode values, including emoji
2126
- * glyphs. You should use TTF_GetFontKerningSizeGlyphs32() instead, which
2127
- * offers the same functionality but takes a 32-bit codepoints instead.
2128
- *
2129
- * The only reason to use this function is that it was available since
2130
- * the beginning of time, more or less.
2131
- *
2132
- * \param font the font to query.
2133
- * \param previous_ch the previous character's code, 16 bits.
2134
- * \param ch the current character's code, 16 bits.
2135
- * \returns The kerning size between the two specified characters, in pixels, or -1 on error.
2136
- *
2137
- * \since This function is available since SDL_ttf 2.0.14.
2138
- *
2139
- * \sa TTF_GetFontKerningSizeGlyphs32
2140
- */
2141
- extern DECLSPEC int TTF_GetFontKerningSizeGlyphs(TTF_Font *font, Uint16 previous_ch, Uint16 ch);
2142
-
2143
- /**
2144
- * Query the kerning size of two 32-bit glyphs.
2145
- *
2146
- * This is the same as TTF_GetFontKerningSizeGlyphs(), but takes 32-bit
2147
- * characters instead of 16-bit, and thus can manage a larger range. If
2148
- * you are sure you'll have an SDL_ttf that's version 2.0.18 or newer,
2149
- * there's no reason not to use this function exclusively.
2150
- *
2151
- * \param font the font to query.
2152
- * \param previous_ch the previous character's code, 32 bits.
2153
- * \param ch the current character's code, 32 bits.
2154
- * \returns The kerning size between the two specified characters, in pixels, or -1 on error.
2155
- *
2156
- * \since This function is available since SDL_ttf 2.0.18.
2157
- */
2158
- extern DECLSPEC int TTF_GetFontKerningSizeGlyphs32(TTF_Font *font, Uint32 previous_ch, Uint32 ch);
2159
-
2160
- /**
2161
- * Enable Signed Distance Field rendering for a font.
2162
- *
2163
- * This works with the Blended APIs. SDF is a technique that
2164
- * helps fonts look sharp even when scaling and rotating.
2165
- *
2166
- * This clears already-generated glyphs, if any, from the cache.
2167
- *
2168
- * \param font the font to set SDF support on.
2169
- * \param on_off SDL_TRUE to enable SDF, SDL_FALSE to disable.
2170
- *
2171
- * \returns 0 on success, -1 on error.
2172
- *
2173
- * \since This function is available since SDL_ttf 2.0.18.
2174
- *
2175
- * \sa TTF_GetFontSDF
2176
- */
2177
- extern DECLSPEC int TTF_SetFontSDF(TTF_Font *font, SDL_bool on_off);
2178
-
2179
- /**
2180
- * Query whether Signed Distance Field rendering is enabled for a font.
2181
- *
2182
- * \param font the font to query
2183
- *
2184
- * \returns SDL_TRUE if enabled, SDL_FALSE otherwise.
2185
- *
2186
- * \since This function is available since SDL_ttf 2.0.18.
2187
- *
2188
- * \sa TTF_SetFontSDF
2189
- */
2190
- extern DECLSPEC SDL_bool TTF_GetFontSDF(const TTF_Font *font);
2191
-
2192
- /**
2193
- * Report SDL_ttf errors
2194
- *
2195
- * \sa TTF_GetError
2196
- */
2197
- #define TTF_SetError SDL_SetError
2198
-
2199
- /**
2200
- * Get last SDL_ttf error
2201
- *
2202
- * \sa TTF_SetError
2203
- */
2204
- #define TTF_GetError SDL_GetError
2205
-
2206
- /**
2207
- * Direction flags
2208
- *
2209
- * \sa TTF_SetFontDirection
2210
- */
2211
- typedef enum
2212
- {
2213
- TTF_DIRECTION_LTR = 0, /* Left to Right */
2214
- TTF_DIRECTION_RTL, /* Right to Left */
2215
- TTF_DIRECTION_TTB, /* Top to Bottom */
2216
- TTF_DIRECTION_BTT /* Bottom to Top */
2217
- } TTF_Direction;
2218
-
2219
- /**
2220
- * Set a global direction to be used for text shaping.
2221
- *
2222
- * \deprecated This function expects an hb_direction_t value, from HarfBuzz,
2223
- * cast to an int, and affects all fonts globally. Please use
2224
- * TTF_SetFontDirection() instead, which uses an enum supplied by
2225
- * SDL_ttf itself and operates on a per-font basis.
2226
- *
2227
- * This is a global setting; fonts will favor a value set with
2228
- * TTF_SetFontDirection(), but if they have not had one explicitly
2229
- * set, they will use the value specified here.
2230
- *
2231
- * The default value is `HB_DIRECTION_LTR` (left-to-right text
2232
- * flow).
2233
- *
2234
- * \param direction an hb_direction_t value.
2235
- * \returns 0, or -1 if SDL_ttf is not compiled with HarfBuzz support.
2236
- *
2237
- * \since This function is available since SDL_ttf 2.0.18.
2238
- *
2239
- * \sa TTF_SetFontDirection
2240
- */
2241
- extern SDL_DEPRECATED DECLSPEC int SDLCALL TTF_SetDirection(int direction); /* hb_direction_t */
2242
-
2243
- /**
2244
- * Set a global script to be used for text shaping.
2245
- *
2246
- * \deprecated This function expects an hb_script_t value, from HarfBuzz, cast
2247
- * to an int, and affects all fonts globally. Please use
2248
- * TTF_SetFontScriptName() instead, which accepts a string that is
2249
- * converted to an equivalent int internally, and operates on a
2250
- * per-font basis.
2251
- *
2252
- * This is a global setting; fonts will favor a value set with
2253
- * TTF_SetFontScriptName(), but if they have not had one
2254
- * explicitly set, they will use the value specified here.
2255
- *
2256
- * The default value is `HB_SCRIPT_UNKNOWN`.
2257
- *
2258
- * \returns 0, or -1 if SDL_ttf is not compiled with HarfBuzz support.
2259
- *
2260
- * \since This function is available since SDL_ttf 2.0.18.
2261
- *
2262
- * \sa TTF_SetFontScriptName
2263
- */
2264
- extern SDL_DEPRECATED DECLSPEC int SDLCALL TTF_SetScript(int script); /* hb_script_t */
2265
-
2266
- /**
2267
- * Set direction to be used for text shaping by a font.
2268
- *
2269
- * Any value supplied here will override the global direction set with the
2270
- * deprecated TTF_SetDirection().
2271
- *
2272
- * Possible direction values are:
2273
- *
2274
- * - `TTF_DIRECTION_LTR` (Left to Right)
2275
- * - `TTF_DIRECTION_RTL` (Right to Left)
2276
- * - `TTF_DIRECTION_TTB` (Top to Bottom)
2277
- * - `TTF_DIRECTION_BTT` (Bottom to Top)
2278
- *
2279
- * If SDL_ttf was not built with HarfBuzz support, this function returns -1.
2280
- *
2281
- * \param font the font to specify a direction for.
2282
- * \param direction the new direction for text to flow.
2283
- * \returns 0 on success, or -1 on error.
2284
- *
2285
- * \since This function is available since SDL_ttf 2.20.0.
2286
- */
2287
- extern DECLSPEC int SDLCALL TTF_SetFontDirection(TTF_Font *font, TTF_Direction direction);
2288
-
2289
- /**
2290
- * Set script to be used for text shaping by a font.
2291
- *
2292
- * Any value supplied here will override the global script set with the
2293
- * deprecated TTF_SetScript().
2294
- *
2295
- * The supplied script value must be a null-terminated string of exactly four
2296
- * characters.
2297
- *
2298
- * If SDL_ttf was not built with HarfBuzz support, this function returns -1.
2299
- *
2300
- * \param font the font to specify a direction for.
2301
- * \param script null-terminated string of exactly 4 characters.
2302
- * \returns 0 on success, or -1 on error.
2303
- *
2304
- * \since This function is available since SDL_ttf 2.20.0.
2305
- */
2306
- extern DECLSPEC int SDLCALL TTF_SetFontScriptName(TTF_Font *font, const char *script);
2307
-
2308
- /* Ends C function definitions when using C++ */
2309
- #ifdef __cplusplus
2310
- }
2311
- #endif
2312
- #include "close_code.h"
2313
-
2314
- #endif /* SDL_TTF_H_ */
2315
-
2316
- /* vi: set ts=4 sw=4 expandtab: */
1
+ /*
2
+ SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts
3
+ Copyright (C) 2001-2022 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+
23
+ /**
24
+ * \file SDL_ttf.h
25
+ *
26
+ * Header file for SDL_ttf library
27
+ *
28
+ * This library is a wrapper around the excellent FreeType 2.0 library,
29
+ * available at: https://www.freetype.org/
30
+ *
31
+ * Note: In many places, SDL_ttf will say "glyph" when it means "code point."
32
+ * Unicode is hard, we learn as we go, and we apologize for adding to the
33
+ * confusion.
34
+ *
35
+ */
36
+ #ifndef SDL_TTF_H_
37
+ #define SDL_TTF_H_
38
+
39
+ #include "SDL.h"
40
+ #include "begin_code.h"
41
+
42
+ /* Set up for C function definitions, even when using C++ */
43
+ #ifdef __cplusplus
44
+ extern "C" {
45
+ #endif
46
+
47
+ /**
48
+ * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
49
+ */
50
+ #define SDL_TTF_MAJOR_VERSION 2
51
+ #define SDL_TTF_MINOR_VERSION 20
52
+ #define SDL_TTF_PATCHLEVEL 1
53
+
54
+ /**
55
+ * This macro can be used to fill a version structure with the compile-time
56
+ * version of the SDL_ttf library.
57
+ */
58
+ #define SDL_TTF_VERSION(X) \
59
+ { \
60
+ (X)->major = SDL_TTF_MAJOR_VERSION; \
61
+ (X)->minor = SDL_TTF_MINOR_VERSION; \
62
+ (X)->patch = SDL_TTF_PATCHLEVEL; \
63
+ }
64
+
65
+ /**
66
+ * Backwards compatibility
67
+ */
68
+ #define TTF_MAJOR_VERSION SDL_TTF_MAJOR_VERSION
69
+ #define TTF_MINOR_VERSION SDL_TTF_MINOR_VERSION
70
+ #define TTF_PATCHLEVEL SDL_TTF_PATCHLEVEL
71
+ #define TTF_VERSION(X) SDL_TTF_VERSION(X)
72
+
73
+ #if SDL_TTF_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3
74
+ /**
75
+ * This is the version number macro for the current SDL_ttf version.
76
+ *
77
+ * In versions higher than 2.9.0, the minor version overflows into
78
+ * the thousands digit: for example, 2.23.0 is encoded as 4300.
79
+ * This macro will not be available in SDL 3.x or SDL_ttf 3.x.
80
+ *
81
+ * \deprecated, use SDL_TTF_VERSION_ATLEAST or SDL_TTF_VERSION instead.
82
+ */
83
+ #define SDL_TTF_COMPILEDVERSION \
84
+ SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL)
85
+ #endif /* SDL_TTF_MAJOR_VERSION < 3 && SDL_MAJOR_VERSION < 3 */
86
+
87
+ /**
88
+ * This macro will evaluate to true if compiled with SDL_ttf at least X.Y.Z.
89
+ */
90
+ #define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \
91
+ ((SDL_TTF_MAJOR_VERSION >= X) && \
92
+ (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION >= Y) && \
93
+ (SDL_TTF_MAJOR_VERSION > X || SDL_TTF_MINOR_VERSION > Y || SDL_TTF_PATCHLEVEL >= Z))
94
+
95
+ /* Make sure this is defined (only available in newer SDL versions) */
96
+ #ifndef SDL_DEPRECATED
97
+ #define SDL_DEPRECATED
98
+ #endif
99
+
100
+ /**
101
+ * Query the version of SDL_ttf that the program is linked against.
102
+ *
103
+ * This function gets the version of the dynamically linked SDL_ttf library.
104
+ * This is separate from the SDL_TTF_VERSION() macro, which tells you what
105
+ * version of the SDL_ttf headers you compiled against.
106
+ *
107
+ * This returns static internal data; do not free or modify it!
108
+ *
109
+ * \returns a pointer to the version information.
110
+ *
111
+ * \since This function is available since SDL_ttf 2.0.12.
112
+ */
113
+ extern DECLSPEC const SDL_version * SDLCALL TTF_Linked_Version(void);
114
+
115
+ /**
116
+ * Query the version of the FreeType library in use.
117
+ *
118
+ * TTF_Init() should be called before calling this function.
119
+ *
120
+ * \param major to be filled in with the major version number. Can be NULL.
121
+ * \param minor to be filled in with the minor version number. Can be NULL.
122
+ * \param patch to be filled in with the param version number. Can be NULL.
123
+ *
124
+ * \since This function is available since SDL_ttf 2.0.18.
125
+ *
126
+ * \sa TTF_Init
127
+ */
128
+ extern DECLSPEC void SDLCALL TTF_GetFreeTypeVersion(int *major, int *minor, int *patch);
129
+
130
+ /**
131
+ * Query the version of the HarfBuzz library in use.
132
+ *
133
+ * If HarfBuzz is not available, the version reported is 0.0.0.
134
+ *
135
+ * \param major to be filled in with the major version number. Can be NULL.
136
+ * \param minor to be filled in with the minor version number. Can be NULL.
137
+ * \param patch to be filled in with the param version number. Can be NULL.
138
+ *
139
+ * \since This function is available since SDL_ttf 2.0.18.
140
+ */
141
+ extern DECLSPEC void SDLCALL TTF_GetHarfBuzzVersion(int *major, int *minor, int *patch);
142
+
143
+ /**
144
+ * ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark)
145
+ */
146
+ #define UNICODE_BOM_NATIVE 0xFEFF
147
+ #define UNICODE_BOM_SWAPPED 0xFFFE
148
+
149
+ /**
150
+ * Tell SDL_ttf whether UNICODE text is generally byteswapped.
151
+ *
152
+ * A UNICODE BOM character in a string will override this setting for the
153
+ * remainder of that string.
154
+ *
155
+ * \param swapped boolean to indicate whether text is byteswapped
156
+ *
157
+ * \since This function is available since SDL_ttf 2.0.12.
158
+ */
159
+ extern DECLSPEC void SDLCALL TTF_ByteSwappedUNICODE(SDL_bool swapped);
160
+
161
+ /**
162
+ * The internal structure containing font information. Opaque data!
163
+ */
164
+ typedef struct _TTF_Font TTF_Font;
165
+
166
+ /**
167
+ * Initialize SDL_ttf.
168
+ *
169
+ * You must successfully call this function before it is safe to call any
170
+ * other function in this library, with one exception: a human-readable error
171
+ * message can be retrieved from TTF_GetError() if this function fails.
172
+ *
173
+ * SDL must be initialized before calls to functions in this library, because
174
+ * this library uses utility functions from the SDL library.
175
+ *
176
+ * It is safe to call this more than once; the library keeps a counter of init
177
+ * calls, and decrements it on each call to TTF_Quit, so you must pair your
178
+ * init and quit calls.
179
+ *
180
+ * \returns 0 on success, -1 on error.
181
+ *
182
+ * \since This function is available since SDL_ttf 2.0.12.
183
+ *
184
+ * \sa TTF_Quit
185
+ */
186
+ extern DECLSPEC int SDLCALL TTF_Init(void);
187
+
188
+ /**
189
+ * Create a font from a file, using a specified point size.
190
+ *
191
+ * Some .fon fonts will have several sizes embedded in the file, so the point
192
+ * size becomes the index of choosing which size. If the value is too high,
193
+ * the last indexed size will be the default.
194
+ *
195
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
196
+ *
197
+ * \param file path to font file.
198
+ * \param ptsize point size to use for the newly-opened font.
199
+ * \returns a valid TTF_Font, or NULL on error.
200
+ *
201
+ * \since This function is available since SDL_ttf 2.0.12.
202
+ *
203
+ * \sa TTF_CloseFont
204
+ */
205
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFont(const char *file, int ptsize);
206
+
207
+ /**
208
+ * Create a font from a file, using a specified face index.
209
+ *
210
+ * Some .fon fonts will have several sizes embedded in the file, so the point
211
+ * size becomes the index of choosing which size. If the value is too high,
212
+ * the last indexed size will be the default.
213
+ *
214
+ * Some fonts have multiple "faces" included. The index specifies which face
215
+ * to use from the font file. Font files with only one face should specify
216
+ * zero for the index.
217
+ *
218
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
219
+ *
220
+ * \param file path to font file.
221
+ * \param ptsize point size to use for the newly-opened font.
222
+ * \param index index of the face in the font file.
223
+ * \returns a valid TTF_Font, or NULL on error.
224
+ *
225
+ * \since This function is available since SDL_ttf 2.0.12.
226
+ *
227
+ * \sa TTF_CloseFont
228
+ */
229
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndex(const char *file, int ptsize, long index);
230
+
231
+ /**
232
+ * Create a font from an SDL_RWops, using a specified point size.
233
+ *
234
+ * Some .fon fonts will have several sizes embedded in the file, so the point
235
+ * size becomes the index of choosing which size. If the value is too high,
236
+ * the last indexed size will be the default.
237
+ *
238
+ * If `freesrc` is non-zero, the RWops will be closed before returning,
239
+ * whether this function succeeds or not. SDL_ttf reads everything it needs
240
+ * from the RWops during this call in any case.
241
+ *
242
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
243
+ *
244
+ * \param src an SDL_RWops to provide a font file's data.
245
+ * \param freesrc non-zero to close the RWops before returning, zero to leave
246
+ * it open.
247
+ * \param ptsize point size to use for the newly-opened font.
248
+ * \returns a valid TTF_Font, or NULL on error.
249
+ *
250
+ * \since This function is available since SDL_ttf 2.0.12.
251
+ *
252
+ * \sa TTF_CloseFont
253
+ */
254
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontRW(SDL_RWops *src, int freesrc, int ptsize);
255
+
256
+ /**
257
+ * Create a font from an SDL_RWops, using a specified face index.
258
+ *
259
+ * Some .fon fonts will have several sizes embedded in the file, so the point
260
+ * size becomes the index of choosing which size. If the value is too high,
261
+ * the last indexed size will be the default.
262
+ *
263
+ * If `freesrc` is non-zero, the RWops will be closed before returning,
264
+ * whether this function succeeds or not. SDL_ttf reads everything it needs
265
+ * from the RWops during this call in any case.
266
+ *
267
+ * Some fonts have multiple "faces" included. The index specifies which face
268
+ * to use from the font file. Font files with only one face should specify
269
+ * zero for the index.
270
+ *
271
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
272
+ *
273
+ * \param src an SDL_RWops to provide a font file's data.
274
+ * \param freesrc non-zero to close the RWops before returning, zero to leave
275
+ * it open.
276
+ * \param ptsize point size to use for the newly-opened font.
277
+ * \param index index of the face in the font file.
278
+ * \returns a valid TTF_Font, or NULL on error.
279
+ *
280
+ * \since This function is available since SDL_ttf 2.0.12.
281
+ *
282
+ * \sa TTF_CloseFont
283
+ */
284
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexRW(SDL_RWops *src, int freesrc, int ptsize, long index);
285
+
286
+ /**
287
+ * Create a font from a file, using target resolutions (in DPI).
288
+ *
289
+ * DPI scaling only applies to scalable fonts (e.g. TrueType).
290
+ *
291
+ * Some .fon fonts will have several sizes embedded in the file, so the point
292
+ * size becomes the index of choosing which size. If the value is too high,
293
+ * the last indexed size will be the default.
294
+ *
295
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
296
+ *
297
+ * \param file path to font file.
298
+ * \param ptsize point size to use for the newly-opened font.
299
+ * \param hdpi the target horizontal DPI.
300
+ * \param vdpi the target vertical DPI.
301
+ * \returns a valid TTF_Font, or NULL on error.
302
+ *
303
+ * \since This function is available since SDL_ttf 2.0.18.
304
+ *
305
+ * \sa TTF_CloseFont
306
+ */
307
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPI(const char *file, int ptsize, unsigned int hdpi, unsigned int vdpi);
308
+
309
+ /**
310
+ * Create a font from a file, using target resolutions (in DPI).
311
+ *
312
+ * DPI scaling only applies to scalable fonts (e.g. TrueType).
313
+ *
314
+ * Some .fon fonts will have several sizes embedded in the file, so the point
315
+ * size becomes the index of choosing which size. If the value is too high,
316
+ * the last indexed size will be the default.
317
+ *
318
+ * Some fonts have multiple "faces" included. The index specifies which face
319
+ * to use from the font file. Font files with only one face should specify
320
+ * zero for the index.
321
+ *
322
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
323
+ *
324
+ * \param file path to font file.
325
+ * \param ptsize point size to use for the newly-opened font.
326
+ * \param index index of the face in the font file.
327
+ * \param hdpi the target horizontal DPI.
328
+ * \param vdpi the target vertical DPI.
329
+ * \returns a valid TTF_Font, or NULL on error.
330
+ *
331
+ * \since This function is available since SDL_ttf 2.0.18.
332
+ *
333
+ * \sa TTF_CloseFont
334
+ */
335
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPI(const char *file, int ptsize, long index, unsigned int hdpi, unsigned int vdpi);
336
+
337
+ /**
338
+ * Opens a font from an SDL_RWops with target resolutions (in DPI).
339
+ *
340
+ * DPI scaling only applies to scalable fonts (e.g. TrueType).
341
+ *
342
+ * Some .fon fonts will have several sizes embedded in the file, so the point
343
+ * size becomes the index of choosing which size. If the value is too high,
344
+ * the last indexed size will be the default.
345
+ *
346
+ * If `freesrc` is non-zero, the RWops will be closed before returning,
347
+ * whether this function succeeds or not. SDL_ttf reads everything it needs
348
+ * from the RWops during this call in any case.
349
+ *
350
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
351
+ *
352
+ * \param src an SDL_RWops to provide a font file's data.
353
+ * \param freesrc non-zero to close the RWops before returning, zero to leave
354
+ * it open.
355
+ * \param ptsize point size to use for the newly-opened font.
356
+ * \param hdpi the target horizontal DPI.
357
+ * \param vdpi the target vertical DPI.
358
+ * \returns a valid TTF_Font, or NULL on error.
359
+ *
360
+ * \since This function is available since SDL_ttf 2.0.18.
361
+ *
362
+ * \sa TTF_CloseFont
363
+ */
364
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPIRW(SDL_RWops *src, int freesrc, int ptsize, unsigned int hdpi, unsigned int vdpi);
365
+
366
+ /**
367
+ * Opens a font from an SDL_RWops with target resolutions (in DPI).
368
+ *
369
+ * DPI scaling only applies to scalable fonts (e.g. TrueType).
370
+ *
371
+ * Some .fon fonts will have several sizes embedded in the file, so the point
372
+ * size becomes the index of choosing which size. If the value is too high,
373
+ * the last indexed size will be the default.
374
+ *
375
+ * If `freesrc` is non-zero, the RWops will be closed before returning,
376
+ * whether this function succeeds or not. SDL_ttf reads everything it needs
377
+ * from the RWops during this call in any case.
378
+ *
379
+ * Some fonts have multiple "faces" included. The index specifies which face
380
+ * to use from the font file. Font files with only one face should specify
381
+ * zero for the index.
382
+ *
383
+ * When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
384
+ *
385
+ * \param src an SDL_RWops to provide a font file's data.
386
+ * \param freesrc non-zero to close the RWops before returning, zero to leave
387
+ * it open.
388
+ * \param ptsize point size to use for the newly-opened font.
389
+ * \param index index of the face in the font file.
390
+ * \param hdpi the target horizontal DPI.
391
+ * \param vdpi the target vertical DPI.
392
+ * \returns a valid TTF_Font, or NULL on error.
393
+ *
394
+ * \since This function is available since SDL_ttf 2.0.18.
395
+ *
396
+ * \sa TTF_CloseFont
397
+ */
398
+ extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPIRW(SDL_RWops *src, int freesrc, int ptsize, long index, unsigned int hdpi, unsigned int vdpi);
399
+
400
+ /**
401
+ * Set a font's size dynamically.
402
+ *
403
+ * This clears already-generated glyphs, if any, from the cache.
404
+ *
405
+ * \param font the font to resize.
406
+ * \param ptsize the new point size.
407
+ * \returns 0 if successful, -1 on error
408
+ *
409
+ * \since This function is available since SDL_ttf 2.0.18.
410
+ */
411
+ extern DECLSPEC int SDLCALL TTF_SetFontSize(TTF_Font *font, int ptsize);
412
+
413
+ /**
414
+ * Set font size dynamically with target resolutions (in DPI).
415
+ *
416
+ * This clears already-generated glyphs, if any, from the cache.
417
+ *
418
+ * \param font the font to resize.
419
+ * \param ptsize the new point size.
420
+ * \param hdpi the target horizontal DPI.
421
+ * \param vdpi the target vertical DPI.
422
+ * \returns 0 if successful, -1 on error.
423
+ *
424
+ * \since This function is available since SDL_ttf 2.0.18.
425
+ */
426
+ extern DECLSPEC int SDLCALL TTF_SetFontSizeDPI(TTF_Font *font, int ptsize, unsigned int hdpi, unsigned int vdpi);
427
+
428
+ /**
429
+ * Font style flags
430
+ */
431
+ #define TTF_STYLE_NORMAL 0x00
432
+ #define TTF_STYLE_BOLD 0x01
433
+ #define TTF_STYLE_ITALIC 0x02
434
+ #define TTF_STYLE_UNDERLINE 0x04
435
+ #define TTF_STYLE_STRIKETHROUGH 0x08
436
+
437
+ /**
438
+ * Query a font's current style.
439
+ *
440
+ * The font styles are a set of bit flags, OR'd together:
441
+ *
442
+ * - `TTF_STYLE_NORMAL` (is zero)
443
+ * - `TTF_STYLE_BOLD`
444
+ * - `TTF_STYLE_ITALIC`
445
+ * - `TTF_STYLE_UNDERLINE`
446
+ * - `TTF_STYLE_STRIKETHROUGH`
447
+ *
448
+ * \param font the font to query.
449
+ * \returns the current font style, as a set of bit flags.
450
+ *
451
+ * \since This function is available since SDL_ttf 2.0.12.
452
+ *
453
+ * \sa TTF_SetFontStyle
454
+ */
455
+ extern DECLSPEC int SDLCALL TTF_GetFontStyle(const TTF_Font *font);
456
+
457
+ /**
458
+ * Set a font's current style.
459
+ *
460
+ * Setting the style clears already-generated glyphs, if any, from the cache.
461
+ *
462
+ * The font styles are a set of bit flags, OR'd together:
463
+ *
464
+ * - `TTF_STYLE_NORMAL` (is zero)
465
+ * - `TTF_STYLE_BOLD`
466
+ * - `TTF_STYLE_ITALIC`
467
+ * - `TTF_STYLE_UNDERLINE`
468
+ * - `TTF_STYLE_STRIKETHROUGH`
469
+ *
470
+ * \param font the font to set a new style on.
471
+ * \param style the new style values to set, OR'd together.
472
+ *
473
+ * \since This function is available since SDL_ttf 2.0.12.
474
+ *
475
+ * \sa TTF_GetFontStyle
476
+ */
477
+ extern DECLSPEC void SDLCALL TTF_SetFontStyle(TTF_Font *font, int style);
478
+
479
+ /**
480
+ * Query a font's current outline.
481
+ *
482
+ * \param font the font to query.
483
+ * \returns the font's current outline value.
484
+ *
485
+ * \since This function is available since SDL_ttf 2.0.12.
486
+ *
487
+ * \sa TTF_SetFontOutline
488
+ */
489
+ extern DECLSPEC int SDLCALL TTF_GetFontOutline(const TTF_Font *font);
490
+
491
+ /**
492
+ * Set a font's current outline.
493
+ *
494
+ * \param font the font to set a new outline on.
495
+ * \param outline positive outline value, 0 to default.
496
+ *
497
+ * \since This function is available since SDL_ttf 2.0.12.
498
+ *
499
+ * \sa TTF_GetFontOutline
500
+ */
501
+ extern DECLSPEC void SDLCALL TTF_SetFontOutline(TTF_Font *font, int outline);
502
+
503
+
504
+ /**
505
+ * Hinting flags
506
+ */
507
+ #define TTF_HINTING_NORMAL 0
508
+ #define TTF_HINTING_LIGHT 1
509
+ #define TTF_HINTING_MONO 2
510
+ #define TTF_HINTING_NONE 3
511
+ #define TTF_HINTING_LIGHT_SUBPIXEL 4
512
+
513
+ /**
514
+ * Query a font's current FreeType hinter setting.
515
+ *
516
+ * The hinter setting is a single value:
517
+ *
518
+ * - `TTF_HINTING_NORMAL`
519
+ * - `TTF_HINTING_LIGHT`
520
+ * - `TTF_HINTING_MONO`
521
+ * - `TTF_HINTING_NONE`
522
+ * - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 2.0.18 and later)
523
+ *
524
+ * \param font the font to query.
525
+ * \returns the font's current hinter value.
526
+ *
527
+ * \since This function is available since SDL_ttf 2.0.12.
528
+ *
529
+ * \sa TTF_SetFontHinting
530
+ */
531
+ extern DECLSPEC int SDLCALL TTF_GetFontHinting(const TTF_Font *font);
532
+
533
+ /**
534
+ * Set a font's current hinter setting.
535
+ *
536
+ * Setting it clears already-generated glyphs, if any, from the cache.
537
+ *
538
+ * The hinter setting is a single value:
539
+ *
540
+ * - `TTF_HINTING_NORMAL`
541
+ * - `TTF_HINTING_LIGHT`
542
+ * - `TTF_HINTING_MONO`
543
+ * - `TTF_HINTING_NONE`
544
+ * - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 2.0.18 and later)
545
+ *
546
+ * \param font the font to set a new hinter setting on.
547
+ * \param hinting the new hinter setting.
548
+ *
549
+ * \since This function is available since SDL_ttf 2.0.12.
550
+ *
551
+ * \sa TTF_GetFontHinting
552
+ */
553
+ extern DECLSPEC void SDLCALL TTF_SetFontHinting(TTF_Font *font, int hinting);
554
+
555
+ /**
556
+ * Special layout option for rendering wrapped text
557
+ */
558
+ #define TTF_WRAPPED_ALIGN_LEFT 0
559
+ #define TTF_WRAPPED_ALIGN_CENTER 1
560
+ #define TTF_WRAPPED_ALIGN_RIGHT 2
561
+
562
+ /**
563
+ * Query a font's current wrap alignment option.
564
+ *
565
+ * The wrap alignment option can be one of the following:
566
+ *
567
+ * - `TTF_WRAPPED_ALIGN_LEFT`
568
+ * - `TTF_WRAPPED_ALIGN_CENTER`
569
+ * - `TTF_WRAPPED_ALIGN_RIGHT`
570
+ *
571
+ * \param font the font to query.
572
+ * \returns the font's current wrap alignment option.
573
+ *
574
+ * \since This function is available since SDL_ttf 2.20.0.
575
+ *
576
+ * \sa TTF_SetFontWrappedAlign
577
+ */
578
+ extern DECLSPEC int SDLCALL TTF_GetFontWrappedAlign(const TTF_Font *font);
579
+
580
+ /**
581
+ * Set a font's current wrap alignment option.
582
+ *
583
+ * The wrap alignment option can be one of the following:
584
+ *
585
+ * - `TTF_WRAPPED_ALIGN_LEFT`
586
+ * - `TTF_WRAPPED_ALIGN_CENTER`
587
+ * - `TTF_WRAPPED_ALIGN_RIGHT`
588
+ *
589
+ * \param font the font to set a new wrap alignment option on.
590
+ * \param align the new wrap alignment option.
591
+ *
592
+ * \since This function is available since SDL_ttf 2.20.0.
593
+ *
594
+ * \sa TTF_GetFontWrappedAlign
595
+ */
596
+ extern DECLSPEC void SDLCALL TTF_SetFontWrappedAlign(TTF_Font *font, int align);
597
+
598
+ /**
599
+ * Query the total height of a font.
600
+ *
601
+ * This is usually equal to point size.
602
+ *
603
+ * \param font the font to query.
604
+ * \returns the font's height.
605
+ *
606
+ * \since This function is available since SDL_ttf 2.0.12.
607
+ */
608
+ extern DECLSPEC int SDLCALL TTF_FontHeight(const TTF_Font *font);
609
+
610
+ /**
611
+ * Query the offset from the baseline to the top of a font.
612
+ *
613
+ * This is a positive value, relative to the baseline.
614
+ *
615
+ * \param font the font to query.
616
+ * \returns the font's ascent.
617
+ *
618
+ * \since This function is available since SDL_ttf 2.0.12.
619
+ */
620
+ extern DECLSPEC int SDLCALL TTF_FontAscent(const TTF_Font *font);
621
+
622
+ /**
623
+ * Query the offset from the baseline to the bottom of a font.
624
+ *
625
+ * This is a negative value, relative to the baseline.
626
+ *
627
+ * \param font the font to query.
628
+ * \returns the font's descent.
629
+ *
630
+ * \since This function is available since SDL_ttf 2.0.12.
631
+ */
632
+ extern DECLSPEC int SDLCALL TTF_FontDescent(const TTF_Font *font);
633
+
634
+ /**
635
+ * Query the recommended spacing between lines of text for a font.
636
+ *
637
+ * \param font the font to query.
638
+ * \returns the font's recommended spacing.
639
+ *
640
+ * \since This function is available since SDL_ttf 2.0.12.
641
+ */
642
+ extern DECLSPEC int SDLCALL TTF_FontLineSkip(const TTF_Font *font);
643
+
644
+ /**
645
+ * Query whether or not kerning is allowed for a font.
646
+ *
647
+ * \param font the font to query.
648
+ * \returns non-zero if kerning is enabled, zero otherwise.
649
+ *
650
+ * \since This function is available since SDL_ttf 2.0.12.
651
+ */
652
+ extern DECLSPEC int SDLCALL TTF_GetFontKerning(const TTF_Font *font);
653
+
654
+ /**
655
+ * Set if kerning is allowed for a font.
656
+ *
657
+ * Newly-opened fonts default to allowing kerning. This is generally a good
658
+ * policy unless you have a strong reason to disable it, as it tends to
659
+ * produce better rendering (with kerning disabled, some fonts might render
660
+ * the word `kerning` as something that looks like `keming` for example).
661
+ *
662
+ * \param font the font to set kerning on.
663
+ * \param allowed non-zero to allow kerning, zero to disallow.
664
+ *
665
+ * \since This function is available since SDL_ttf 2.0.12.
666
+ */
667
+ extern DECLSPEC void SDLCALL TTF_SetFontKerning(TTF_Font *font, int allowed);
668
+
669
+ /**
670
+ * Query the number of faces of a font.
671
+ *
672
+ * \param font the font to query.
673
+ * \returns the number of FreeType font faces.
674
+ *
675
+ * \since This function is available since SDL_ttf 2.0.12.
676
+ */
677
+ extern DECLSPEC long SDLCALL TTF_FontFaces(const TTF_Font *font);
678
+
679
+ /**
680
+ * Query whether a font is fixed-width.
681
+ *
682
+ * A "fixed-width" font means all glyphs are the same width across; a
683
+ * lowercase 'i' will be the same size across as a capital 'W', for example.
684
+ * This is common for terminals and text editors, and other apps that treat
685
+ * text as a grid. Most other things (WYSIWYG word processors, web pages, etc)
686
+ * are more likely to not be fixed-width in most cases.
687
+ *
688
+ * \param font the font to query.
689
+ * \returns non-zero if fixed-width, zero if not.
690
+ *
691
+ * \since This function is available since SDL_ttf 2.0.12.
692
+ */
693
+ extern DECLSPEC int SDLCALL TTF_FontFaceIsFixedWidth(const TTF_Font *font);
694
+
695
+ /**
696
+ * Query a font's family name.
697
+ *
698
+ * This string is dictated by the contents of the font file.
699
+ *
700
+ * Note that the returned string is to internal storage, and should not be
701
+ * modifed or free'd by the caller. The string becomes invalid, with the rest
702
+ * of the font, when `font` is handed to TTF_CloseFont().
703
+ *
704
+ * \param font the font to query.
705
+ * \returns the font's family name.
706
+ *
707
+ * \since This function is available since SDL_ttf 2.0.12.
708
+ */
709
+ extern DECLSPEC const char * SDLCALL TTF_FontFaceFamilyName(const TTF_Font *font);
710
+
711
+ /**
712
+ * Query a font's style name.
713
+ *
714
+ * This string is dictated by the contents of the font file.
715
+ *
716
+ * Note that the returned string is to internal storage, and should not be
717
+ * modifed or free'd by the caller. The string becomes invalid, with the rest
718
+ * of the font, when `font` is handed to TTF_CloseFont().
719
+ *
720
+ * \param font the font to query.
721
+ * \returns the font's style name.
722
+ *
723
+ * \since This function is available since SDL_ttf 2.0.12.
724
+ */
725
+ extern DECLSPEC const char * SDLCALL TTF_FontFaceStyleName(const TTF_Font *font);
726
+
727
+ /**
728
+ * Check whether a glyph is provided by the font for a 16-bit codepoint.
729
+ *
730
+ * Note that this version of the function takes a 16-bit character code, which
731
+ * covers the Basic Multilingual Plane, but is insufficient to cover the
732
+ * entire set of possible Unicode values, including emoji glyphs. You should
733
+ * use TTF_GlyphIsProvided32() instead, which offers the same functionality
734
+ * but takes a 32-bit codepoint instead.
735
+ *
736
+ * The only reason to use this function is that it was available since the
737
+ * beginning of time, more or less.
738
+ *
739
+ * \param font the font to query.
740
+ * \param ch the character code to check.
741
+ * \returns non-zero if font provides a glyph for this character, zero if not.
742
+ *
743
+ * \since This function is available since SDL_ttf 2.0.12.
744
+ *
745
+ * \sa TTF_GlyphIsProvided32
746
+ */
747
+ extern DECLSPEC int SDLCALL TTF_GlyphIsProvided(TTF_Font *font, Uint16 ch);
748
+
749
+ /**
750
+ * Check whether a glyph is provided by the font for a 32-bit codepoint.
751
+ *
752
+ * This is the same as TTF_GlyphIsProvided(), but takes a 32-bit character
753
+ * instead of 16-bit, and thus can query a larger range. If you are sure
754
+ * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
755
+ * not to use this function exclusively.
756
+ *
757
+ * \param font the font to query.
758
+ * \param ch the character code to check.
759
+ * \returns non-zero if font provides a glyph for this character, zero if not.
760
+ *
761
+ * \since This function is available since SDL_ttf 2.0.18.
762
+ */
763
+ extern DECLSPEC int SDLCALL TTF_GlyphIsProvided32(TTF_Font *font, Uint32 ch);
764
+
765
+ /**
766
+ * Query the metrics (dimensions) of a font's 16-bit glyph.
767
+ *
768
+ * To understand what these metrics mean, here is a useful link:
769
+ *
770
+ * https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
771
+ *
772
+ * Note that this version of the function takes a 16-bit character code, which
773
+ * covers the Basic Multilingual Plane, but is insufficient to cover the
774
+ * entire set of possible Unicode values, including emoji glyphs. You should
775
+ * use TTF_GlyphMetrics32() instead, which offers the same functionality but
776
+ * takes a 32-bit codepoint instead.
777
+ *
778
+ * The only reason to use this function is that it was available since the
779
+ * beginning of time, more or less.
780
+ *
781
+ * \param font the font to query.
782
+ * \param ch the character code to check.
783
+ *
784
+ * \since This function is available since SDL_ttf 2.0.12.
785
+ *
786
+ * \sa TTF_GlyphMetrics32
787
+ */
788
+ extern DECLSPEC int SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
789
+ int *minx, int *maxx,
790
+ int *miny, int *maxy, int *advance);
791
+
792
+ /**
793
+ * Query the metrics (dimensions) of a font's 32-bit glyph.
794
+ *
795
+ * To understand what these metrics mean, here is a useful link:
796
+ *
797
+ * https://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
798
+ *
799
+ * This is the same as TTF_GlyphMetrics(), but takes a 32-bit character
800
+ * instead of 16-bit, and thus can query a larger range. If you are sure
801
+ * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
802
+ * not to use this function exclusively.
803
+ *
804
+ * \param font the font to query.
805
+ * \param ch the character code to check.
806
+ *
807
+ * \since This function is available since SDL_ttf 2.0.18.
808
+ */
809
+ extern DECLSPEC int SDLCALL TTF_GlyphMetrics32(TTF_Font *font, Uint32 ch,
810
+ int *minx, int *maxx,
811
+ int *miny, int *maxy, int *advance);
812
+
813
+ /**
814
+ * Calculate the dimensions of a rendered string of Latin1 text.
815
+ *
816
+ * This will report the width and height, in pixels, of the space that the
817
+ * specified string will take to fully render.
818
+ *
819
+ * This does not need to render the string to do this calculation.
820
+ *
821
+ * You almost certainly want TTF_SizeUTF8() unless you're sure you have a
822
+ * 1-byte Latin1 encoding. US ASCII characters will work with either function,
823
+ * but most other Unicode characters packed into a `const char *` will need
824
+ * UTF-8.
825
+ *
826
+ * \param font the font to query.
827
+ * \param text text to calculate, in Latin1 encoding.
828
+ * \param w will be filled with width, in pixels, on return.
829
+ * \param h will be filled with height, in pixels, on return.
830
+ * \returns 0 if successful, -1 on error.
831
+ *
832
+ * \since This function is available since SDL_ttf 2.0.12.
833
+ *
834
+ * \sa TTF_SizeUTF8
835
+ * \sa TTF_SizeUNICODE
836
+ */
837
+ extern DECLSPEC int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
838
+
839
+ /**
840
+ * Calculate the dimensions of a rendered string of UTF-8 text.
841
+ *
842
+ * This will report the width and height, in pixels, of the space that the
843
+ * specified string will take to fully render.
844
+ *
845
+ * This does not need to render the string to do this calculation.
846
+ *
847
+ * \param font the font to query.
848
+ * \param text text to calculate, in Latin1 encoding.
849
+ * \param w will be filled with width, in pixels, on return.
850
+ * \param h will be filled with height, in pixels, on return.
851
+ * \returns 0 if successful, -1 on error.
852
+ *
853
+ * \since This function is available since SDL_ttf 2.0.12.
854
+ *
855
+ * \sa TTF_SizeUNICODE
856
+ */
857
+ extern DECLSPEC int SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);
858
+
859
+ /**
860
+ * Calculate the dimensions of a rendered string of UCS-2 text.
861
+ *
862
+ * This will report the width and height, in pixels, of the space that the
863
+ * specified string will take to fully render.
864
+ *
865
+ * This does not need to render the string to do this calculation.
866
+ *
867
+ * Please note that this function is named "Unicode" but currently expects
868
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
869
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
870
+ * through the UTF-8 version of this function.
871
+ *
872
+ * \param font the font to query.
873
+ * \param text text to calculate, in UCS-2 encoding.
874
+ * \param w will be filled with width, in pixels, on return.
875
+ * \param h will be filled with height, in pixels, on return.
876
+ * \returns 0 if successful, -1 on error.
877
+ *
878
+ * \since This function is available since SDL_ttf 2.0.12.
879
+ *
880
+ * \sa TTF_SizeUTF8
881
+ */
882
+ extern DECLSPEC int SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h);
883
+
884
+ /**
885
+ * Calculate how much of a Latin1 string will fit in a given width.
886
+ *
887
+ * This reports the number of characters that can be rendered before reaching
888
+ * `measure_width`.
889
+ *
890
+ * This does not need to render the string to do this calculation.
891
+ *
892
+ * You almost certainly want TTF_MeasureUTF8() unless you're sure you have a
893
+ * 1-byte Latin1 encoding. US ASCII characters will work with either function,
894
+ * but most other Unicode characters packed into a `const char *` will need
895
+ * UTF-8.
896
+ *
897
+ * \param font the font to query.
898
+ * \param text text to calculate, in Latin1 encoding.
899
+ * \param measure_width maximum width, in pixels, available for the string.
900
+ * \param count on return, filled with number of characters that can be
901
+ * rendered.
902
+ * \param extent on return, filled with latest calculated width.
903
+ * \returns 0 if successful, -1 on error.
904
+ *
905
+ * \since This function is available since SDL_ttf 2.0.18.
906
+ *
907
+ * \sa TTF_MeasureText
908
+ * \sa TTF_MeasureUTF8
909
+ * \sa TTF_MeasureUNICODE
910
+ */
911
+ extern DECLSPEC int SDLCALL TTF_MeasureText(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
912
+
913
+ /**
914
+ * Calculate how much of a UTF-8 string will fit in a given width.
915
+ *
916
+ * This reports the number of characters that can be rendered before reaching
917
+ * `measure_width`.
918
+ *
919
+ * This does not need to render the string to do this calculation.
920
+ *
921
+ * \param font the font to query.
922
+ * \param text text to calculate, in UTF-8 encoding.
923
+ * \param measure_width maximum width, in pixels, available for the string.
924
+ * \param count on return, filled with number of characters that can be
925
+ * rendered.
926
+ * \param extent on return, filled with latest calculated width.
927
+ * \returns 0 if successful, -1 on error.
928
+ *
929
+ * \since This function is available since SDL_ttf 2.0.18.
930
+ *
931
+ * \sa TTF_MeasureText
932
+ * \sa TTF_MeasureUTF8
933
+ * \sa TTF_MeasureUNICODE
934
+ */
935
+ extern DECLSPEC int SDLCALL TTF_MeasureUTF8(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
936
+
937
+ /**
938
+ * Calculate how much of a UCS-2 string will fit in a given width.
939
+ *
940
+ * This reports the number of characters that can be rendered before reaching
941
+ * `measure_width`.
942
+ *
943
+ * This does not need to render the string to do this calculation.
944
+ *
945
+ * Please note that this function is named "Unicode" but currently expects
946
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
947
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
948
+ * through the UTF-8 version of this function.
949
+ *
950
+ * \param font the font to query.
951
+ * \param text text to calculate, in UCS-2 encoding.
952
+ * \param measure_width maximum width, in pixels, available for the string.
953
+ * \param count on return, filled with number of characters that can be
954
+ * rendered.
955
+ * \param extent on return, filled with latest calculated width.
956
+ * \returns 0 if successful, -1 on error.
957
+ *
958
+ * \since This function is available since SDL_ttf 2.0.18.
959
+ *
960
+ * \sa TTF_MeasureText
961
+ * \sa TTF_MeasureUTF8
962
+ * \sa TTF_MeasureUNICODE
963
+ */
964
+ extern DECLSPEC int SDLCALL TTF_MeasureUNICODE(TTF_Font *font, const Uint16 *text, int measure_width, int *extent, int *count);
965
+
966
+ /**
967
+ * Render Latin1 text at fast quality to a new 8-bit surface.
968
+ *
969
+ * This function will allocate a new 8-bit, palettized surface. The surface's
970
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
971
+ * will be set to the text color.
972
+ *
973
+ * This will not word-wrap the string; you'll get a surface with a single line
974
+ * of text, as long as the string requires. You can use
975
+ * TTF_RenderText_Solid_Wrapped() instead if you need to wrap the output to
976
+ * multiple lines.
977
+ *
978
+ * This will not wrap on newline characters.
979
+ *
980
+ * You almost certainly want TTF_RenderUTF8_Solid() unless you're sure you
981
+ * have a 1-byte Latin1 encoding. US ASCII characters will work with either
982
+ * function, but most other Unicode characters packed into a `const char *`
983
+ * will need UTF-8.
984
+ *
985
+ * You can render at other quality levels with TTF_RenderText_Shaded,
986
+ * TTF_RenderText_Blended, and TTF_RenderText_LCD.
987
+ *
988
+ * \param font the font to render with.
989
+ * \param text text to render, in Latin1 encoding.
990
+ * \param fg the foreground color for the text.
991
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
992
+ *
993
+ * \since This function is available since SDL_ttf 2.0.12.
994
+ *
995
+ * \sa TTF_RenderUTF8_Solid
996
+ * \sa TTF_RenderUNICODE_Solid
997
+ */
998
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid(TTF_Font *font,
999
+ const char *text, SDL_Color fg);
1000
+
1001
+ /**
1002
+ * Render UTF-8 text at fast quality to a new 8-bit surface.
1003
+ *
1004
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1005
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1006
+ * will be set to the text color.
1007
+ *
1008
+ * This will not word-wrap the string; you'll get a surface with a single line
1009
+ * of text, as long as the string requires. You can use
1010
+ * TTF_RenderUTF8_Solid_Wrapped() instead if you need to wrap the output to
1011
+ * multiple lines.
1012
+ *
1013
+ * This will not wrap on newline characters.
1014
+ *
1015
+ * You can render at other quality levels with TTF_RenderUTF8_Shaded,
1016
+ * TTF_RenderUTF8_Blended, and TTF_RenderUTF8_LCD.
1017
+ *
1018
+ * \param font the font to render with.
1019
+ * \param text text to render, in UTF-8 encoding.
1020
+ * \param fg the foreground color for the text.
1021
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1022
+ *
1023
+ * \since This function is available since SDL_ttf 2.0.12.
1024
+ *
1025
+ * \sa TTF_RenderUTF8_Shaded
1026
+ * \sa TTF_RenderUTF8_Blended
1027
+ * \sa TTF_RenderUTF8_LCD
1028
+ */
1029
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid(TTF_Font *font,
1030
+ const char *text, SDL_Color fg);
1031
+
1032
+ /**
1033
+ * Render UCS-2 text at fast quality to a new 8-bit surface.
1034
+ *
1035
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1036
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1037
+ * will be set to the text color.
1038
+ *
1039
+ * This will not word-wrap the string; you'll get a surface with a single line
1040
+ * of text, as long as the string requires. You can use
1041
+ * TTF_RenderUNICODE_Solid_Wrapped() instead if you need to wrap the output to
1042
+ * multiple lines.
1043
+ *
1044
+ * This will not wrap on newline characters.
1045
+ *
1046
+ * Please note that this function is named "Unicode" but currently expects
1047
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1048
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1049
+ * through the UTF-8 version of this function.
1050
+ *
1051
+ * You can render at other quality levels with TTF_RenderUNICODE_Shaded,
1052
+ * TTF_RenderUNICODE_Blended, and TTF_RenderUNICODE_LCD.
1053
+ *
1054
+ * \param font the font to render with.
1055
+ * \param text text to render, in UCS-2 encoding.
1056
+ * \param fg the foreground color for the text.
1057
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1058
+ *
1059
+ * \since This function is available since SDL_ttf 2.0.12.
1060
+ *
1061
+ * \sa TTF_RenderUTF8_Solid
1062
+ */
1063
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Solid(TTF_Font *font,
1064
+ const Uint16 *text, SDL_Color fg);
1065
+
1066
+ /**
1067
+ * Render word-wrapped Latin1 text at fast quality to a new 8-bit surface.
1068
+ *
1069
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1070
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1071
+ * will be set to the text color.
1072
+ *
1073
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1074
+ * it extends beyond `wrapLength` in pixels.
1075
+ *
1076
+ * If wrapLength is 0, this function will only wrap on newline characters.
1077
+ *
1078
+ * You almost certainly want TTF_RenderUTF8_Solid_Wrapped() unless you're sure
1079
+ * you have a 1-byte Latin1 encoding. US ASCII characters will work with
1080
+ * either function, but most other Unicode characters packed into a `const
1081
+ * char *` will need UTF-8.
1082
+ *
1083
+ * You can render at other quality levels with TTF_RenderText_Shaded_Wrapped,
1084
+ * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
1085
+ *
1086
+ * \param font the font to render with.
1087
+ * \param text text to render, in Latin1 encoding.
1088
+ * \param fg the foreground color for the text.
1089
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1090
+ *
1091
+ * \since This function is available since SDL_ttf 2.0.18.
1092
+ *
1093
+ * \sa TTF_RenderUTF8_Solid_Wrapped
1094
+ * \sa TTF_RenderUNICODE_Solid_Wrapped
1095
+ */
1096
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid_Wrapped(TTF_Font *font,
1097
+ const char *text, SDL_Color fg, Uint32 wrapLength);
1098
+
1099
+ /**
1100
+ * Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
1101
+ *
1102
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1103
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1104
+ * will be set to the text color.
1105
+ *
1106
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1107
+ * it extends beyond `wrapLength` in pixels.
1108
+ *
1109
+ * If wrapLength is 0, this function will only wrap on newline characters.
1110
+ *
1111
+ * You can render at other quality levels with TTF_RenderUTF8_Shaded_Wrapped,
1112
+ * TTF_RenderUTF8_Blended_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.
1113
+ *
1114
+ * \param font the font to render with.
1115
+ * \param text text to render, in UTF-8 encoding.
1116
+ * \param fg the foreground color for the text.
1117
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1118
+ *
1119
+ * \since This function is available since SDL_ttf 2.0.18.
1120
+ *
1121
+ * \sa TTF_RenderUTF8_Shaded_Wrapped
1122
+ * \sa TTF_RenderUTF8_Blended_Wrapped
1123
+ * \sa TTF_RenderUTF8_LCD_Wrapped
1124
+ */
1125
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid_Wrapped(TTF_Font *font,
1126
+ const char *text, SDL_Color fg, Uint32 wrapLength);
1127
+
1128
+ /**
1129
+ * Render word-wrapped UCS-2 text at fast quality to a new 8-bit surface.
1130
+ *
1131
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1132
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1133
+ * will be set to the text color.
1134
+ *
1135
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1136
+ * it extends beyond `wrapLength` in pixels.
1137
+ *
1138
+ * If wrapLength is 0, this function will only wrap on newline characters.
1139
+ *
1140
+ * Please note that this function is named "Unicode" but currently expects
1141
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1142
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1143
+ * through the UTF-8 version of this function.
1144
+ *
1145
+ * You can render at other quality levels with
1146
+ * TTF_RenderUNICODE_Shaded_Wrapped, TTF_RenderUNICODE_Blended_Wrapped, and
1147
+ * TTF_RenderUNICODE_LCD_Wrapped.
1148
+ *
1149
+ * \param font the font to render with.
1150
+ * \param text text to render, in UCS-2 encoding.
1151
+ * \param fg the foreground color for the text.
1152
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1153
+ *
1154
+ * \since This function is available since SDL_ttf 2.0.18.
1155
+ *
1156
+ * \sa TTF_RenderUTF8_Solid_Wrapped
1157
+ */
1158
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Solid_Wrapped(TTF_Font *font,
1159
+ const Uint16 *text, SDL_Color fg, Uint32 wrapLength);
1160
+
1161
+ /**
1162
+ * Render a single 16-bit glyph at fast quality to a new 8-bit surface.
1163
+ *
1164
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1165
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1166
+ * will be set to the text color.
1167
+ *
1168
+ * The glyph is rendered without any padding or centering in the X direction,
1169
+ * and aligned normally in the Y direction.
1170
+ *
1171
+ * Note that this version of the function takes a 16-bit character code, which
1172
+ * covers the Basic Multilingual Plane, but is insufficient to cover the
1173
+ * entire set of possible Unicode values, including emoji glyphs. You should
1174
+ * use TTF_RenderGlyph32_Solid() instead, which offers the same functionality
1175
+ * but takes a 32-bit codepoint instead.
1176
+ *
1177
+ * The only reason to use this function is that it was available since the
1178
+ * beginning of time, more or less.
1179
+ *
1180
+ * You can render at other quality levels with TTF_RenderGlyph_Shaded,
1181
+ * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
1182
+ *
1183
+ * \param font the font to render with.
1184
+ * \param ch the character to render.
1185
+ * \param fg the foreground color for the text.
1186
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1187
+ *
1188
+ * \since This function is available since SDL_ttf 2.0.12.
1189
+ *
1190
+ * \sa TTF_RenderGlyph32_Solid
1191
+ */
1192
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font,
1193
+ Uint16 ch, SDL_Color fg);
1194
+
1195
+ /**
1196
+ * Render a single 32-bit glyph at fast quality to a new 8-bit surface.
1197
+ *
1198
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1199
+ * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
1200
+ * will be set to the text color.
1201
+ *
1202
+ * The glyph is rendered without any padding or centering in the X direction,
1203
+ * and aligned normally in the Y direction.
1204
+ *
1205
+ * This is the same as TTF_RenderGlyph_Solid(), but takes a 32-bit character
1206
+ * instead of 16-bit, and thus can render a larger range. If you are sure
1207
+ * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
1208
+ * not to use this function exclusively.
1209
+ *
1210
+ * You can render at other quality levels with TTF_RenderGlyph32_Shaded,
1211
+ * TTF_RenderGlyph32_Blended, and TTF_RenderGlyph32_LCD.
1212
+ *
1213
+ * \param font the font to render with.
1214
+ * \param ch the character to render.
1215
+ * \param fg the foreground color for the text.
1216
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1217
+ *
1218
+ * \since This function is available since SDL_ttf 2.0.18.
1219
+ *
1220
+ * \sa TTF_RenderGlyph32_Shaded
1221
+ * \sa TTF_RenderGlyph32_Blended
1222
+ * \sa TTF_RenderGlyph32_LCD
1223
+ */
1224
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_Solid(TTF_Font *font,
1225
+ Uint32 ch, SDL_Color fg);
1226
+
1227
+ /**
1228
+ * Render Latin1 text at high quality to a new 8-bit surface.
1229
+ *
1230
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1231
+ * 0 pixel will be the specified background color, while other pixels have
1232
+ * varying degrees of the foreground color. This function returns the new
1233
+ * surface, or NULL if there was an error.
1234
+ *
1235
+ * This will not word-wrap the string; you'll get a surface with a single line
1236
+ * of text, as long as the string requires. You can use
1237
+ * TTF_RenderText_Shaded_Wrapped() instead if you need to wrap the output to
1238
+ * multiple lines.
1239
+ *
1240
+ * This will not wrap on newline characters.
1241
+ *
1242
+ * You almost certainly want TTF_RenderUTF8_Shaded() unless you're sure you
1243
+ * have a 1-byte Latin1 encoding. US ASCII characters will work with either
1244
+ * function, but most other Unicode characters packed into a `const char *`
1245
+ * will need UTF-8.
1246
+ *
1247
+ * You can render at other quality levels with TTF_RenderText_Solid,
1248
+ * TTF_RenderText_Blended, and TTF_RenderText_LCD.
1249
+ *
1250
+ * \param font the font to render with.
1251
+ * \param text text to render, in Latin1 encoding.
1252
+ * \param fg the foreground color for the text.
1253
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1254
+ *
1255
+ * \since This function is available since SDL_ttf 2.0.12.
1256
+ *
1257
+ * \sa TTF_RenderUTF8_Shaded
1258
+ * \sa TTF_RenderUNICODE_Shaded
1259
+ */
1260
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font,
1261
+ const char *text, SDL_Color fg, SDL_Color bg);
1262
+
1263
+ /**
1264
+ * Render UTF-8 text at high quality to a new 8-bit surface.
1265
+ *
1266
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1267
+ * 0 pixel will be the specified background color, while other pixels have
1268
+ * varying degrees of the foreground color. This function returns the new
1269
+ * surface, or NULL if there was an error.
1270
+ *
1271
+ * This will not word-wrap the string; you'll get a surface with a single line
1272
+ * of text, as long as the string requires. You can use
1273
+ * TTF_RenderUTF8_Shaded_Wrapped() instead if you need to wrap the output to
1274
+ * multiple lines.
1275
+ *
1276
+ * This will not wrap on newline characters.
1277
+ *
1278
+ * You can render at other quality levels with TTF_RenderUTF8_Solid,
1279
+ * TTF_RenderUTF8_Blended, and TTF_RenderUTF8_LCD.
1280
+ *
1281
+ * \param font the font to render with.
1282
+ * \param text text to render, in UTF-8 encoding.
1283
+ * \param fg the foreground color for the text.
1284
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1285
+ *
1286
+ * \since This function is available since SDL_ttf 2.0.12.
1287
+ *
1288
+ * \sa TTF_RenderUNICODE_Shaded
1289
+ */
1290
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded(TTF_Font *font,
1291
+ const char *text, SDL_Color fg, SDL_Color bg);
1292
+
1293
+ /**
1294
+ * Render UCS-2 text at high quality to a new 8-bit surface.
1295
+ *
1296
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1297
+ * 0 pixel will be the specified background color, while other pixels have
1298
+ * varying degrees of the foreground color. This function returns the new
1299
+ * surface, or NULL if there was an error.
1300
+ *
1301
+ * This will not word-wrap the string; you'll get a surface with a single line
1302
+ * of text, as long as the string requires. You can use
1303
+ * TTF_RenderUNICODE_Shaded_Wrapped() instead if you need to wrap the output
1304
+ * to multiple lines.
1305
+ *
1306
+ * This will not wrap on newline characters.
1307
+ *
1308
+ * Please note that this function is named "Unicode" but currently expects
1309
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1310
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1311
+ * through the UTF-8 version of this function.
1312
+ *
1313
+ * You can render at other quality levels with TTF_RenderUNICODE_Solid,
1314
+ * TTF_RenderUNICODE_Blended, and TTF_RenderUNICODE_LCD.
1315
+ *
1316
+ * \param font the font to render with.
1317
+ * \param text text to render, in UCS-2 encoding.
1318
+ * \param fg the foreground color for the text.
1319
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1320
+ *
1321
+ * \since This function is available since SDL_ttf 2.0.12.
1322
+ *
1323
+ * \sa TTF_RenderUTF8_Shaded
1324
+ */
1325
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Shaded(TTF_Font *font,
1326
+ const Uint16 *text, SDL_Color fg, SDL_Color bg);
1327
+
1328
+ /**
1329
+ * Render word-wrapped Latin1 text at high quality to a new 8-bit surface.
1330
+ *
1331
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1332
+ * 0 pixel will be the specified background color, while other pixels have
1333
+ * varying degrees of the foreground color. This function returns the new
1334
+ * surface, or NULL if there was an error.
1335
+ *
1336
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1337
+ * it extends beyond `wrapLength` in pixels.
1338
+ *
1339
+ * If wrapLength is 0, this function will only wrap on newline characters.
1340
+ *
1341
+ * You almost certainly want TTF_RenderUTF8_Shaded_Wrapped() unless you're
1342
+ * sure you have a 1-byte Latin1 encoding. US ASCII characters will work with
1343
+ * either function, but most other Unicode characters packed into a `const
1344
+ * char *` will need UTF-8.
1345
+ *
1346
+ * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1347
+ * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
1348
+ *
1349
+ * \param font the font to render with.
1350
+ * \param text text to render, in Latin1 encoding.
1351
+ * \param fg the foreground color for the text.
1352
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1353
+ *
1354
+ * \since This function is available since SDL_ttf 2.0.18.
1355
+ *
1356
+ * \sa TTF_RenderUTF8_Shaded_Wrapped
1357
+ * \sa TTF_RenderUNICODE_Shaded_Wrapped
1358
+ */
1359
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded_Wrapped(TTF_Font *font,
1360
+ const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1361
+
1362
+ /**
1363
+ * Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.
1364
+ *
1365
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1366
+ * 0 pixel will be the specified background color, while other pixels have
1367
+ * varying degrees of the foreground color. This function returns the new
1368
+ * surface, or NULL if there was an error.
1369
+ *
1370
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1371
+ * it extends beyond `wrapLength` in pixels.
1372
+ *
1373
+ * If wrapLength is 0, this function will only wrap on newline characters.
1374
+ *
1375
+ * You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped,
1376
+ * TTF_RenderUTF8_Blended_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.
1377
+ *
1378
+ * \param font the font to render with.
1379
+ * \param text text to render, in UTF-8 encoding.
1380
+ * \param fg the foreground color for the text.
1381
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1382
+ *
1383
+ * \since This function is available since SDL_ttf 2.0.18.
1384
+ *
1385
+ * \sa TTF_RenderUTF8_Solid_Wrapped
1386
+ * \sa TTF_RenderUTF8_Blended_Wrapped
1387
+ * \sa TTF_RenderUTF8_LCD_Wrapped
1388
+ */
1389
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded_Wrapped(TTF_Font *font,
1390
+ const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1391
+
1392
+ /**
1393
+ * Render word-wrapped UCS-2 text at high quality to a new 8-bit surface.
1394
+ *
1395
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1396
+ * 0 pixel will be the specified background color, while other pixels have
1397
+ * varying degrees of the foreground color. This function returns the new
1398
+ * surface, or NULL if there was an error.
1399
+ *
1400
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1401
+ * it extends beyond `wrapLength` in pixels.
1402
+ *
1403
+ * If wrapLength is 0, this function will only wrap on newline characters.
1404
+ *
1405
+ * Please note that this function is named "Unicode" but currently expects
1406
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1407
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1408
+ * through the UTF-8 version of this function.
1409
+ *
1410
+ * You can render at other quality levels with
1411
+ * TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Blended_Wrapped, and
1412
+ * TTF_RenderUNICODE_LCD_Wrapped.
1413
+ *
1414
+ * \param font the font to render with.
1415
+ * \param text text to render, in UCS-2 encoding.
1416
+ * \param fg the foreground color for the text.
1417
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1418
+ *
1419
+ * \since This function is available since SDL_ttf 2.0.18.
1420
+ *
1421
+ * \sa TTF_RenderUTF8_Shaded_Wrapped
1422
+ */
1423
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Shaded_Wrapped(TTF_Font *font,
1424
+ const Uint16 *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1425
+
1426
+ /**
1427
+ * Render a single 16-bit glyph at high quality to a new 8-bit surface.
1428
+ *
1429
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1430
+ * 0 pixel will be the specified background color, while other pixels have
1431
+ * varying degrees of the foreground color. This function returns the new
1432
+ * surface, or NULL if there was an error.
1433
+ *
1434
+ * The glyph is rendered without any padding or centering in the X direction,
1435
+ * and aligned normally in the Y direction.
1436
+ *
1437
+ * Note that this version of the function takes a 16-bit character code, which
1438
+ * covers the Basic Multilingual Plane, but is insufficient to cover the
1439
+ * entire set of possible Unicode values, including emoji glyphs. You should
1440
+ * use TTF_RenderGlyph32_Shaded() instead, which offers the same functionality
1441
+ * but takes a 32-bit codepoint instead.
1442
+ *
1443
+ * The only reason to use this function is that it was available since the
1444
+ * beginning of time, more or less.
1445
+ *
1446
+ * You can render at other quality levels with TTF_RenderGlyph_Solid,
1447
+ * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
1448
+ *
1449
+ * \param font the font to render with.
1450
+ * \param ch the character to render.
1451
+ * \param fg the foreground color for the text.
1452
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1453
+ *
1454
+ * \since This function is available since SDL_ttf 2.0.12.
1455
+ *
1456
+ * \sa TTF_RenderGlyph32_Shaded
1457
+ */
1458
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font,
1459
+ Uint16 ch, SDL_Color fg, SDL_Color bg);
1460
+
1461
+ /**
1462
+ * Render a single 32-bit glyph at high quality to a new 8-bit surface.
1463
+ *
1464
+ * This function will allocate a new 8-bit, palettized surface. The surface's
1465
+ * 0 pixel will be the specified background color, while other pixels have
1466
+ * varying degrees of the foreground color. This function returns the new
1467
+ * surface, or NULL if there was an error.
1468
+ *
1469
+ * The glyph is rendered without any padding or centering in the X direction,
1470
+ * and aligned normally in the Y direction.
1471
+ *
1472
+ * This is the same as TTF_RenderGlyph_Shaded(), but takes a 32-bit character
1473
+ * instead of 16-bit, and thus can render a larger range. If you are sure
1474
+ * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
1475
+ * not to use this function exclusively.
1476
+ *
1477
+ * You can render at other quality levels with TTF_RenderGlyph32_Solid,
1478
+ * TTF_RenderGlyph32_Blended, and TTF_RenderGlyph32_LCD.
1479
+ *
1480
+ * \param font the font to render with.
1481
+ * \param ch the character to render.
1482
+ * \param fg the foreground color for the text.
1483
+ * \returns a new 8-bit, palettized surface, or NULL if there was an error.
1484
+ *
1485
+ * \since This function is available since SDL_ttf 2.0.18.
1486
+ *
1487
+ * \sa TTF_RenderGlyph32_Solid
1488
+ * \sa TTF_RenderGlyph32_Blended
1489
+ * \sa TTF_RenderGlyph32_LCD
1490
+ */
1491
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_Shaded(TTF_Font *font,
1492
+ Uint32 ch, SDL_Color fg, SDL_Color bg);
1493
+
1494
+ /**
1495
+ * Render Latin1 text at high quality to a new ARGB surface.
1496
+ *
1497
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1498
+ * blending to dither the font with the given color. This function returns the
1499
+ * new surface, or NULL if there was an error.
1500
+ *
1501
+ * This will not word-wrap the string; you'll get a surface with a single line
1502
+ * of text, as long as the string requires. You can use
1503
+ * TTF_RenderText_Blended_Wrapped() instead if you need to wrap the output to
1504
+ * multiple lines.
1505
+ *
1506
+ * This will not wrap on newline characters.
1507
+ *
1508
+ * You almost certainly want TTF_RenderUTF8_Blended() unless you're sure you
1509
+ * have a 1-byte Latin1 encoding. US ASCII characters will work with either
1510
+ * function, but most other Unicode characters packed into a `const char *`
1511
+ * will need UTF-8.
1512
+ *
1513
+ * You can render at other quality levels with TTF_RenderText_Solid,
1514
+ * TTF_RenderText_Blended, and TTF_RenderText_LCD.
1515
+ *
1516
+ * \param font the font to render with.
1517
+ * \param text text to render, in Latin1 encoding.
1518
+ * \param fg the foreground color for the text.
1519
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1520
+ *
1521
+ * \since This function is available since SDL_ttf 2.0.12.
1522
+ *
1523
+ * \sa TTF_RenderUTF8_Shaded
1524
+ * \sa TTF_RenderUNICODE_Shaded
1525
+ */
1526
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font,
1527
+ const char *text, SDL_Color fg);
1528
+
1529
+ /**
1530
+ * Render UTF-8 text at high quality to a new ARGB surface.
1531
+ *
1532
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1533
+ * blending to dither the font with the given color. This function returns the
1534
+ * new surface, or NULL if there was an error.
1535
+ *
1536
+ * This will not word-wrap the string; you'll get a surface with a single line
1537
+ * of text, as long as the string requires. You can use
1538
+ * TTF_RenderUTF8_Blended_Wrapped() instead if you need to wrap the output to
1539
+ * multiple lines.
1540
+ *
1541
+ * This will not wrap on newline characters.
1542
+ *
1543
+ * You can render at other quality levels with TTF_RenderUTF8_Solid,
1544
+ * TTF_RenderUTF8_Shaded, and TTF_RenderUTF8_LCD.
1545
+ *
1546
+ * \param font the font to render with.
1547
+ * \param text text to render, in UTF-8 encoding.
1548
+ * \param fg the foreground color for the text.
1549
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1550
+ *
1551
+ * \since This function is available since SDL_ttf 2.0.12.
1552
+ *
1553
+ * \sa TTF_RenderUNICODE_Blended
1554
+ */
1555
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended(TTF_Font *font,
1556
+ const char *text, SDL_Color fg);
1557
+
1558
+ /**
1559
+ * Render UCS-2 text at high quality to a new ARGB surface.
1560
+ *
1561
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1562
+ * blending to dither the font with the given color. This function returns the
1563
+ * new surface, or NULL if there was an error.
1564
+ *
1565
+ * This will not word-wrap the string; you'll get a surface with a single line
1566
+ * of text, as long as the string requires. You can use
1567
+ * TTF_RenderUNICODE_Blended_Wrapped() instead if you need to wrap the output
1568
+ * to multiple lines.
1569
+ *
1570
+ * This will not wrap on newline characters.
1571
+ *
1572
+ * Please note that this function is named "Unicode" but currently expects
1573
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1574
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1575
+ * through the UTF-8 version of this function.
1576
+ *
1577
+ * You can render at other quality levels with TTF_RenderUNICODE_Solid,
1578
+ * TTF_RenderUNICODE_Shaded, and TTF_RenderUNICODE_LCD.
1579
+ *
1580
+ * \param font the font to render with.
1581
+ * \param text text to render, in UCS-2 encoding.
1582
+ * \param fg the foreground color for the text.
1583
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1584
+ *
1585
+ * \since This function is available since SDL_ttf 2.0.12.
1586
+ *
1587
+ * \sa TTF_RenderUTF8_Blended
1588
+ */
1589
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended(TTF_Font *font,
1590
+ const Uint16 *text, SDL_Color fg);
1591
+
1592
+ /**
1593
+ * Render word-wrapped Latin1 text at high quality to a new ARGB surface.
1594
+ *
1595
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1596
+ * blending to dither the font with the given color. This function returns the
1597
+ * new surface, or NULL if there was an error.
1598
+ *
1599
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1600
+ * it extends beyond `wrapLength` in pixels.
1601
+ *
1602
+ * If wrapLength is 0, this function will only wrap on newline characters.
1603
+ *
1604
+ * You almost certainly want TTF_RenderUTF8_Blended_Wrapped() unless you're
1605
+ * sure you have a 1-byte Latin1 encoding. US ASCII characters will work with
1606
+ * either function, but most other Unicode characters packed into a `const
1607
+ * char *` will need UTF-8.
1608
+ *
1609
+ * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1610
+ * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_LCD_Wrapped.
1611
+ *
1612
+ * \param font the font to render with.
1613
+ * \param text text to render, in Latin1 encoding.
1614
+ * \param fg the foreground color for the text.
1615
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1616
+ *
1617
+ * \since This function is available since SDL_ttf 2.0.18.
1618
+ *
1619
+ * \sa TTF_RenderUTF8_Blended_Wrapped
1620
+ * \sa TTF_RenderUNICODE_Blended_Wrapped
1621
+ */
1622
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended_Wrapped(TTF_Font *font,
1623
+ const char *text, SDL_Color fg, Uint32 wrapLength);
1624
+
1625
+ /**
1626
+ * Render word-wrapped UTF-8 text at high quality to a new ARGB surface.
1627
+ *
1628
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1629
+ * blending to dither the font with the given color. This function returns the
1630
+ * new surface, or NULL if there was an error.
1631
+ *
1632
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1633
+ * it extends beyond `wrapLength` in pixels.
1634
+ *
1635
+ * If wrapLength is 0, this function will only wrap on newline characters.
1636
+ *
1637
+ * You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped,
1638
+ * TTF_RenderUTF8_Shaded_Wrapped, and TTF_RenderUTF8_LCD_Wrapped.
1639
+ *
1640
+ * \param font the font to render with.
1641
+ * \param text text to render, in UTF-8 encoding.
1642
+ * \param fg the foreground color for the text.
1643
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1644
+ *
1645
+ * \since This function is available since SDL_ttf 2.0.18.
1646
+ *
1647
+ * \sa TTF_RenderUTF8_Solid_Wrapped
1648
+ * \sa TTF_RenderUTF8_Shaded_Wrapped
1649
+ * \sa TTF_RenderUTF8_LCD_Wrapped
1650
+ */
1651
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended_Wrapped(TTF_Font *font,
1652
+ const char *text, SDL_Color fg, Uint32 wrapLength);
1653
+
1654
+ /**
1655
+ * Render word-wrapped UCS-2 text at high quality to a new ARGB surface.
1656
+ *
1657
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1658
+ * blending to dither the font with the given color. This function returns the
1659
+ * new surface, or NULL if there was an error.
1660
+ *
1661
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1662
+ * it extends beyond `wrapLength` in pixels.
1663
+ *
1664
+ * If wrapLength is 0, this function will only wrap on newline characters.
1665
+ *
1666
+ * Please note that this function is named "Unicode" but currently expects
1667
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1668
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1669
+ * through the UTF-8 version of this function.
1670
+ *
1671
+ * You can render at other quality levels with
1672
+ * TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Shaded_Wrapped, and
1673
+ * TTF_RenderUNICODE_LCD_Wrapped.
1674
+ *
1675
+ * \param font the font to render with.
1676
+ * \param text text to render, in UCS-2 encoding.
1677
+ * \param fg the foreground color for the text.
1678
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1679
+ *
1680
+ * \since This function is available since SDL_ttf 2.0.18.
1681
+ *
1682
+ * \sa TTF_RenderUTF8_Blended_Wrapped
1683
+ */
1684
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended_Wrapped(TTF_Font *font,
1685
+ const Uint16 *text, SDL_Color fg, Uint32 wrapLength);
1686
+
1687
+ /**
1688
+ * Render a single 16-bit glyph at high quality to a new ARGB surface.
1689
+ *
1690
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1691
+ * blending to dither the font with the given color. This function returns the
1692
+ * new surface, or NULL if there was an error.
1693
+ *
1694
+ * The glyph is rendered without any padding or centering in the X direction,
1695
+ * and aligned normally in the Y direction.
1696
+ *
1697
+ * Note that this version of the function takes a 16-bit character code, which
1698
+ * covers the Basic Multilingual Plane, but is insufficient to cover the
1699
+ * entire set of possible Unicode values, including emoji glyphs. You should
1700
+ * use TTF_RenderGlyph32_Blended() instead, which offers the same
1701
+ * functionality but takes a 32-bit codepoint instead.
1702
+ *
1703
+ * The only reason to use this function is that it was available since the
1704
+ * beginning of time, more or less.
1705
+ *
1706
+ * You can render at other quality levels with TTF_RenderGlyph_Solid,
1707
+ * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_LCD.
1708
+ *
1709
+ * \param font the font to render with.
1710
+ * \param ch the character to render.
1711
+ * \param fg the foreground color for the text.
1712
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1713
+ *
1714
+ * \since This function is available since SDL_ttf 2.0.12.
1715
+ *
1716
+ * \sa TTF_RenderGlyph32_Blended
1717
+ */
1718
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font,
1719
+ Uint16 ch, SDL_Color fg);
1720
+
1721
+ /**
1722
+ * Render a single 32-bit glyph at high quality to a new ARGB surface.
1723
+ *
1724
+ * This function will allocate a new 32-bit, ARGB surface, using alpha
1725
+ * blending to dither the font with the given color. This function returns the
1726
+ * new surface, or NULL if there was an error.
1727
+ *
1728
+ * The glyph is rendered without any padding or centering in the X direction,
1729
+ * and aligned normally in the Y direction.
1730
+ *
1731
+ * This is the same as TTF_RenderGlyph_Blended(), but takes a 32-bit character
1732
+ * instead of 16-bit, and thus can render a larger range. If you are sure
1733
+ * you'll have an SDL_ttf that's version 2.0.18 or newer, there's no reason
1734
+ * not to use this function exclusively.
1735
+ *
1736
+ * You can render at other quality levels with TTF_RenderGlyph32_Solid,
1737
+ * TTF_RenderGlyph32_Shaded, and TTF_RenderGlyph32_LCD.
1738
+ *
1739
+ * \param font the font to render with.
1740
+ * \param ch the character to render.
1741
+ * \param fg the foreground color for the text.
1742
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1743
+ *
1744
+ * \since This function is available since SDL_ttf 2.0.18.
1745
+ *
1746
+ * \sa TTF_RenderGlyph32_Solid
1747
+ * \sa TTF_RenderGlyph32_Shaded
1748
+ * \sa TTF_RenderGlyph32_LCD
1749
+ */
1750
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_Blended(TTF_Font *font,
1751
+ Uint32 ch, SDL_Color fg);
1752
+
1753
+ /**
1754
+ * Render Latin1 text at LCD subpixel quality to a new ARGB surface.
1755
+ *
1756
+ * This function will allocate a new 32-bit, ARGB surface, and render
1757
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1758
+ * returns the new surface, or NULL if there was an error.
1759
+ *
1760
+ * This will not word-wrap the string; you'll get a surface with a single line
1761
+ * of text, as long as the string requires. You can use
1762
+ * TTF_RenderText_LCD_Wrapped() instead if you need to wrap the output to
1763
+ * multiple lines.
1764
+ *
1765
+ * This will not wrap on newline characters.
1766
+ *
1767
+ * You almost certainly want TTF_RenderUTF8_LCD() unless you're sure you have
1768
+ * a 1-byte Latin1 encoding. US ASCII characters will work with either
1769
+ * function, but most other Unicode characters packed into a `const char *`
1770
+ * will need UTF-8.
1771
+ *
1772
+ * You can render at other quality levels with TTF_RenderText_Solid,
1773
+ * TTF_RenderText_Shaded, and TTF_RenderText_Blended.
1774
+ *
1775
+ * \param font the font to render with.
1776
+ * \param text text to render, in Latin1 encoding.
1777
+ * \param fg the foreground color for the text.
1778
+ * \param bg the background color for the text.
1779
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1780
+ *
1781
+ * \since This function is available since SDL_ttf 2.20.0.
1782
+ *
1783
+ * \sa TTF_RenderUTF8_LCD
1784
+ * \sa TTF_RenderUNICODE_LCD
1785
+ */
1786
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD(TTF_Font *font,
1787
+ const char *text, SDL_Color fg, SDL_Color bg);
1788
+
1789
+ /**
1790
+ * Render UTF-8 text at LCD subpixel quality to a new ARGB surface.
1791
+ *
1792
+ * This function will allocate a new 32-bit, ARGB surface, and render
1793
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1794
+ * returns the new surface, or NULL if there was an error.
1795
+ *
1796
+ * This will not word-wrap the string; you'll get a surface with a single line
1797
+ * of text, as long as the string requires. You can use
1798
+ * TTF_RenderUTF8_LCD_Wrapped() instead if you need to wrap the output to
1799
+ * multiple lines.
1800
+ *
1801
+ * This will not wrap on newline characters.
1802
+ *
1803
+ * You can render at other quality levels with TTF_RenderUTF8_Solid,
1804
+ * TTF_RenderUTF8_Shaded, and TTF_RenderUTF8_Blended.
1805
+ *
1806
+ * \param font the font to render with.
1807
+ * \param text text to render, in UTF-8 encoding.
1808
+ * \param fg the foreground color for the text.
1809
+ * \param bg the background color for the text.
1810
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1811
+ *
1812
+ * \since This function is available since SDL_ttf 2.20.0.
1813
+ *
1814
+ * \sa TTF_RenderUNICODE_LCD
1815
+ */
1816
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_LCD(TTF_Font *font,
1817
+ const char *text, SDL_Color fg, SDL_Color bg);
1818
+
1819
+ /**
1820
+ * Render UCS-2 text at LCD subpixel quality to a new ARGB surface.
1821
+ *
1822
+ * This function will allocate a new 32-bit, ARGB surface, and render
1823
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1824
+ * returns the new surface, or NULL if there was an error.
1825
+ *
1826
+ * This will not word-wrap the string; you'll get a surface with a single line
1827
+ * of text, as long as the string requires. You can use
1828
+ * TTF_RenderUNICODE_LCD_Wrapped() instead if you need to wrap the output to
1829
+ * multiple lines.
1830
+ *
1831
+ * This will not wrap on newline characters.
1832
+ *
1833
+ * Please note that this function is named "Unicode" but currently expects
1834
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1835
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1836
+ * through the UTF-8 version of this function.
1837
+ *
1838
+ * You can render at other quality levels with TTF_RenderUNICODE_Solid,
1839
+ * TTF_RenderUNICODE_Shaded, and TTF_RenderUNICODE_Blended.
1840
+ *
1841
+ * \param font the font to render with.
1842
+ * \param text text to render, in UCS-2 encoding.
1843
+ * \param fg the foreground color for the text.
1844
+ * \param bg the background color for the text.
1845
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1846
+ *
1847
+ * \since This function is available since SDL_ttf 2.20.0.
1848
+ *
1849
+ * \sa TTF_RenderUTF8_LCD
1850
+ */
1851
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_LCD(TTF_Font *font,
1852
+ const Uint16 *text, SDL_Color fg, SDL_Color bg);
1853
+
1854
+ /**
1855
+ * Render word-wrapped Latin1 text at LCD subpixel quality to a new ARGB
1856
+ * surface.
1857
+ *
1858
+ * This function will allocate a new 32-bit, ARGB surface, and render
1859
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1860
+ * returns the new surface, or NULL if there was an error.
1861
+ *
1862
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1863
+ * it extends beyond `wrapLength` in pixels.
1864
+ *
1865
+ * If wrapLength is 0, this function will only wrap on newline characters.
1866
+ *
1867
+ * You almost certainly want TTF_RenderUTF8_LCD_Wrapped() unless you're sure
1868
+ * you have a 1-byte Latin1 encoding. US ASCII characters will work with
1869
+ * either function, but most other Unicode characters packed into a `const
1870
+ * char *` will need UTF-8.
1871
+ *
1872
+ * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
1873
+ * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_Blended_Wrapped.
1874
+ *
1875
+ * \param font the font to render with.
1876
+ * \param text text to render, in Latin1 encoding.
1877
+ * \param fg the foreground color for the text.
1878
+ * \param bg the background color for the text.
1879
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1880
+ *
1881
+ * \since This function is available since SDL_ttf 2.20.0.
1882
+ *
1883
+ * \sa TTF_RenderUTF8_LCD_Wrapped
1884
+ * \sa TTF_RenderUNICODE_LCD_Wrapped
1885
+ */
1886
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD_Wrapped(TTF_Font *font,
1887
+ const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1888
+
1889
+ /**
1890
+ * Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB
1891
+ * surface.
1892
+ *
1893
+ * This function will allocate a new 32-bit, ARGB surface, and render
1894
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1895
+ * returns the new surface, or NULL if there was an error.
1896
+ *
1897
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1898
+ * it extends beyond `wrapLength` in pixels.
1899
+ *
1900
+ * If wrapLength is 0, this function will only wrap on newline characters.
1901
+ *
1902
+ * You can render at other quality levels with TTF_RenderUTF8_Solid_Wrapped,
1903
+ * TTF_RenderUTF8_Shaded_Wrapped, and TTF_RenderUTF8_Blended_Wrapped.
1904
+ *
1905
+ * \param font the font to render with.
1906
+ * \param text text to render, in UTF-8 encoding.
1907
+ * \param fg the foreground color for the text.
1908
+ * \param bg the background color for the text.
1909
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1910
+ *
1911
+ * \since This function is available since SDL_ttf 2.20.0.
1912
+ *
1913
+ * \sa TTF_RenderUTF8_Solid_Wrapped
1914
+ * \sa TTF_RenderUTF8_Shaded_Wrapped
1915
+ * \sa TTF_RenderUTF8_Blended_Wrapped
1916
+ */
1917
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_LCD_Wrapped(TTF_Font *font,
1918
+ const char *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1919
+
1920
+ /**
1921
+ * Render word-wrapped UCS-2 text at LCD subpixel quality to a new ARGB
1922
+ * surface.
1923
+ *
1924
+ * This function will allocate a new 32-bit, ARGB surface, and render
1925
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1926
+ * returns the new surface, or NULL if there was an error.
1927
+ *
1928
+ * Text is wrapped to multiple lines on line endings and on word boundaries if
1929
+ * it extends beyond `wrapLength` in pixels.
1930
+ *
1931
+ * If wrapLength is 0, this function will only wrap on newline characters.
1932
+ *
1933
+ * Please note that this function is named "Unicode" but currently expects
1934
+ * UCS-2 encoding (16 bits per codepoint). This does not give you access to
1935
+ * large Unicode values, such as emoji glyphs. These codepoints are accessible
1936
+ * through the UTF-8 version of this function.
1937
+ *
1938
+ * You can render at other quality levels with
1939
+ * TTF_RenderUNICODE_Solid_Wrapped, TTF_RenderUNICODE_Shaded_Wrapped, and
1940
+ * TTF_RenderUNICODE_Blended_Wrapped.
1941
+ *
1942
+ * \param font the font to render with.
1943
+ * \param text text to render, in UCS-2 encoding.
1944
+ * \param fg the foreground color for the text.
1945
+ * \param bg the background color for the text.
1946
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1947
+ *
1948
+ * \since This function is available since SDL_ttf 2.20.0.
1949
+ *
1950
+ * \sa TTF_RenderUTF8_LCD_Wrapped
1951
+ */
1952
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_LCD_Wrapped(TTF_Font *font,
1953
+ const Uint16 *text, SDL_Color fg, SDL_Color bg, Uint32 wrapLength);
1954
+
1955
+ /**
1956
+ * Render a single 16-bit glyph at LCD subpixel quality to a new ARGB surface.
1957
+ *
1958
+ * This function will allocate a new 32-bit, ARGB surface, and render
1959
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1960
+ * returns the new surface, or NULL if there was an error.
1961
+ *
1962
+ * The glyph is rendered without any padding or centering in the X direction,
1963
+ * and aligned normally in the Y direction.
1964
+ *
1965
+ * Note that this version of the function takes a 16-bit character code, which
1966
+ * covers the Basic Multilingual Plane, but is insufficient to cover the
1967
+ * entire set of possible Unicode values, including emoji glyphs. You should
1968
+ * use TTF_RenderGlyph32_LCD() instead, which offers the same functionality
1969
+ * but takes a 32-bit codepoint instead.
1970
+ *
1971
+ * This function only exists for consistency with the existing API at the time
1972
+ * of its addition.
1973
+ *
1974
+ * You can render at other quality levels with TTF_RenderGlyph_Solid,
1975
+ * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_Blended.
1976
+ *
1977
+ * \param font the font to render with.
1978
+ * \param ch the character to render.
1979
+ * \param fg the foreground color for the text.
1980
+ * \param bg the background color for the text.
1981
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
1982
+ *
1983
+ * \since This function is available since SDL_ttf 2.20.0.
1984
+ *
1985
+ * \sa TTF_RenderGlyph32_LCD
1986
+ */
1987
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_LCD(TTF_Font *font,
1988
+ Uint16 ch, SDL_Color fg, SDL_Color bg);
1989
+
1990
+ /**
1991
+ * Render a single 32-bit glyph at LCD subpixel quality to a new ARGB surface.
1992
+ *
1993
+ * This function will allocate a new 32-bit, ARGB surface, and render
1994
+ * alpha-blended text using FreeType's LCD subpixel rendering. This function
1995
+ * returns the new surface, or NULL if there was an error.
1996
+ *
1997
+ * The glyph is rendered without any padding or centering in the X direction,
1998
+ * and aligned normally in the Y direction.
1999
+ *
2000
+ * This is the same as TTF_RenderGlyph_LCD(), but takes a 32-bit character
2001
+ * instead of 16-bit, and thus can render a larger range. Between the two, you
2002
+ * should always use this function.
2003
+ *
2004
+ * You can render at other quality levels with TTF_RenderGlyph32_Solid,
2005
+ * TTF_RenderGlyph32_Shaded, and TTF_RenderGlyph32_Blended.
2006
+ *
2007
+ * \param font the font to render with.
2008
+ * \param ch the character to render.
2009
+ * \param fg the foreground color for the text.
2010
+ * \param bg the background color for the text.
2011
+ * \returns a new 32-bit, ARGB surface, or NULL if there was an error.
2012
+ *
2013
+ * \since This function is available since SDL_ttf 2.20.0.
2014
+ *
2015
+ * \sa TTF_RenderGlyph32_Solid
2016
+ * \sa TTF_RenderGlyph32_Shaded
2017
+ * \sa TTF_RenderGlyph32_Blended
2018
+ */
2019
+ extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph32_LCD(TTF_Font *font,
2020
+ Uint32 ch, SDL_Color fg, SDL_Color bg);
2021
+
2022
+
2023
+ /* For compatibility with previous versions, here are the old functions */
2024
+ #define TTF_RenderText(font, text, fg, bg) \
2025
+ TTF_RenderText_Shaded(font, text, fg, bg)
2026
+ #define TTF_RenderUTF8(font, text, fg, bg) \
2027
+ TTF_RenderUTF8_Shaded(font, text, fg, bg)
2028
+ #define TTF_RenderUNICODE(font, text, fg, bg) \
2029
+ TTF_RenderUNICODE_Shaded(font, text, fg, bg)
2030
+
2031
+ /**
2032
+ * Dispose of a previously-created font.
2033
+ *
2034
+ * Call this when done with a font. This function will free any resources
2035
+ * associated with it.
2036
+ *
2037
+ * The font is not valid after being passed to this function. String pointers
2038
+ * from functions that return information on this font, such as
2039
+ * TTF_FontFaceFamilyName() and TTF_FontFaceStyleName(), are no longer valid
2040
+ * after this call, as well.
2041
+ *
2042
+ * \param font the font to dispose of.
2043
+ *
2044
+ * \since This function is available since SDL_ttf 2.0.12.
2045
+ *
2046
+ * \sa TTF_OpenFontIndexDPIRW
2047
+ * \sa TTF_OpenFontRW
2048
+ * \sa TTF_OpenFontDPI
2049
+ * \sa TTF_OpenFontDPIRW
2050
+ * \sa TTF_OpenFontIndex
2051
+ * \sa TTF_OpenFontIndexDPI
2052
+ * \sa TTF_OpenFontIndexDPIRW
2053
+ * \sa TTF_OpenFontIndexRW
2054
+ */
2055
+ extern DECLSPEC void SDLCALL TTF_CloseFont(TTF_Font *font);
2056
+
2057
+ /**
2058
+ * Deinitialize SDL_ttf.
2059
+ *
2060
+ * You must call this when done with the library, to free internal resources.
2061
+ * It is safe to call this when the library isn't initialized, as it will just
2062
+ * return immediately.
2063
+ *
2064
+ * Once you have as many quit calls as you have had successful calls to
2065
+ * TTF_Init, the library will actually deinitialize.
2066
+ *
2067
+ * Please note that this does not automatically close any fonts that are still
2068
+ * open at the time of deinitialization, and it is possibly not safe to close
2069
+ * them afterwards, as parts of the library will no longer be initialized to
2070
+ * deal with it. A well-written program should call TTF_CloseFont() on any
2071
+ * open fonts before calling this function!
2072
+ *
2073
+ * \since This function is available since SDL_ttf 2.0.12.
2074
+ */
2075
+ extern DECLSPEC void SDLCALL TTF_Quit(void);
2076
+
2077
+ /**
2078
+ * Check if SDL_ttf is initialized.
2079
+ *
2080
+ * This reports the number of times the library has been initialized by a call
2081
+ * to TTF_Init(), without a paired deinitialization request from TTF_Quit().
2082
+ *
2083
+ * In short: if it's greater than zero, the library is currently initialized
2084
+ * and ready to work. If zero, it is not initialized.
2085
+ *
2086
+ * Despite the return value being a signed integer, this function should not
2087
+ * return a negative number.
2088
+ *
2089
+ * \returns the current number of initialization calls, that need to
2090
+ * eventually be paired with this many calls to TTF_Quit().
2091
+ *
2092
+ * \since This function is available since SDL_ttf 2.0.12.
2093
+ *
2094
+ * \sa TTF_Init
2095
+ * \sa TTF_Quit
2096
+ */
2097
+ extern DECLSPEC int SDLCALL TTF_WasInit(void);
2098
+
2099
+ /**
2100
+ * Query the kerning size of two glyphs indices.
2101
+ *
2102
+ * \deprecated This function accidentally requires FreeType font indexes,
2103
+ * not codepoints, which we don't expose through this API, so
2104
+ * it could give wildly incorrect results, especially with
2105
+ * non-ASCII values. Going forward, please use
2106
+ * TTF_GetFontKerningSizeGlyphs() instead, which does what you
2107
+ * probably expected this function to do.
2108
+ *
2109
+ * \param font the font to query.
2110
+ * \param prev_index the font index, NOT codepoint, of the previous character.
2111
+ * \param index the font index, NOT codepoint, of the current character.
2112
+ * \returns The kerning size between the two specified characters, in pixels, or -1 on error.
2113
+ *
2114
+ * \since This function is available since SDL_ttf 2.0.12.
2115
+ *
2116
+ * \sa TTF_GetFontKerningSizeGlyphs
2117
+ */
2118
+ extern SDL_DEPRECATED DECLSPEC int TTF_GetFontKerningSize(TTF_Font *font, int prev_index, int index);
2119
+
2120
+ /**
2121
+ * Query the kerning size of two 16-bit glyphs.
2122
+ *
2123
+ * Note that this version of the function takes 16-bit character
2124
+ * codes, which covers the Basic Multilingual Plane, but is insufficient
2125
+ * to cover the entire set of possible Unicode values, including emoji
2126
+ * glyphs. You should use TTF_GetFontKerningSizeGlyphs32() instead, which
2127
+ * offers the same functionality but takes a 32-bit codepoints instead.
2128
+ *
2129
+ * The only reason to use this function is that it was available since
2130
+ * the beginning of time, more or less.
2131
+ *
2132
+ * \param font the font to query.
2133
+ * \param previous_ch the previous character's code, 16 bits.
2134
+ * \param ch the current character's code, 16 bits.
2135
+ * \returns The kerning size between the two specified characters, in pixels, or -1 on error.
2136
+ *
2137
+ * \since This function is available since SDL_ttf 2.0.14.
2138
+ *
2139
+ * \sa TTF_GetFontKerningSizeGlyphs32
2140
+ */
2141
+ extern DECLSPEC int TTF_GetFontKerningSizeGlyphs(TTF_Font *font, Uint16 previous_ch, Uint16 ch);
2142
+
2143
+ /**
2144
+ * Query the kerning size of two 32-bit glyphs.
2145
+ *
2146
+ * This is the same as TTF_GetFontKerningSizeGlyphs(), but takes 32-bit
2147
+ * characters instead of 16-bit, and thus can manage a larger range. If
2148
+ * you are sure you'll have an SDL_ttf that's version 2.0.18 or newer,
2149
+ * there's no reason not to use this function exclusively.
2150
+ *
2151
+ * \param font the font to query.
2152
+ * \param previous_ch the previous character's code, 32 bits.
2153
+ * \param ch the current character's code, 32 bits.
2154
+ * \returns The kerning size between the two specified characters, in pixels, or -1 on error.
2155
+ *
2156
+ * \since This function is available since SDL_ttf 2.0.18.
2157
+ */
2158
+ extern DECLSPEC int TTF_GetFontKerningSizeGlyphs32(TTF_Font *font, Uint32 previous_ch, Uint32 ch);
2159
+
2160
+ /**
2161
+ * Enable Signed Distance Field rendering for a font.
2162
+ *
2163
+ * This works with the Blended APIs. SDF is a technique that
2164
+ * helps fonts look sharp even when scaling and rotating.
2165
+ *
2166
+ * This clears already-generated glyphs, if any, from the cache.
2167
+ *
2168
+ * \param font the font to set SDF support on.
2169
+ * \param on_off SDL_TRUE to enable SDF, SDL_FALSE to disable.
2170
+ *
2171
+ * \returns 0 on success, -1 on error.
2172
+ *
2173
+ * \since This function is available since SDL_ttf 2.0.18.
2174
+ *
2175
+ * \sa TTF_GetFontSDF
2176
+ */
2177
+ extern DECLSPEC int TTF_SetFontSDF(TTF_Font *font, SDL_bool on_off);
2178
+
2179
+ /**
2180
+ * Query whether Signed Distance Field rendering is enabled for a font.
2181
+ *
2182
+ * \param font the font to query
2183
+ *
2184
+ * \returns SDL_TRUE if enabled, SDL_FALSE otherwise.
2185
+ *
2186
+ * \since This function is available since SDL_ttf 2.0.18.
2187
+ *
2188
+ * \sa TTF_SetFontSDF
2189
+ */
2190
+ extern DECLSPEC SDL_bool TTF_GetFontSDF(const TTF_Font *font);
2191
+
2192
+ /**
2193
+ * Report SDL_ttf errors
2194
+ *
2195
+ * \sa TTF_GetError
2196
+ */
2197
+ #define TTF_SetError SDL_SetError
2198
+
2199
+ /**
2200
+ * Get last SDL_ttf error
2201
+ *
2202
+ * \sa TTF_SetError
2203
+ */
2204
+ #define TTF_GetError SDL_GetError
2205
+
2206
+ /**
2207
+ * Direction flags
2208
+ *
2209
+ * \sa TTF_SetFontDirection
2210
+ */
2211
+ typedef enum
2212
+ {
2213
+ TTF_DIRECTION_LTR = 0, /* Left to Right */
2214
+ TTF_DIRECTION_RTL, /* Right to Left */
2215
+ TTF_DIRECTION_TTB, /* Top to Bottom */
2216
+ TTF_DIRECTION_BTT /* Bottom to Top */
2217
+ } TTF_Direction;
2218
+
2219
+ /**
2220
+ * Set a global direction to be used for text shaping.
2221
+ *
2222
+ * \deprecated This function expects an hb_direction_t value, from HarfBuzz,
2223
+ * cast to an int, and affects all fonts globally. Please use
2224
+ * TTF_SetFontDirection() instead, which uses an enum supplied by
2225
+ * SDL_ttf itself and operates on a per-font basis.
2226
+ *
2227
+ * This is a global setting; fonts will favor a value set with
2228
+ * TTF_SetFontDirection(), but if they have not had one explicitly
2229
+ * set, they will use the value specified here.
2230
+ *
2231
+ * The default value is `HB_DIRECTION_LTR` (left-to-right text
2232
+ * flow).
2233
+ *
2234
+ * \param direction an hb_direction_t value.
2235
+ * \returns 0, or -1 if SDL_ttf is not compiled with HarfBuzz support.
2236
+ *
2237
+ * \since This function is available since SDL_ttf 2.0.18.
2238
+ *
2239
+ * \sa TTF_SetFontDirection
2240
+ */
2241
+ extern SDL_DEPRECATED DECLSPEC int SDLCALL TTF_SetDirection(int direction); /* hb_direction_t */
2242
+
2243
+ /**
2244
+ * Set a global script to be used for text shaping.
2245
+ *
2246
+ * \deprecated This function expects an hb_script_t value, from HarfBuzz, cast
2247
+ * to an int, and affects all fonts globally. Please use
2248
+ * TTF_SetFontScriptName() instead, which accepts a string that is
2249
+ * converted to an equivalent int internally, and operates on a
2250
+ * per-font basis.
2251
+ *
2252
+ * This is a global setting; fonts will favor a value set with
2253
+ * TTF_SetFontScriptName(), but if they have not had one
2254
+ * explicitly set, they will use the value specified here.
2255
+ *
2256
+ * The default value is `HB_SCRIPT_UNKNOWN`.
2257
+ *
2258
+ * \returns 0, or -1 if SDL_ttf is not compiled with HarfBuzz support.
2259
+ *
2260
+ * \since This function is available since SDL_ttf 2.0.18.
2261
+ *
2262
+ * \sa TTF_SetFontScriptName
2263
+ */
2264
+ extern SDL_DEPRECATED DECLSPEC int SDLCALL TTF_SetScript(int script); /* hb_script_t */
2265
+
2266
+ /**
2267
+ * Set direction to be used for text shaping by a font.
2268
+ *
2269
+ * Any value supplied here will override the global direction set with the
2270
+ * deprecated TTF_SetDirection().
2271
+ *
2272
+ * Possible direction values are:
2273
+ *
2274
+ * - `TTF_DIRECTION_LTR` (Left to Right)
2275
+ * - `TTF_DIRECTION_RTL` (Right to Left)
2276
+ * - `TTF_DIRECTION_TTB` (Top to Bottom)
2277
+ * - `TTF_DIRECTION_BTT` (Bottom to Top)
2278
+ *
2279
+ * If SDL_ttf was not built with HarfBuzz support, this function returns -1.
2280
+ *
2281
+ * \param font the font to specify a direction for.
2282
+ * \param direction the new direction for text to flow.
2283
+ * \returns 0 on success, or -1 on error.
2284
+ *
2285
+ * \since This function is available since SDL_ttf 2.20.0.
2286
+ */
2287
+ extern DECLSPEC int SDLCALL TTF_SetFontDirection(TTF_Font *font, TTF_Direction direction);
2288
+
2289
+ /**
2290
+ * Set script to be used for text shaping by a font.
2291
+ *
2292
+ * Any value supplied here will override the global script set with the
2293
+ * deprecated TTF_SetScript().
2294
+ *
2295
+ * The supplied script value must be a null-terminated string of exactly four
2296
+ * characters.
2297
+ *
2298
+ * If SDL_ttf was not built with HarfBuzz support, this function returns -1.
2299
+ *
2300
+ * \param font the font to specify a direction for.
2301
+ * \param script null-terminated string of exactly 4 characters.
2302
+ * \returns 0 on success, or -1 on error.
2303
+ *
2304
+ * \since This function is available since SDL_ttf 2.20.0.
2305
+ */
2306
+ extern DECLSPEC int SDLCALL TTF_SetFontScriptName(TTF_Font *font, const char *script);
2307
+
2308
+ /* Ends C function definitions when using C++ */
2309
+ #ifdef __cplusplus
2310
+ }
2311
+ #endif
2312
+ #include "close_code.h"
2313
+
2314
+ #endif /* SDL_TTF_H_ */
2315
+
2316
+ /* vi: set ts=4 sw=4 expandtab: */