@@ -1004,6 +1004,102 @@ extern SDL_DECLSPEC Uint32 SDLCALL TTF_GetGlyphScript(Uint32 ch);
10041004 */
10051005extern SDL_DECLSPEC bool TTF_SetFontLanguage (TTF_Font * font , const char * language_bcp47 );
10061006
1007+ /**
1008+ * Set font features. Overrides previously set features.
1009+ *
1010+ * The syntax is a space-separated list of features.
1011+ * The feature syntax matches [hb_feature_from_string()](https://harfbuzz.github.io/harfbuzz-hb-common.html#hb-feature-from-string)
1012+ *
1013+ * Ignores kerning set by TTF_SetFontKerning() after call with non-null features string.
1014+ *
1015+ * If SDL_ttf was not built with HarfBuzz support, this function returns false.
1016+ *
1017+ * This updates any TTF_Text objects using this font.
1018+ *
1019+ * Example:
1020+ *
1021+ * ```c
1022+ * TTF_SetFontFeatures(font, "calt liga=1 -kern +ss01 aalt[3:5]=2");
1023+ * ```
1024+ *
1025+ * \param font the font to specify features for.
1026+ * \param features a null-termianted string containing the font feature settings, separated by spaces. May be NULL.
1027+ * \returns true on success or false on failure; call SDL_GetError()
1028+ * for more information.
1029+ *
1030+ * \threadsafety This function should be called on the thread that created the
1031+ * font.
1032+ *
1033+ * \since This function is available since SDL_ttf !TODO!.
1034+ */
1035+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontFeatures (TTF_Font * font , char * features );
1036+
1037+ /**
1038+ * Query a font's font features.
1039+ *
1040+ * Note that the returned string is to internal storage, and should not be
1041+ * modified or free'd by the caller. The string becomes invalid, with the rest
1042+ * of the font, when `font` is handed to TTF_CloseFont().
1043+ * And when TTF_SetFontFeatures() is called on the font.
1044+ *
1045+ * \param font the font to query.
1046+ *
1047+ * \returns the font features string set by TTF_SetFontFeatures(), or NULL if not set
1048+ *
1049+ * \threadsafety This function should be called on the thread that created the
1050+ * font.
1051+ *
1052+ * \since This function is available since SDL_ttf !TODO!.
1053+ */
1054+ extern SDL_DECLSPEC char * SDLCALL TTF_GetFontFeatures (TTF_Font * font );
1055+
1056+ /**
1057+ * Set font variations. Overrides previously set variations.
1058+ *
1059+ * The syntax is a space-separated list of variations.
1060+ * The variation syntax matches [hb_variation_from_string()](https://harfbuzz.github.io/harfbuzz-hb-common.html#hb-variation-from-string)
1061+ *
1062+ * If SDL_ttf was not built with HarfBuzz support, this function returns false.
1063+ *
1064+ * This updates any TTF_Text objects using this font.
1065+ *
1066+ * Example:
1067+ *
1068+ * ```c
1069+ * TTF_SetFontVariations(font, "wght=600 wdth=125 slnt=-7.5");
1070+ * ```
1071+ *
1072+ * \param font the font to specify variations for.
1073+ * \param variations a null-termianted string containing the font feature settings, separated by spaces. May be NULL.
1074+ * \returns true on success or false on failure; call SDL_GetError()
1075+ * for more information.
1076+ *
1077+ * \threadsafety This function should be called on the thread that created the
1078+ * font.
1079+ *
1080+ * \since This function is available since SDL_ttf !TODO!.
1081+ */
1082+ extern SDL_DECLSPEC bool SDLCALL TTF_SetFontVariations (TTF_Font * font , char * variations );
1083+
1084+ /**
1085+ * Query a font's font variations.
1086+ *
1087+ * Note that the returned string is to internal storage, and should not be
1088+ * modified or free'd by the caller. The string becomes invalid, with the rest
1089+ * of the font, when `font` is handed to TTF_CloseFont().
1090+ * And when TTF_SetFontVariations() is called on the font.
1091+ *
1092+ * \param font the font to query.
1093+ *
1094+ * \returns the font variations string, or NULL if not set
1095+ *
1096+ * \threadsafety This function should be called on the thread that created the
1097+ * font.
1098+ *
1099+ * \since This function is available since SDL_ttf !TODO!.
1100+ */
1101+ extern SDL_DECLSPEC char * SDLCALL TTF_GetFontVariations (TTF_Font * font );
1102+
10071103/**
10081104 * Check whether a glyph is provided by the font for a UNICODE codepoint.
10091105 *
0 commit comments