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