1717 * available at: https://www.freetype.org/
1818 }
1919
20- { #note: SDL3-for-Pascal: Based on file SDL_textengine.h version 3.1.0 (preview). }
21-
2220{ $DEFINE SDL_TTF}
2321
2422{ $I sdl.inc}
@@ -89,8 +87,8 @@ interface
8987 }
9088const
9189 SDL_TTF_MAJOR_VERSION = 3 ;
92- SDL_TTF_MINOR_VERSION = 1 ;
93- SDL_TTF_MICRO_VERSION = 0 ;
90+ SDL_TTF_MINOR_VERSION = 2 ;
91+ SDL_TTF_MICRO_VERSION = 2 ;
9492
9593{ *
9694 * This is the version number macro for the current SDL_ttf version.
@@ -507,7 +505,7 @@ function TTF_GetFontDPI(font: PTTF_Font; hdpi: pcint; vdpi: pcint): Boolean; cde
507505 * SDL_ttf. A combination of these flags can be used with functions that set
508506 * or query font style, such as TTF_SetFontStyle or TTF_GetFontStyle.
509507 *
510- * \since This function is available since SDL_ttf 3.0.0.
508+ * \since This datatype is available since SDL_ttf 3.0.0.
511509 *
512510 * \sa TTF_SetFontStyle
513511 * \sa TTF_GetFontStyle
@@ -629,8 +627,9 @@ function TTF_GetFontOutline(font: PTTF_Font): cint; cdecl;
629627type
630628 PPTTF_HintingFlags = ^PTTF_HintingFlags;
631629 PTTF_HintingFlags = ^TTTF_HintingFlags;
632- TTTF_HintingFlags = Integer;
630+ TTTF_HintingFlags = type Integer;
633631const
632+ TTF_HINTING_INVALID = TTTF_HintingFlags(-1 );
634633 TTF_HINTING_NORMAL = TTTF_HintingFlags(0 ); { *< Normal hinting applies standard grid-fitting. }
635634 TTF_HINTING_LIGHT = TTTF_HintingFlags(1 ); { *< Light hinting applies subtle adjustments to improve rendering. }
636635 TTF_HINTING_MONO = TTTF_HintingFlags(2 ); { *< Monochrome hinting adjusts the font for better rendering at lower resolutions. }
@@ -689,7 +688,8 @@ function TTF_GetNumFontFaces(font: PTTF_Font): cint; cdecl;
689688 * - `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 3.0.0 and later)
690689 *
691690 * \param font the font to query.
692- * \returns the font's current hinter value.
691+ * \returns the font's current hinter value, or TTF_HINTING_INVALID if the
692+ * font is invalid.
693693 *
694694 * \threadsafety It is safe to call this function from any thread.
695695 *
@@ -703,18 +703,22 @@ function TTF_GetFontHinting(font: PTTF_Font): TTTF_HintingFlags; cdecl;
703703{ *
704704 * Enable Signed Distance Field rendering for a font.
705705 *
706- * SDF is a technique that helps fonts look sharp even when scaling and rotating, and requires special shader support for display.
706+ * SDF is a technique that helps fonts look sharp even when scaling and
707+ * rotating, and requires special shader support for display.
707708 *
708- * This works with Blended APIs, and generates the raw signed distance values in the alpha channel of the resulting texture.
709+ * This works with Blended APIs, and generates the raw signed distance values
710+ * in the alpha channel of the resulting texture.
709711 *
710- * This updates any TTF_Text objects using this font, and clears already-generated glyphs, if any, from the cache.
712+ * This updates any TTF_Text objects using this font, and clears
713+ * already-generated glyphs, if any, from the cache.
711714 *
712715 * \param font the font to set SDF support on.
713716 * \param enabled true to enable SDF, false to disable.
714717 * \returns true on success or false on failure; call SDL_GetError()
715718 * for more information.
716719 *
717- * \threadsafety This function should be called on the thread that created the font.
720+ * \threadsafety This function should be called on the thread that created the
721+ * font.
718722 *
719723 * \since This function is available since SDL_ttf 3.0.0.
720724 *
@@ -726,7 +730,7 @@ function TTF_SetFontSDF(font: PTTF_Font; enabled: Boolean): Boolean; cdecl;
726730{ *
727731 * Query whether Signed Distance Field rendering is enabled for a font.
728732 *
729- * \param font the font to query
733+ * \param font the font to query.
730734 *
731735 * \returns true if enabled, false otherwise.
732736 *
@@ -739,6 +743,32 @@ function TTF_SetFontSDF(font: PTTF_Font; enabled: Boolean): Boolean; cdecl;
739743function TTF_GetFontSDF (font: PTTF_Font): Boolean; cdecl;
740744 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_GetFontSDF' { $ENDIF} { $ENDIF} ;
741745
746+ { *
747+ * Query a font's weight, in terms of the lightness/heaviness of the strokes.
748+ *
749+ * \param font the font to query.
750+ * \returns the font's current weight.
751+ *
752+ * \threadsafety This function should be called on the thread that created the
753+ * font.
754+ *
755+ * \since This function is available since SDL_ttf 3.2.2.
756+ *}
757+ function TTF_GetFontWeight (font: PTTF_Font): cint; cdecl;
758+ external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_GetFontWeight' { $ENDIF} { $ENDIF} ;
759+
760+ const
761+ TTF_FONT_WEIGHT_THIN = 100 ; { *< Thin (100) named font weight value *}
762+ TTF_FONT_WEIGHT_EXTRA_LIGHT = 200 ; { *< ExtraLight (200) named font weight value *}
763+ TTF_FONT_WEIGHT_LIGHT = 300 ; { *< Light (300) named font weight value *}
764+ TTF_FONT_WEIGHT_NORMAL = 400 ; { *< Normal (400) named font weight value *}
765+ TTF_FONT_WEIGHT_MEDIUM = 500 ; { *< Medium (500) named font weight value *}
766+ TTF_FONT_WEIGHT_SEMI_BOLD = 600 ; { *< SemiBold (600) named font weight value *}
767+ TTF_FONT_WEIGHT_BOLD = 700 ; { *< Bold (700) named font weight value *}
768+ TTF_FONT_WEIGHT_EXTRA_BOLD = 800 ; { *< ExtraBold (800) named font weight value *}
769+ TTF_FONT_WEIGHT_BLACK = 900 ; { *< Black (900) named font weight value *}
770+
771+
742772{ *
743773 * The horizontal alignment used when rendering wrapped text.
744774 *
@@ -1037,22 +1067,57 @@ function TTF_SetFontDirection(font: PTTF_Font; direction: TTTF_Direction): Boole
10371067function TTF_GetFontDirection (font: PTTF_Font): TTTF_Direction; cdecl;
10381068 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_GetFontDirection' { $ENDIF} { $ENDIF} ;
10391069
1070+ { *
1071+ * Convert from a 4 character string to a 32-bit tag.
1072+ *
1073+ * \param string the 4 character string to convert.
1074+ * \returns the 32-bit representation of the string.
1075+ *
1076+ * \threadsafety It is safe to call this function from any thread.
1077+ *
1078+ * \since This function is available since SDL_ttf 3.0.0.
1079+ *
1080+ * \sa TTF_TagToString
1081+ *}
1082+ function TTF_StringToTag (const string_: PAnsiChar): cuint32; cdecl;
1083+ external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_StringToTag' { $ENDIF} { $ENDIF} ;
1084+
1085+ { *
1086+ * Convert from a 32-bit tag to a 4 character string.
1087+ *
1088+ * \param tag the 32-bit tag to convert.
1089+ * \param string a pointer filled in with the 4 character representation of
1090+ * the tag.
1091+ * \param size the size of the buffer pointed at by string, should be at least
1092+ * 4.
1093+ *
1094+ * \threadsafety It is safe to call this function from any thread.
1095+ *
1096+ * \since This function is available since SDL_ttf 3.0.0.
1097+ *
1098+ * \sa TTF_TagToString
1099+ *}
1100+ procedure TTF_TagToString (tag: cuint32; string_: PAnsiChar; size: csize_t); cdecl;
1101+ external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_TagToString' { $ENDIF} { $ENDIF} ;
1102+
10401103{ *
10411104 * Set the script to be used for text shaping by a font.
10421105 *
1043- * This returns false if SDL_ttf isn't build with HarfBuzz support.
1106+ * This returns false if SDL_ttf isn't built with HarfBuzz support.
10441107 *
10451108 * This updates any TTF_Text objects using this font.
10461109 *
10471110 * \param font the font to modify.
1048- * \param script a script tag in the format used by HarfBuzz .
1111+ * \param script an ISO 15924 code .
10491112 * \returns true on success or false on failure; call SDL_GetError() for more
10501113 * information.
10511114 *
10521115 * \threadsafety This function should be called on the thread that created the
10531116 * font.
10541117 *
10551118 * \since This function is available since SDL_ttf 3.0.0.
1119+ *
1120+ * \sa TTF_StringToTag
10561121 }
10571122function TTF_SetFontScript (font: PTTF_Font; script: cuint32): Boolean; cdecl;
10581123 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_SetFontScript' { $ENDIF} { $ENDIF} ;
@@ -1061,12 +1126,14 @@ function TTF_SetFontScript(font: PTTF_Font; script: cuint32): Boolean; cdecl;
10611126 * Get the script used for text shaping a font.
10621127 *
10631128 * \param font the font to query.
1064- * \returns a script tag in the format used by HarfBuzz .
1129+ * \returns an ISO 15924 code or 0 if a script hasn't been set .
10651130 *
10661131 * \threadsafety This function should be called on the thread that created the
10671132 * font.
10681133 *
10691134 * \since This function is available since SDL_ttf 3.0.0.
1135+ *
1136+ * \sa TTF_TagToString
10701137 }
10711138function TTF_GetFontScript (font: PTTF_Font): cuint32; cdecl;
10721139 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_GetFontScript' { $ENDIF} { $ENDIF} ;
@@ -1075,12 +1142,14 @@ function TTF_GetFontScript(font: PTTF_Font): cuint32; cdecl;
10751142 * Get the script used by a 32-bit codepoint.
10761143 *
10771144 * \param ch the character code to check.
1078- * \returns a script tag in the format used by HarfBuzz on success, or 0 on
1079- * failure; call SDL_GetError() for more information.
1145+ * \returns an ISO 15924 code on success, or 0 on failure;
1146+ * call SDL_GetError() for more information.
10801147 *
10811148 * \threadsafety This function is thread-safe.
10821149 *
10831150 * \since This function is available since SDL_ttf 3.0.0.
1151+ *
1152+ * \sa TTF_TagToString
10841153 }
10851154function TTF_GetGlyphScript (ch: cuint32): cuint32; cdecl;
10861155 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_GetGlyphScript' { $ENDIF} { $ENDIF} ;
@@ -1093,7 +1162,8 @@ function TTF_GetGlyphScript(ch: cuint32): cuint32; cdecl;
10931162 * This updates any TTF_Text objects using this font.
10941163 *
10951164 * \param font the font to specify a language for.
1096- * \param language_bcp47 a null-terminated string containing the desired language's BCP47 code. Or null to reset the value.
1165+ * \param language_bcp47 a null-terminated string containing the desired
1166+ language's BCP47 code. Or null to reset the value.
10971167 * \returns true on success or false on failure; call SDL_GetError()
10981168 * for more information.
10991169 *
@@ -1211,7 +1281,8 @@ function TTF_GetGlyphMetrics(font: PTTF_Font; ch: cuint32; minx: pcint; maxx: pc
12111281 * \param font the font to query.
12121282 * \param previous_ch the previous codepoint.
12131283 * \param ch the current codepoint.
1214- * \param kerning a Pointer filled in with the kerning size between the two glyphs, in pixels, may be nil.
1284+ * \param kerning a Pointer filled in with the kerning size between the two
1285+ * glyphs, in pixels, may be nil.
12151286 * \returns true on success or false on failure; call SDL_GetError()
12161287 * for more information.
12171288 *
@@ -1853,6 +1924,8 @@ procedure TTF_DestroySurfaceTextEngine(engine: PTTF_TextEngine); cdecl;
18531924 * \since This function is available since SDL_ttf 3.0.0.
18541925 *
18551926 * \sa TTF_DestroyRendererTextEngine
1927+ * \sa TTF_DrawRendererText
1928+ * \sa TTF_CreateRendererTextEngineWithProperties
18561929 }
18571930function TTF_CreateRendererTextEngine (renderer: PSDL_Renderer): PTTF_TextEngine; cdecl;
18581931 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_CreateRendererTextEngine' { $ENDIF} { $ENDIF} ;
@@ -1877,7 +1950,9 @@ function TTF_CreateRendererTextEngine(renderer: PSDL_Renderer): PTTF_TextEngine;
18771950 *
18781951 * \since This function is available since SDL_ttf 3.0.0.
18791952 *
1953+ * \sa TTF_CreateRendererTextEngine
18801954 * \sa TTF_DestroyRendererTextEngine
1955+ * \sa TTF_DrawRendererText
18811956 }
18821957function TTF_CreateRendererTextEngineWithProperties (props: TSDL_PropertiesID): PTTF_TextEngine; cdecl;
18831958 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_CreateRendererTextEngineWithProperties' { $ENDIF} { $ENDIF} ;
@@ -1944,7 +2019,9 @@ procedure TTF_DestroyRendererTextEngine(engine: PTTF_TextEngine); cdecl;
19442019 *
19452020 * \since This function is available since SDL_ttf 3.0.0.
19462021 *
2022+ * \sa TTF_CreateGPUTextEngineWithProperties
19472023 * \sa TTF_DestroyGPUTextEngine
2024+ * \sa TTF_GetGPUTextDrawData
19482025 }
19492026function TTF_CreateGPUTextEngine (device: PSDL_GPUDevice): PTTF_TextEngine; cdecl;
19502027 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_CreateGPUTextEngine' { $ENDIF} { $ENDIF} ;
@@ -1969,7 +2046,9 @@ function TTF_CreateGPUTextEngine(device: PSDL_GPUDevice): PTTF_TextEngine; cdecl
19692046 *
19702047 * \since This function is available since SDL_ttf 3.0.0.
19712048 *
2049+ * \sa TTF_CreateGPUTextEngine
19722050 * \sa TTF_DestroyGPUTextEngine
2051+ * \sa TTF_GetGPUTextDrawData
19732052 }
19742053function TTF_CreateGPUTextEngineWithProperties (props: TSDL_PropertiesID): PTTF_TextEngine; cdecl;
19752054 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_CreateGPUTextEngineWithProperties' { $ENDIF} { $ENDIF} ;
@@ -2253,17 +2332,19 @@ function TTF_GetTextDirection(text: PTTF_Text): TTTF_Direction; cdecl;
22532332{ *
22542333 * Set the script to be used for text shaping a text object.
22552334 *
2256- * This returns false if SDL_ttf isn't build with HarfBuzz support.
2335+ * This returns false if SDL_ttf isn't built with HarfBuzz support.
22572336 *
22582337 * \param text the text to modify.
2259- * \param script a script tag in the format used by HarfBuzz .
2338+ * \param script an ISO 15924 code .
22602339 * \returns true on success or false on failure; call SDL_GetError() for more
22612340 * information.
22622341 *
22632342 * \threadsafety This function should be called on the thread that created the
22642343 * text.
22652344 *
22662345 * \since This function is available since SDL_ttf 3.0.0.
2346+ *
2347+ * \sa TTF_StringToTag
22672348 }
22682349function TTF_SetTextScript (text: PTTF_Text; script: cuint32): Boolean; cdecl;
22692350 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_SetTextScript' { $ENDIF} { $ENDIF} ;
@@ -2274,12 +2355,15 @@ function TTF_SetTextScript(text: PTTF_Text; script: cuint32): Boolean; cdecl;
22742355 * This defaults to the script of the font used by the text object.
22752356 *
22762357 * \param text the text to query.
2277- * \returns a script tag in the format used by HarfBuzz.
2358+ * \returns an ISO 15924 code or 0 if a script hasn't been set on either
2359+ * the text object or the font.
22782360 *
22792361 * \threadsafety This function should be called on the thread that created the
22802362 * text.
22812363 *
22822364 * \since This function is available since SDL_ttf 3.0.0.
2365+ *
2366+ * \sa TTF_TagToString
22832367 }
22842368function TTF_GetTextScript (text: PTTF_Text): cuint32; cdecl;
22852369 external TTF_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _TTF_GetTextScript' { $ENDIF} { $ENDIF} ;
0 commit comments