ruby2d 0.11.2 → 0.12.0

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