1use sdl_sys_bindgen::*;
4
5pub const SDL_TTF_MAJOR_VERSION: u32 = 3;
6pub const SDL_TTF_MINOR_VERSION: u32 = 3;
7pub const SDL_TTF_MICRO_VERSION: u32 = 0;
8pub const TTF_PROP_FONT_CREATE_FILENAME_STRING: &[u8; 29] = b"SDL_ttf.font.create.filename\0";
9pub const TTF_PROP_FONT_CREATE_IOSTREAM_POINTER: &[u8; 29] = b"SDL_ttf.font.create.iostream\0";
10pub const TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER: &[u8; 36] =
11 b"SDL_ttf.font.create.iostream.offset\0";
12pub const TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN: &[u8; 39] =
13 b"SDL_ttf.font.create.iostream.autoclose\0";
14pub const TTF_PROP_FONT_CREATE_SIZE_FLOAT: &[u8; 25] = b"SDL_ttf.font.create.size\0";
15pub const TTF_PROP_FONT_CREATE_FACE_NUMBER: &[u8; 25] = b"SDL_ttf.font.create.face\0";
16pub const TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER: &[u8; 25] = b"SDL_ttf.font.create.hdpi\0";
17pub const TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER: &[u8; 25] = b"SDL_ttf.font.create.vdpi\0";
18pub const TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER: &[u8; 34] =
19 b"SDL_ttf.font.create.existing_font\0";
20pub const TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER: &[u8; 30] = b"SDL_ttf.font.outline.line_cap\0";
21pub const TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER: &[u8; 31] = b"SDL_ttf.font.outline.line_join\0";
22pub const TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER: &[u8; 33] =
23 b"SDL_ttf.font.outline.miter_limit\0";
24pub const TTF_STYLE_NORMAL: u32 = 0;
25pub const TTF_STYLE_BOLD: u32 = 1;
26pub const TTF_STYLE_ITALIC: u32 = 2;
27pub const TTF_STYLE_UNDERLINE: u32 = 4;
28pub const TTF_STYLE_STRIKETHROUGH: u32 = 8;
29pub const TTF_FONT_WEIGHT_THIN: u32 = 100;
30pub const TTF_FONT_WEIGHT_EXTRA_LIGHT: u32 = 200;
31pub const TTF_FONT_WEIGHT_LIGHT: u32 = 300;
32pub const TTF_FONT_WEIGHT_NORMAL: u32 = 400;
33pub const TTF_FONT_WEIGHT_MEDIUM: u32 = 500;
34pub const TTF_FONT_WEIGHT_SEMI_BOLD: u32 = 600;
35pub const TTF_FONT_WEIGHT_BOLD: u32 = 700;
36pub const TTF_FONT_WEIGHT_EXTRA_BOLD: u32 = 800;
37pub const TTF_FONT_WEIGHT_BLACK: u32 = 900;
38pub const TTF_FONT_WEIGHT_EXTRA_BLACK: u32 = 950;
39pub const TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER: &[u8; 45] =
40 b"SDL_ttf.renderer_text_engine.create.renderer\0";
41pub const TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER: &[u8; 55] =
42 b"SDL_ttf.renderer_text_engine.create.atlas_texture_size\0";
43pub const TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER: &[u8; 38] =
44 b"SDL_ttf.gpu_text_engine.create.device\0";
45pub const TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER: &[u8; 50] =
46 b"SDL_ttf.gpu_text_engine.create.atlas_texture_size\0";
47pub const TTF_SUBSTRING_DIRECTION_MASK: u32 = 255;
48pub const TTF_SUBSTRING_TEXT_START: u32 = 256;
49pub const TTF_SUBSTRING_LINE_START: u32 = 512;
50pub const TTF_SUBSTRING_LINE_END: u32 = 1024;
51pub const TTF_SUBSTRING_TEXT_END: u32 = 2048;
52unsafe extern "C" {
53 #[doc = "This function gets the version of the dynamically linked SDL_ttf library.\n\n**Returns:** SDL_ttf version.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
54 pub fn TTF_Version() -> core::ffi::c_int;
55}
56unsafe extern "C" {
57 #[doc = "Query the version of the FreeType library in use.\n\nTTF_Init() should be called before calling this function.\n\n**Parameter:** major to be filled in with the major version number. Can be NULL.\n\n**Parameter:** minor to be filled in with the minor version number. Can be NULL.\n\n**Parameter:** patch to be filled in with the param version number. Can be NULL.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_Init"]
58 pub fn TTF_GetFreeTypeVersion(
59 major: *mut core::ffi::c_int,
60 minor: *mut core::ffi::c_int,
61 patch: *mut core::ffi::c_int,
62 );
63}
64unsafe extern "C" {
65 #[doc = "Query the version of the HarfBuzz library in use.\n\nIf HarfBuzz is not available, the version reported is 0.0.0.\n\n**Parameter:** major to be filled in with the major version number. Can be NULL.\n\n**Parameter:** minor to be filled in with the minor version number. Can be NULL.\n\n**Parameter:** patch to be filled in with the param version number. Can be NULL.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
66 pub fn TTF_GetHarfBuzzVersion(
67 major: *mut core::ffi::c_int,
68 minor: *mut core::ffi::c_int,
69 patch: *mut core::ffi::c_int,
70 );
71}
72#[repr(C)]
73#[derive(Debug, Copy, Clone)]
74pub struct TTF_Font {
75 _unused: [u8; 0],
76}
77unsafe extern "C" {
78 #[doc = "Initialize SDL_ttf.\n\nYou must successfully call this function before it is safe to call any\nother function in this library.\n\nIt is safe to call this more than once, and each successful TTF_Init() call\nshould be paired with a matching TTF_Quit() call.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_Quit"]
79 pub fn TTF_Init() -> bool;
80}
81unsafe extern "C" {
82 #[doc = "Create a font from a file, using a specified point size.\n\nSome .fon fonts will have several sizes embedded in the file, so the point\nsize becomes the index of choosing which size. If the value is too high,\nthe last indexed size will be the default.\n\nWhen done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.\n\n**Parameter:** file path to font file.\n\n**Parameter:** ptsize point size to use for the newly-opened font.\n\n**Returns:** a valid TTF_Font, or NULL on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CloseFont"]
83 pub fn TTF_OpenFont(file: *const core::ffi::c_char, ptsize: f32) -> *mut TTF_Font;
84}
85unsafe extern "C" {
86 #[doc = "Create a font from an SDL_IOStream, using a specified point size.\n\nSome .fon fonts will have several sizes embedded in the file, so the point\nsize becomes the index of choosing which size. If the value is too high,\nthe last indexed size will be the default.\n\nIf `closeio` is true, `src` will be automatically closed once the font is\nclosed. Otherwise you should keep `src` open until the font is closed.\n\nWhen done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.\n\n**Parameter:** src an SDL_IOStream to provide a font file's data.\n\n**Parameter:** closeio true to close `src` when the font is closed, false to leave\nit open.\n\n**Parameter:** ptsize point size to use for the newly-opened font.\n\n**Returns:** a valid TTF_Font, or NULL on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CloseFont"]
87 pub fn TTF_OpenFontIO(src: *mut SDL_IOStream, closeio: bool, ptsize: f32) -> *mut TTF_Font;
88}
89unsafe extern "C" {
90 #[doc = "Create a font with the specified properties.\n\nThese are the supported properties:\n\n- `TTF_PROP_FONT_CREATE_FILENAME_STRING`: the font file to open, if an\nSDL_IOStream isn't being used. This is required if\n`TTF_PROP_FONT_CREATE_IOSTREAM_POINTER` and\n`TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER` aren't set.\n- `TTF_PROP_FONT_CREATE_IOSTREAM_POINTER`: an SDL_IOStream containing the\nfont to be opened. This should not be closed until the font is closed.\nThis is required if `TTF_PROP_FONT_CREATE_FILENAME_STRING` and\n`TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER` aren't set.\n- `TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER`: the offset in the iostream\nfor the beginning of the font, defaults to 0.\n- `TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN`: true if closing the\nfont should also close the associated SDL_IOStream.\n- `TTF_PROP_FONT_CREATE_SIZE_FLOAT`: the point size of the font. Some .fon\nfonts will have several sizes embedded in the file, so the point size\nbecomes the index of choosing which size. If the value is too high, the\nlast indexed size will be the default.\n- `TTF_PROP_FONT_CREATE_FACE_NUMBER`: the face index of the font, if the\nfont contains multiple font faces.\n- `TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER`: the horizontal DPI to use\nfor font rendering, defaults to\n`TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER` if set, or 72 otherwise.\n- `TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER`: the vertical DPI to use for\nfont rendering, defaults to `TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER`\nif set, or 72 otherwise.\n- `TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER`: an optional TTF_Font that,\nif set, will be used as the font data source and the initial size and\nstyle of the new font.\n\n**Parameter:** props the properties to use.\n\n**Returns:** a valid TTF_Font, or NULL on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CloseFont"]
91 pub fn TTF_OpenFontWithProperties(props: SDL_PropertiesID) -> *mut TTF_Font;
92}
93unsafe extern "C" {
94 #[doc = "Create a copy of an existing font.\n\nThe copy will be distinct from the original, but will share the font file\nand have the same size and style as the original.\n\nWhen done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.\n\n**Parameter:** existing_font the font to copy.\n\n**Returns:** a valid TTF_Font, or NULL on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\noriginal font.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CloseFont"]
95 pub fn TTF_CopyFont(existing_font: *mut TTF_Font) -> *mut TTF_Font;
96}
97unsafe extern "C" {
98 #[doc = "Get the properties associated with a font.\n\nThe following read-write properties are provided by SDL:\n\n- `TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER`: The FT_Stroker_LineCap value\nused when setting the font outline, defaults to\n`FT_STROKER_LINECAP_ROUND`.\n- `TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER`: The FT_Stroker_LineJoin value\nused when setting the font outline, defaults to\n`FT_STROKER_LINEJOIN_ROUND`.\n- `TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER`: The FT_Fixed miter limit used\nwhen setting the font outline, defaults to 0.\n\n**Parameter:** font the font to query.\n\n**Returns:** a valid property ID on success or 0 on failure; call\nSDL_GetError() for more information.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
99 pub fn TTF_GetFontProperties(font: *mut TTF_Font) -> SDL_PropertiesID;
100}
101unsafe extern "C" {
102 #[doc = "Get the font generation.\n\nThe generation is incremented each time font properties change that require\nrebuilding glyphs, such as style, size, etc.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font generation or 0 on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
103 pub fn TTF_GetFontGeneration(font: *mut TTF_Font) -> Uint32;
104}
105unsafe extern "C" {
106 #[doc = "Add a fallback font.\n\nAdd a font that will be used for glyphs that are not in the current font.\nThe fallback font should have the same size and style as the current font.\n\nIf there are multiple fallback fonts, they are used in the order added.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to modify.\n\n**Parameter:** fallback the font to add as a fallback.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created\nboth fonts.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_ClearFallbackFonts\n\n**See Also:** TTF_RemoveFallbackFont"]
107 pub fn TTF_AddFallbackFont(font: *mut TTF_Font, fallback: *mut TTF_Font) -> bool;
108}
109unsafe extern "C" {
110 #[doc = "Remove a fallback font.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to modify.\n\n**Parameter:** fallback the font to remove as a fallback.\n\n**Thread Safety:** This function should be called on the thread that created\nboth fonts.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_AddFallbackFont\n\n**See Also:** TTF_ClearFallbackFonts"]
111 pub fn TTF_RemoveFallbackFont(font: *mut TTF_Font, fallback: *mut TTF_Font);
112}
113unsafe extern "C" {
114 #[doc = "Remove all fallback fonts.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to modify.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_AddFallbackFont\n\n**See Also:** TTF_RemoveFallbackFont"]
115 pub fn TTF_ClearFallbackFonts(font: *mut TTF_Font);
116}
117unsafe extern "C" {
118 #[doc = "Set a font's size dynamically.\n\nThis updates any TTF_Text objects using this font, and clears\nalready-generated glyphs, if any, from the cache.\n\n**Parameter:** font the font to resize.\n\n**Parameter:** ptsize the new point size.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontSize"]
119 pub fn TTF_SetFontSize(font: *mut TTF_Font, ptsize: f32) -> bool;
120}
121unsafe extern "C" {
122 #[doc = "Set font size dynamically with target resolutions, in dots per inch.\n\nThis updates any TTF_Text objects using this font, and clears\nalready-generated glyphs, if any, from the cache.\n\n**Parameter:** font the font to resize.\n\n**Parameter:** ptsize the new point size.\n\n**Parameter:** hdpi the target horizontal DPI.\n\n**Parameter:** vdpi the target vertical DPI.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontSize\n\n**See Also:** TTF_GetFontSizeDPI"]
123 pub fn TTF_SetFontSizeDPI(
124 font: *mut TTF_Font,
125 ptsize: f32,
126 hdpi: core::ffi::c_int,
127 vdpi: core::ffi::c_int,
128 ) -> bool;
129}
130unsafe extern "C" {
131 #[doc = "Get the size of a font.\n\n**Parameter:** font the font to query.\n\n**Returns:** the size of the font, or 0.0f on failure; call SDL_GetError() for\nmore information.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontSize\n\n**See Also:** TTF_SetFontSizeDPI"]
132 pub fn TTF_GetFontSize(font: *mut TTF_Font) -> f32;
133}
134unsafe extern "C" {
135 #[doc = "Get font target resolutions, in dots per inch.\n\n**Parameter:** font the font to query.\n\n**Parameter:** hdpi a pointer filled in with the target horizontal DPI.\n\n**Parameter:** vdpi a pointer filled in with the target vertical DPI.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontSizeDPI"]
136 pub fn TTF_GetFontDPI(
137 font: *mut TTF_Font,
138 hdpi: *mut core::ffi::c_int,
139 vdpi: *mut core::ffi::c_int,
140 ) -> bool;
141}
142#[doc = "Font style flags for TTF_Font\n\nThese are the flags which can be used to set the style of a font in\nSDL_ttf. A combination of these flags can be used with functions that set\nor query font style, such as TTF_SetFontStyle or TTF_GetFontStyle.\n\n**Available Since:** This datatype is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontStyle\n\n**See Also:** TTF_GetFontStyle"]
143pub type TTF_FontStyleFlags = Uint32;
144unsafe extern "C" {
145 #[doc = "Set a font's current style.\n\nThis updates any TTF_Text objects using this font, and clears\nalready-generated glyphs, if any, from the cache.\n\nThe font styles are a set of bit flags, OR'd together:\n\n- `TTF_STYLE_NORMAL` (is zero)\n- `TTF_STYLE_BOLD`\n- `TTF_STYLE_ITALIC`\n- `TTF_STYLE_UNDERLINE`\n- `TTF_STYLE_STRIKETHROUGH`\n\n**Parameter:** font the font to set a new style on.\n\n**Parameter:** style the new style values to set, OR'd together.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontStyle"]
146 pub fn TTF_SetFontStyle(font: *mut TTF_Font, style: TTF_FontStyleFlags);
147}
148unsafe extern "C" {
149 #[doc = "Query a font's current style.\n\nThe font styles are a set of bit flags, OR'd together:\n\n- `TTF_STYLE_NORMAL` (is zero)\n- `TTF_STYLE_BOLD`\n- `TTF_STYLE_ITALIC`\n- `TTF_STYLE_UNDERLINE`\n- `TTF_STYLE_STRIKETHROUGH`\n\n**Parameter:** font the font to query.\n\n**Returns:** the current font style, as a set of bit flags.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontStyle"]
150 pub fn TTF_GetFontStyle(font: *const TTF_Font) -> TTF_FontStyleFlags;
151}
152unsafe extern "C" {
153 #[doc = "Set a font's current outline.\n\nThis uses the font properties `TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER`,\n`TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER`, and\n`TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER` when setting the font outline.\n\nThis updates any TTF_Text objects using this font, and clears\nalready-generated glyphs, if any, from the cache.\n\n**Parameter:** font the font to set a new outline on.\n\n**Parameter:** outline positive outline value, 0 to default.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontOutline"]
154 pub fn TTF_SetFontOutline(font: *mut TTF_Font, outline: core::ffi::c_int) -> bool;
155}
156unsafe extern "C" {
157 #[doc = "Query a font's current outline.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's current outline value.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontOutline"]
158 pub fn TTF_GetFontOutline(font: *const TTF_Font) -> core::ffi::c_int;
159}
160impl TTF_HintingFlags {
161 pub const TTF_HINTING_INVALID: TTF_HintingFlags = TTF_HintingFlags(-1);
162 #[doc = "< Normal hinting applies standard grid-fitting."]
163 pub const TTF_HINTING_NORMAL: TTF_HintingFlags = TTF_HintingFlags(0);
164 #[doc = "< Light hinting applies subtle adjustments to improve rendering."]
165 pub const TTF_HINTING_LIGHT: TTF_HintingFlags = TTF_HintingFlags(1);
166 #[doc = "< Monochrome hinting adjusts the font for better rendering at lower resolutions."]
167 pub const TTF_HINTING_MONO: TTF_HintingFlags = TTF_HintingFlags(2);
168 #[doc = "< No hinting, the font is rendered without any grid-fitting."]
169 pub const TTF_HINTING_NONE: TTF_HintingFlags = TTF_HintingFlags(3);
170 #[doc = "< Light hinting with subpixel rendering for more precise font edges."]
171 pub const TTF_HINTING_LIGHT_SUBPIXEL: TTF_HintingFlags = TTF_HintingFlags(4);
172}
173#[repr(transparent)]
174#[doc = "Hinting flags for TTF (TrueType Fonts)\n\nThis enum specifies the level of hinting to be applied to the font\nrendering. The hinting level determines how much the font's outlines are\nadjusted for better alignment on the pixel grid.\n\n**Available Since:** This enum is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontHinting\n\n**See Also:** TTF_GetFontHinting"]
175#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
176pub struct TTF_HintingFlags(pub core::ffi::c_int);
177unsafe extern "C" {
178 #[doc = "Set a font's current hinter setting.\n\nThis updates any TTF_Text objects using this font, and clears\nalready-generated glyphs, if any, from the cache.\n\nThe hinter setting is a single value:\n\n- `TTF_HINTING_NORMAL`\n- `TTF_HINTING_LIGHT`\n- `TTF_HINTING_MONO`\n- `TTF_HINTING_NONE`\n- `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 3.0.0 and later)\n\n**Parameter:** font the font to set a new hinter setting on.\n\n**Parameter:** hinting the new hinter setting.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontHinting"]
179 pub fn TTF_SetFontHinting(font: *mut TTF_Font, hinting: TTF_HintingFlags);
180}
181unsafe extern "C" {
182 #[doc = "Query the number of faces of a font.\n\n**Parameter:** font the font to query.\n\n**Returns:** the number of FreeType font faces.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
183 pub fn TTF_GetNumFontFaces(font: *const TTF_Font) -> core::ffi::c_int;
184}
185unsafe extern "C" {
186 #[doc = "Query a font's current FreeType hinter setting.\n\nThe hinter setting is a single value:\n\n- `TTF_HINTING_NORMAL`\n- `TTF_HINTING_LIGHT`\n- `TTF_HINTING_MONO`\n- `TTF_HINTING_NONE`\n- `TTF_HINTING_LIGHT_SUBPIXEL` (available in SDL_ttf 3.0.0 and later)\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's current hinter value, or TTF_HINTING_INVALID if the\nfont is invalid.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontHinting"]
187 pub fn TTF_GetFontHinting(font: *const TTF_Font) -> TTF_HintingFlags;
188}
189unsafe extern "C" {
190 #[doc = "Enable Signed Distance Field rendering for a font.\n\nSDF is a technique that helps fonts look sharp even when scaling and\nrotating, and requires special shader support for display.\n\nThis works with Blended APIs, and generates the raw signed distance values\nin the alpha channel of the resulting texture.\n\nThis updates any TTF_Text objects using this font, and clears\nalready-generated glyphs, if any, from the cache.\n\n**Parameter:** font the font to set SDF support on.\n\n**Parameter:** enabled true to enable SDF, false to disable.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontSDF"]
191 pub fn TTF_SetFontSDF(font: *mut TTF_Font, enabled: bool) -> bool;
192}
193unsafe extern "C" {
194 #[doc = "Query whether Signed Distance Field rendering is enabled for a font.\n\n**Parameter:** font the font to query.\n\n**Returns:** true if enabled, false otherwise.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontSDF"]
195 pub fn TTF_GetFontSDF(font: *const TTF_Font) -> bool;
196}
197unsafe extern "C" {
198 #[doc = "Query a font's weight, in terms of the lightness/heaviness of the strokes.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's current weight.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.2.2."]
199 pub fn TTF_GetFontWeight(font: *const TTF_Font) -> core::ffi::c_int;
200}
201impl TTF_HorizontalAlignment {
202 pub const TTF_HORIZONTAL_ALIGN_INVALID: TTF_HorizontalAlignment = TTF_HorizontalAlignment(-1);
203 pub const TTF_HORIZONTAL_ALIGN_LEFT: TTF_HorizontalAlignment = TTF_HorizontalAlignment(0);
204 pub const TTF_HORIZONTAL_ALIGN_CENTER: TTF_HorizontalAlignment = TTF_HorizontalAlignment(1);
205 pub const TTF_HORIZONTAL_ALIGN_RIGHT: TTF_HorizontalAlignment = TTF_HorizontalAlignment(2);
206}
207#[repr(transparent)]
208#[doc = "The horizontal alignment used when rendering wrapped text.\n\n**Available Since:** This enum is available since SDL_ttf 3.0.0."]
209#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
210pub struct TTF_HorizontalAlignment(pub core::ffi::c_int);
211unsafe extern "C" {
212 #[doc = "Set a font's current wrap alignment option.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to set a new wrap alignment option on.\n\n**Parameter:** align the new wrap alignment option.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontWrapAlignment"]
213 pub fn TTF_SetFontWrapAlignment(font: *mut TTF_Font, align: TTF_HorizontalAlignment);
214}
215unsafe extern "C" {
216 #[doc = "Query a font's current wrap alignment option.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's current wrap alignment option.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontWrapAlignment"]
217 pub fn TTF_GetFontWrapAlignment(font: *const TTF_Font) -> TTF_HorizontalAlignment;
218}
219unsafe extern "C" {
220 #[doc = "Query the total height of a font.\n\nThis is usually equal to point size.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's height.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
221 pub fn TTF_GetFontHeight(font: *const TTF_Font) -> core::ffi::c_int;
222}
223unsafe extern "C" {
224 #[doc = "Query the offset from the baseline to the top of a font.\n\nThis is a positive value, relative to the baseline.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's ascent.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
225 pub fn TTF_GetFontAscent(font: *const TTF_Font) -> core::ffi::c_int;
226}
227unsafe extern "C" {
228 #[doc = "Query the offset from the baseline to the bottom of a font.\n\nThis is a negative value, relative to the baseline.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's descent.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
229 pub fn TTF_GetFontDescent(font: *const TTF_Font) -> core::ffi::c_int;
230}
231unsafe extern "C" {
232 #[doc = "Set the spacing between lines of text for a font.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to modify.\n\n**Parameter:** lineskip the new line spacing for the font.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontLineSkip"]
233 pub fn TTF_SetFontLineSkip(font: *mut TTF_Font, lineskip: core::ffi::c_int);
234}
235unsafe extern "C" {
236 #[doc = "Query the spacing between lines of text for a font.\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's recommended spacing.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontLineSkip"]
237 pub fn TTF_GetFontLineSkip(font: *const TTF_Font) -> core::ffi::c_int;
238}
239unsafe extern "C" {
240 #[doc = "Set if kerning is enabled for a font.\n\nNewly-opened fonts default to allowing kerning. This is generally a good\npolicy unless you have a strong reason to disable it, as it tends to\nproduce better rendering (with kerning disabled, some fonts might render\nthe word `kerning` as something that looks like `keming` for example).\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to set kerning on.\n\n**Parameter:** enabled true to enable kerning, false to disable.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetFontKerning"]
241 pub fn TTF_SetFontKerning(font: *mut TTF_Font, enabled: bool);
242}
243unsafe extern "C" {
244 #[doc = "Query whether or not kerning is enabled for a font.\n\n**Parameter:** font the font to query.\n\n**Returns:** true if kerning is enabled, false otherwise.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontKerning"]
245 pub fn TTF_GetFontKerning(font: *const TTF_Font) -> bool;
246}
247unsafe extern "C" {
248 #[doc = "Query whether a font is fixed-width.\n\nA \"fixed-width\" font means all glyphs are the same width across; a\nlowercase 'i' will be the same size across as a capital 'W', for example.\nThis is common for terminals and text editors, and other apps that treat\ntext as a grid. Most other things (WYSIWYG word processors, web pages, etc)\nare more likely to not be fixed-width in most cases.\n\n**Parameter:** font the font to query.\n\n**Returns:** true if the font is fixed-width, false otherwise.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
249 pub fn TTF_FontIsFixedWidth(font: *const TTF_Font) -> bool;
250}
251unsafe extern "C" {
252 #[doc = "Query whether a font is scalable or not.\n\nScalability lets us distinguish between outline and bitmap fonts.\n\n**Parameter:** font the font to query.\n\n**Returns:** true if the font is scalable, false otherwise.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontSDF"]
253 pub fn TTF_FontIsScalable(font: *const TTF_Font) -> bool;
254}
255unsafe extern "C" {
256 #[doc = "Query a font's family name.\n\nThis string is dictated by the contents of the font file.\n\nNote that the returned string is to internal storage, and should not be\nmodified or free'd by the caller. The string becomes invalid, with the rest\nof the font, when `font` is handed to TTF_CloseFont().\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's family name.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
257 pub fn TTF_GetFontFamilyName(font: *const TTF_Font) -> *const core::ffi::c_char;
258}
259unsafe extern "C" {
260 #[doc = "Query a font's style name.\n\nThis string is dictated by the contents of the font file.\n\nNote that the returned string is to internal storage, and should not be\nmodified or free'd by the caller. The string becomes invalid, with the rest\nof the font, when `font` is handed to TTF_CloseFont().\n\n**Parameter:** font the font to query.\n\n**Returns:** the font's style name.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
261 pub fn TTF_GetFontStyleName(font: *const TTF_Font) -> *const core::ffi::c_char;
262}
263impl TTF_Direction {
264 pub const TTF_DIRECTION_INVALID: TTF_Direction = TTF_Direction(0);
265 #[doc = "< Left to Right"]
266 pub const TTF_DIRECTION_LTR: TTF_Direction = TTF_Direction(4);
267 #[doc = "< Right to Left"]
268 pub const TTF_DIRECTION_RTL: TTF_Direction = TTF_Direction(5);
269 #[doc = "< Top to Bottom"]
270 pub const TTF_DIRECTION_TTB: TTF_Direction = TTF_Direction(6);
271 #[doc = "< Bottom to Top"]
272 pub const TTF_DIRECTION_BTT: TTF_Direction = TTF_Direction(7);
273}
274#[repr(transparent)]
275#[doc = "Direction flags\n\nThe values here are chosen to match\n[hb_direction_t](https://harfbuzz.github.io/harfbuzz-hb-common.html#hb-direction-t)\n.\n\n**Available Since:** This enum is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetFontDirection"]
276#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
277pub struct TTF_Direction(pub core::ffi::c_uint);
278unsafe extern "C" {
279 #[doc = "Set the direction to be used for text shaping by a font.\n\nThis function only supports left-to-right text shaping if SDL_ttf was not\nbuilt with HarfBuzz support.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to modify.\n\n**Parameter:** direction the new direction for text to flow.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
280 pub fn TTF_SetFontDirection(font: *mut TTF_Font, direction: TTF_Direction) -> bool;
281}
282unsafe extern "C" {
283 #[doc = "Get the direction to be used for text shaping by a font.\n\nThis defaults to TTF_DIRECTION_INVALID if it hasn't been set.\n\n**Parameter:** font the font to query.\n\n**Returns:** the direction to be used for text shaping.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
284 pub fn TTF_GetFontDirection(font: *mut TTF_Font) -> TTF_Direction;
285}
286unsafe extern "C" {
287 #[doc = "Set additional space in pixels to be applied between any two rendered\ncharacters.\n\nThe spacing value is applied uniformly after each character, in addition to\nthe normal glyph's advance.\n\nSpacing may be a negative value, in which case it will reduce the distance\ninstead.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to specify a direction for.\n\n**Parameter:** spacing the new additional glyph spacing for the font.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.4.0."]
288 pub fn TTF_SetFontCharSpacing(font: *mut TTF_Font, spacing: core::ffi::c_int) -> bool;
289}
290unsafe extern "C" {
291 #[doc = "Get the additional character spacing in pixels to be applied between any\ntwo rendered characters.\n\nThis defaults to 0 if it hasn't been set.\n\n**Parameter:** font the font to query.\n\n**Returns:** the character spacing in pixels.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.4.0."]
292 pub fn TTF_GetFontCharSpacing(font: *mut TTF_Font) -> core::ffi::c_int;
293}
294unsafe extern "C" {
295 #[doc = "Convert from a 4 character string to a 32-bit tag.\n\n**Parameter:** string the 4 character string to convert.\n\n**Returns:** the 32-bit representation of the string.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_TagToString"]
296 pub fn TTF_StringToTag(string: *const core::ffi::c_char) -> Uint32;
297}
298unsafe extern "C" {
299 #[doc = "Convert from a 32-bit tag to a 4 character string.\n\n**Parameter:** tag the 32-bit tag to convert.\n\n**Parameter:** string a pointer filled in with the 4 character representation of\nthe tag.\n\n**Parameter:** size the size of the buffer pointed at by string, should be at least\n4.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_TagToString"]
300 pub fn TTF_TagToString(tag: Uint32, string: *mut core::ffi::c_char, size: usize);
301}
302unsafe extern "C" {
303 #[doc = "Set the script to be used for text shaping by a font.\n\nThis returns false if SDL_ttf isn't built with HarfBuzz support.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to modify.\n\n**Parameter:** script an\n[ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)\n.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_StringToTag"]
304 pub fn TTF_SetFontScript(font: *mut TTF_Font, script: Uint32) -> bool;
305}
306unsafe extern "C" {
307 #[doc = "Get the script used for text shaping a font.\n\n**Parameter:** font the font to query.\n\n**Returns:** an\n[ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)\nor 0 if a script hasn't been set.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_TagToString"]
308 pub fn TTF_GetFontScript(font: *mut TTF_Font) -> Uint32;
309}
310unsafe extern "C" {
311 #[doc = "Get the script used by a 32-bit codepoint.\n\n**Parameter:** ch the character code to check.\n\n**Returns:** an\n[ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)\non success, or 0 on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function is thread-safe.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_TagToString"]
312 pub fn TTF_GetGlyphScript(ch: Uint32) -> Uint32;
313}
314unsafe extern "C" {
315 #[doc = "Set language to be used for text shaping by a font.\n\nIf SDL_ttf was not built with HarfBuzz support, this function returns\nfalse.\n\nThis updates any TTF_Text objects using this font.\n\n**Parameter:** font the font to specify a language for.\n\n**Parameter:** language_bcp47 a null-terminated string containing the desired\nlanguage's BCP47 code. Or null to reset the value.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
316 pub fn TTF_SetFontLanguage(
317 font: *mut TTF_Font,
318 language_bcp47: *const core::ffi::c_char,
319 ) -> bool;
320}
321unsafe extern "C" {
322 #[doc = "Check whether a glyph is provided by the font for a UNICODE codepoint.\n\n**Parameter:** font the font to query.\n\n**Parameter:** ch the codepoint to check.\n\n**Returns:** true if font provides a glyph for this character, false if not.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
323 pub fn TTF_FontHasGlyph(font: *mut TTF_Font, ch: Uint32) -> bool;
324}
325impl TTF_ImageType {
326 pub const TTF_IMAGE_INVALID: TTF_ImageType = TTF_ImageType(0);
327 #[doc = "< The color channels are white"]
328 pub const TTF_IMAGE_ALPHA: TTF_ImageType = TTF_ImageType(1);
329 #[doc = "< The color channels have image data"]
330 pub const TTF_IMAGE_COLOR: TTF_ImageType = TTF_ImageType(2);
331 #[doc = "< The alpha channel has signed distance field information"]
332 pub const TTF_IMAGE_SDF: TTF_ImageType = TTF_ImageType(3);
333}
334#[repr(transparent)]
335#[doc = "The type of data in a glyph image\n\n**Available Since:** This enum is available since SDL_ttf 3.0.0."]
336#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
337pub struct TTF_ImageType(pub core::ffi::c_uint);
338unsafe extern "C" {
339 #[doc = "Get the pixel image for a UNICODE codepoint.\n\n**Parameter:** font the font to query.\n\n**Parameter:** ch the codepoint to check.\n\n**Parameter:** image_type a pointer filled in with the glyph image type, may be\nNULL.\n\n**Returns:** an SDL_Surface containing the glyph, or NULL on failure; call\nSDL_GetError() for more information.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
340 pub fn TTF_GetGlyphImage(
341 font: *mut TTF_Font,
342 ch: Uint32,
343 image_type: *mut TTF_ImageType,
344 ) -> *mut SDL_Surface;
345}
346unsafe extern "C" {
347 #[doc = "Get the pixel image for a character index.\n\nThis is useful for text engine implementations, which can call this with\nthe `glyph_index` in a TTF_CopyOperation\n\n**Parameter:** font the font to query.\n\n**Parameter:** glyph_index the index of the glyph to return.\n\n**Parameter:** image_type a pointer filled in with the glyph image type, may be\nNULL.\n\n**Returns:** an SDL_Surface containing the glyph, or NULL on failure; call\nSDL_GetError() for more information.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
348 pub fn TTF_GetGlyphImageForIndex(
349 font: *mut TTF_Font,
350 glyph_index: Uint32,
351 image_type: *mut TTF_ImageType,
352 ) -> *mut SDL_Surface;
353}
354unsafe extern "C" {
355 #[doc = "Query the metrics (dimensions) of a font's glyph for a UNICODE codepoint.\n\nTo understand what these metrics mean, here is a useful link:\n\nhttps://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html\n\n**Parameter:** font the font to query.\n\n**Parameter:** ch the codepoint to check.\n\n**Parameter:** minx a pointer filled in with the minimum x coordinate of the glyph\nfrom the left edge of its bounding box. This value may be\nnegative.\n\n**Parameter:** maxx a pointer filled in with the maximum x coordinate of the glyph\nfrom the left edge of its bounding box.\n\n**Parameter:** miny a pointer filled in with the minimum y coordinate of the glyph\nfrom the bottom edge of its bounding box. This value may be\nnegative.\n\n**Parameter:** maxy a pointer filled in with the maximum y coordinate of the glyph\nfrom the bottom edge of its bounding box.\n\n**Parameter:** advance a pointer filled in with the distance to the next glyph from\nthe left edge of this glyph's bounding box.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
356 pub fn TTF_GetGlyphMetrics(
357 font: *mut TTF_Font,
358 ch: Uint32,
359 minx: *mut core::ffi::c_int,
360 maxx: *mut core::ffi::c_int,
361 miny: *mut core::ffi::c_int,
362 maxy: *mut core::ffi::c_int,
363 advance: *mut core::ffi::c_int,
364 ) -> bool;
365}
366unsafe extern "C" {
367 #[doc = "Query the kerning size between the glyphs of two UNICODE codepoints.\n\n**Parameter:** font the font to query.\n\n**Parameter:** previous_ch the previous codepoint.\n\n**Parameter:** ch the current codepoint.\n\n**Parameter:** kerning a pointer filled in with the kerning size between the two\nglyphs, in pixels, may be NULL.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
368 pub fn TTF_GetGlyphKerning(
369 font: *mut TTF_Font,
370 previous_ch: Uint32,
371 ch: Uint32,
372 kerning: *mut core::ffi::c_int,
373 ) -> bool;
374}
375unsafe extern "C" {
376 #[doc = "Calculate the dimensions of a rendered string of UTF-8 text.\n\nThis will report the width and height, in pixels, of the space that the\nspecified string will take to fully render.\n\n**Parameter:** font the font to query.\n\n**Parameter:** text text to calculate, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** w will be filled with width, in pixels, on return.\n\n**Parameter:** h will be filled with height, in pixels, on return.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
377 pub fn TTF_GetStringSize(
378 font: *mut TTF_Font,
379 text: *const core::ffi::c_char,
380 length: usize,
381 w: *mut core::ffi::c_int,
382 h: *mut core::ffi::c_int,
383 ) -> bool;
384}
385unsafe extern "C" {
386 #[doc = "Calculate the dimensions of a rendered string of UTF-8 text.\n\nThis will report the width and height, in pixels, of the space that the\nspecified string will take to fully render.\n\nText is wrapped to multiple lines on line endings and on word boundaries if\nit extends beyond `wrap_width` in pixels.\n\nIf wrap_width is 0, this function will only wrap on newline characters.\n\n**Parameter:** font the font to query.\n\n**Parameter:** text text to calculate, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** wrap_width the maximum width or 0 to wrap on newline characters.\n\n**Parameter:** w will be filled with width, in pixels, on return.\n\n**Parameter:** h will be filled with height, in pixels, on return.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
387 pub fn TTF_GetStringSizeWrapped(
388 font: *mut TTF_Font,
389 text: *const core::ffi::c_char,
390 length: usize,
391 wrap_width: core::ffi::c_int,
392 w: *mut core::ffi::c_int,
393 h: *mut core::ffi::c_int,
394 ) -> bool;
395}
396unsafe extern "C" {
397 #[doc = "Calculate how much of a UTF-8 string will fit in a given width.\n\nThis reports the number of characters that can be rendered before reaching\n`max_width`.\n\nThis does not need to render the string to do this calculation.\n\n**Parameter:** font the font to query.\n\n**Parameter:** text text to calculate, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** max_width maximum width, in pixels, available for the string, or 0\nfor unbounded width.\n\n**Parameter:** measured_width a pointer filled in with the width, in pixels, of the\nstring that will fit, may be NULL.\n\n**Parameter:** measured_length a pointer filled in with the length, in bytes, of\nthe string that will fit, may be NULL.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
398 pub fn TTF_MeasureString(
399 font: *mut TTF_Font,
400 text: *const core::ffi::c_char,
401 length: usize,
402 max_width: core::ffi::c_int,
403 measured_width: *mut core::ffi::c_int,
404 measured_length: *mut usize,
405 ) -> bool;
406}
407unsafe extern "C" {
408 #[doc = "Render UTF-8 text at fast quality to a new 8-bit surface.\n\nThis function will allocate a new 8-bit, palettized surface. The surface's\n0 pixel will be the colorkey, giving a transparent background. The 1 pixel\nwill be set to the text color.\n\nThis will not word-wrap the string; you'll get a surface with a single line\nof text, as long as the string requires. You can use\nTTF_RenderText_Solid_Wrapped() instead if you need to wrap the output to\nmultiple lines.\n\nThis will not wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Shaded,\nTTF_RenderText_Blended, and TTF_RenderText_LCD.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Returns:** a new 8-bit, palettized surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended\n\n**See Also:** TTF_RenderText_LCD\n\n**See Also:** TTF_RenderText_Shaded\n\n**See Also:** TTF_RenderText_Solid\n\n**See Also:** TTF_RenderText_Solid_Wrapped"]
409 pub fn TTF_RenderText_Solid(
410 font: *mut TTF_Font,
411 text: *const core::ffi::c_char,
412 length: usize,
413 fg: SDL_Color,
414 ) -> *mut SDL_Surface;
415}
416unsafe extern "C" {
417 #[doc = "Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.\n\nThis function will allocate a new 8-bit, palettized surface. The surface's\n0 pixel will be the colorkey, giving a transparent background. The 1 pixel\nwill be set to the text color.\n\nText is wrapped to multiple lines on line endings and on word boundaries if\nit extends beyond `wrapLength` in pixels.\n\nIf wrapLength is 0, this function will only wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Shaded_Wrapped,\nTTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** wrapLength the maximum width of the text surface or 0 to wrap on\nnewline characters.\n\n**Returns:** a new 8-bit, palettized surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended_Wrapped\n\n**See Also:** TTF_RenderText_LCD_Wrapped\n\n**See Also:** TTF_RenderText_Shaded_Wrapped\n\n**See Also:** TTF_RenderText_Solid"]
418 pub fn TTF_RenderText_Solid_Wrapped(
419 font: *mut TTF_Font,
420 text: *const core::ffi::c_char,
421 length: usize,
422 fg: SDL_Color,
423 wrapLength: core::ffi::c_int,
424 ) -> *mut SDL_Surface;
425}
426unsafe extern "C" {
427 #[doc = "Render a single 32-bit glyph at fast quality to a new 8-bit surface.\n\nThis function will allocate a new 8-bit, palettized surface. The surface's\n0 pixel will be the colorkey, giving a transparent background. The 1 pixel\nwill be set to the text color.\n\nThe glyph is rendered without any padding or centering in the X direction,\nand aligned normally in the Y direction.\n\nYou can render at other quality levels with TTF_RenderGlyph_Shaded,\nTTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** ch the character to render.\n\n**Parameter:** fg the foreground color for the text.\n\n**Returns:** a new 8-bit, palettized surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderGlyph_Blended\n\n**See Also:** TTF_RenderGlyph_LCD\n\n**See Also:** TTF_RenderGlyph_Shaded"]
428 pub fn TTF_RenderGlyph_Solid(
429 font: *mut TTF_Font,
430 ch: Uint32,
431 fg: SDL_Color,
432 ) -> *mut SDL_Surface;
433}
434unsafe extern "C" {
435 #[doc = "Render UTF-8 text at high quality to a new 8-bit surface.\n\nThis function will allocate a new 8-bit, palettized surface. The surface's\n0 pixel will be the specified background color, while other pixels have\nvarying degrees of the foreground color. This function returns the new\nsurface, or NULL if there was an error.\n\nThis will not word-wrap the string; you'll get a surface with a single line\nof text, as long as the string requires. You can use\nTTF_RenderText_Shaded_Wrapped() instead if you need to wrap the output to\nmultiple lines.\n\nThis will not wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Solid,\nTTF_RenderText_Blended, and TTF_RenderText_LCD.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** bg the background color for the text.\n\n**Returns:** a new 8-bit, palettized surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended\n\n**See Also:** TTF_RenderText_LCD\n\n**See Also:** TTF_RenderText_Shaded_Wrapped\n\n**See Also:** TTF_RenderText_Solid"]
436 pub fn TTF_RenderText_Shaded(
437 font: *mut TTF_Font,
438 text: *const core::ffi::c_char,
439 length: usize,
440 fg: SDL_Color,
441 bg: SDL_Color,
442 ) -> *mut SDL_Surface;
443}
444unsafe extern "C" {
445 #[doc = "Render word-wrapped UTF-8 text at high quality to a new 8-bit surface.\n\nThis function will allocate a new 8-bit, palettized surface. The surface's\n0 pixel will be the specified background color, while other pixels have\nvarying degrees of the foreground color. This function returns the new\nsurface, or NULL if there was an error.\n\nText is wrapped to multiple lines on line endings and on word boundaries if\nit extends beyond `wrap_width` in pixels.\n\nIf wrap_width is 0, this function will only wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Solid_Wrapped,\nTTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** bg the background color for the text.\n\n**Parameter:** wrap_width the maximum width of the text surface or 0 to wrap on\nnewline characters.\n\n**Returns:** a new 8-bit, palettized surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended_Wrapped\n\n**See Also:** TTF_RenderText_LCD_Wrapped\n\n**See Also:** TTF_RenderText_Shaded\n\n**See Also:** TTF_RenderText_Solid_Wrapped"]
446 pub fn TTF_RenderText_Shaded_Wrapped(
447 font: *mut TTF_Font,
448 text: *const core::ffi::c_char,
449 length: usize,
450 fg: SDL_Color,
451 bg: SDL_Color,
452 wrap_width: core::ffi::c_int,
453 ) -> *mut SDL_Surface;
454}
455unsafe extern "C" {
456 #[doc = "Render a single UNICODE codepoint at high quality to a new 8-bit surface.\n\nThis function will allocate a new 8-bit, palettized surface. The surface's\n0 pixel will be the specified background color, while other pixels have\nvarying degrees of the foreground color. This function returns the new\nsurface, or NULL if there was an error.\n\nThe glyph is rendered without any padding or centering in the X direction,\nand aligned normally in the Y direction.\n\nYou can render at other quality levels with TTF_RenderGlyph_Solid,\nTTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** ch the codepoint to render.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** bg the background color for the text.\n\n**Returns:** a new 8-bit, palettized surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderGlyph_Blended\n\n**See Also:** TTF_RenderGlyph_LCD\n\n**See Also:** TTF_RenderGlyph_Solid"]
457 pub fn TTF_RenderGlyph_Shaded(
458 font: *mut TTF_Font,
459 ch: Uint32,
460 fg: SDL_Color,
461 bg: SDL_Color,
462 ) -> *mut SDL_Surface;
463}
464unsafe extern "C" {
465 #[doc = "Render UTF-8 text at high quality to a new ARGB surface.\n\nThis function will allocate a new 32-bit, ARGB surface, using alpha\nblending to dither the font with the given color. This function returns the\nnew surface, or NULL if there was an error.\n\nThis will not word-wrap the string; you'll get a surface with a single line\nof text, as long as the string requires. You can use\nTTF_RenderText_Blended_Wrapped() instead if you need to wrap the output to\nmultiple lines.\n\nThis will not wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Solid,\nTTF_RenderText_Shaded, and TTF_RenderText_LCD.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Returns:** a new 32-bit, ARGB surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended_Wrapped\n\n**See Also:** TTF_RenderText_LCD\n\n**See Also:** TTF_RenderText_Shaded\n\n**See Also:** TTF_RenderText_Solid"]
466 pub fn TTF_RenderText_Blended(
467 font: *mut TTF_Font,
468 text: *const core::ffi::c_char,
469 length: usize,
470 fg: SDL_Color,
471 ) -> *mut SDL_Surface;
472}
473unsafe extern "C" {
474 #[doc = "Render word-wrapped UTF-8 text at high quality to a new ARGB surface.\n\nThis function will allocate a new 32-bit, ARGB surface, using alpha\nblending to dither the font with the given color. This function returns the\nnew surface, or NULL if there was an error.\n\nText is wrapped to multiple lines on line endings and on word boundaries if\nit extends beyond `wrap_width` in pixels.\n\nIf wrap_width is 0, this function will only wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Solid_Wrapped,\nTTF_RenderText_Shaded_Wrapped, and TTF_RenderText_LCD_Wrapped.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** wrap_width the maximum width of the text surface or 0 to wrap on\nnewline characters.\n\n**Returns:** a new 32-bit, ARGB surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended\n\n**See Also:** TTF_RenderText_LCD_Wrapped\n\n**See Also:** TTF_RenderText_Shaded_Wrapped\n\n**See Also:** TTF_RenderText_Solid_Wrapped"]
475 pub fn TTF_RenderText_Blended_Wrapped(
476 font: *mut TTF_Font,
477 text: *const core::ffi::c_char,
478 length: usize,
479 fg: SDL_Color,
480 wrap_width: core::ffi::c_int,
481 ) -> *mut SDL_Surface;
482}
483unsafe extern "C" {
484 #[doc = "Render a single UNICODE codepoint at high quality to a new ARGB surface.\n\nThis function will allocate a new 32-bit, ARGB surface, using alpha\nblending to dither the font with the given color. This function returns the\nnew surface, or NULL if there was an error.\n\nThe glyph is rendered without any padding or centering in the X direction,\nand aligned normally in the Y direction.\n\nYou can render at other quality levels with TTF_RenderGlyph_Solid,\nTTF_RenderGlyph_Shaded, and TTF_RenderGlyph_LCD.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** ch the codepoint to render.\n\n**Parameter:** fg the foreground color for the text.\n\n**Returns:** a new 32-bit, ARGB surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderGlyph_LCD\n\n**See Also:** TTF_RenderGlyph_Shaded\n\n**See Also:** TTF_RenderGlyph_Solid"]
485 pub fn TTF_RenderGlyph_Blended(
486 font: *mut TTF_Font,
487 ch: Uint32,
488 fg: SDL_Color,
489 ) -> *mut SDL_Surface;
490}
491unsafe extern "C" {
492 #[doc = "Render UTF-8 text at LCD subpixel quality to a new ARGB surface.\n\nThis function will allocate a new 32-bit, ARGB surface, and render\nalpha-blended text using FreeType's LCD subpixel rendering. This function\nreturns the new surface, or NULL if there was an error.\n\nThis will not word-wrap the string; you'll get a surface with a single line\nof text, as long as the string requires. You can use\nTTF_RenderText_LCD_Wrapped() instead if you need to wrap the output to\nmultiple lines.\n\nThis will not wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Solid,\nTTF_RenderText_Shaded, and TTF_RenderText_Blended.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** bg the background color for the text.\n\n**Returns:** a new 32-bit, ARGB surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended\n\n**See Also:** TTF_RenderText_LCD_Wrapped\n\n**See Also:** TTF_RenderText_Shaded\n\n**See Also:** TTF_RenderText_Solid"]
493 pub fn TTF_RenderText_LCD(
494 font: *mut TTF_Font,
495 text: *const core::ffi::c_char,
496 length: usize,
497 fg: SDL_Color,
498 bg: SDL_Color,
499 ) -> *mut SDL_Surface;
500}
501unsafe extern "C" {
502 #[doc = "Render word-wrapped UTF-8 text at LCD subpixel quality to a new ARGB\nsurface.\n\nThis function will allocate a new 32-bit, ARGB surface, and render\nalpha-blended text using FreeType's LCD subpixel rendering. This function\nreturns the new surface, or NULL if there was an error.\n\nText is wrapped to multiple lines on line endings and on word boundaries if\nit extends beyond `wrap_width` in pixels.\n\nIf wrap_width is 0, this function will only wrap on newline characters.\n\nYou can render at other quality levels with TTF_RenderText_Solid_Wrapped,\nTTF_RenderText_Shaded_Wrapped, and TTF_RenderText_Blended_Wrapped.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text text to render, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** bg the background color for the text.\n\n**Parameter:** wrap_width the maximum width of the text surface or 0 to wrap on\nnewline characters.\n\n**Returns:** a new 32-bit, ARGB surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderText_Blended_Wrapped\n\n**See Also:** TTF_RenderText_LCD\n\n**See Also:** TTF_RenderText_Shaded_Wrapped\n\n**See Also:** TTF_RenderText_Solid_Wrapped"]
503 pub fn TTF_RenderText_LCD_Wrapped(
504 font: *mut TTF_Font,
505 text: *const core::ffi::c_char,
506 length: usize,
507 fg: SDL_Color,
508 bg: SDL_Color,
509 wrap_width: core::ffi::c_int,
510 ) -> *mut SDL_Surface;
511}
512unsafe extern "C" {
513 #[doc = "Render a single UNICODE codepoint at LCD subpixel quality to a new ARGB\nsurface.\n\nThis function will allocate a new 32-bit, ARGB surface, and render\nalpha-blended text using FreeType's LCD subpixel rendering. This function\nreturns the new surface, or NULL if there was an error.\n\nThe glyph is rendered without any padding or centering in the X direction,\nand aligned normally in the Y direction.\n\nYou can render at other quality levels with TTF_RenderGlyph_Solid,\nTTF_RenderGlyph_Shaded, and TTF_RenderGlyph_Blended.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** ch the codepoint to render.\n\n**Parameter:** fg the foreground color for the text.\n\n**Parameter:** bg the background color for the text.\n\n**Returns:** a new 32-bit, ARGB surface, or NULL if there was an error.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_RenderGlyph_Blended\n\n**See Also:** TTF_RenderGlyph_Shaded\n\n**See Also:** TTF_RenderGlyph_Solid"]
514 pub fn TTF_RenderGlyph_LCD(
515 font: *mut TTF_Font,
516 ch: Uint32,
517 fg: SDL_Color,
518 bg: SDL_Color,
519 ) -> *mut SDL_Surface;
520}
521#[repr(C)]
522#[derive(Debug, Copy, Clone)]
523pub struct TTF_TextEngine {
524 _unused: [u8; 0],
525}
526#[repr(C)]
527#[derive(Debug, Copy, Clone)]
528pub struct TTF_TextData {
529 _unused: [u8; 0],
530}
531#[doc = "Text created with TTF_CreateText()\n\n**Available Since:** This struct is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateText\n\n**See Also:** TTF_GetTextProperties\n\n**See Also:** TTF_DestroyText"]
532#[repr(C)]
533#[derive(Debug, Copy, Clone, Hash)]
534pub struct TTF_Text {
535 #[doc = "< A copy of the UTF-8 string that this text object represents, useful for layout, debugging and retrieving substring text. This is updated when the text object is modified and will be freed automatically when the object is destroyed."]
536 pub text: *mut core::ffi::c_char,
537 #[doc = "< The number of lines in the text, 0 if it's empty"]
538 pub num_lines: core::ffi::c_int,
539 #[doc = "< Application reference count, used when freeing surface"]
540 pub refcount: core::ffi::c_int,
541 #[doc = "< Private"]
542 pub internal: *mut TTF_TextData,
543}
544#[allow(clippy::unnecessary_operation, clippy::identity_op)]
545const _: () = {
546 ["Size of TTF_Text"][::core::mem::size_of::<TTF_Text>() - 24usize];
547 ["Alignment of TTF_Text"][::core::mem::align_of::<TTF_Text>() - 8usize];
548 ["Offset of field: TTF_Text::text"][::core::mem::offset_of!(TTF_Text, text) - 0usize];
549 ["Offset of field: TTF_Text::num_lines"][::core::mem::offset_of!(TTF_Text, num_lines) - 8usize];
550 ["Offset of field: TTF_Text::refcount"][::core::mem::offset_of!(TTF_Text, refcount) - 12usize];
551 ["Offset of field: TTF_Text::internal"][::core::mem::offset_of!(TTF_Text, internal) - 16usize];
552};
553impl Default for TTF_Text {
554 fn default() -> Self {
555 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
556 unsafe {
557 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
558 s.assume_init()
559 }
560 }
561}
562unsafe extern "C" {
563 #[doc = "Create a text engine for drawing text on SDL surfaces.\n\n**Returns:** a TTF_TextEngine object or NULL on failure; call SDL_GetError()\nfor more information.\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_DestroySurfaceTextEngine\n\n**See Also:** TTF_DrawSurfaceText"]
564 pub fn TTF_CreateSurfaceTextEngine() -> *mut TTF_TextEngine;
565}
566unsafe extern "C" {
567 #[doc = "Draw text to an SDL surface.\n\n`text` must have been created using a TTF_TextEngine from\nTTF_CreateSurfaceTextEngine().\n\n**Parameter:** text the text to draw.\n\n**Parameter:** x the x coordinate in pixels, positive from the left edge towards\nthe right.\n\n**Parameter:** y the y coordinate in pixels, positive from the top edge towards the\nbottom.\n\n**Parameter:** surface the surface to draw on.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateSurfaceTextEngine\n\n**See Also:** TTF_CreateText"]
568 pub fn TTF_DrawSurfaceText(
569 text: *mut TTF_Text,
570 x: core::ffi::c_int,
571 y: core::ffi::c_int,
572 surface: *mut SDL_Surface,
573 ) -> bool;
574}
575unsafe extern "C" {
576 #[doc = "Destroy a text engine created for drawing text on SDL surfaces.\n\nAll text created by this engine should be destroyed before calling this\nfunction.\n\n**Parameter:** engine a TTF_TextEngine object created with\nTTF_CreateSurfaceTextEngine().\n\n**Thread Safety:** This function should be called on the thread that created the\nengine.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateSurfaceTextEngine"]
577 pub fn TTF_DestroySurfaceTextEngine(engine: *mut TTF_TextEngine);
578}
579unsafe extern "C" {
580 #[doc = "Create a text engine for drawing text on an SDL renderer.\n\n**Parameter:** renderer the renderer to use for creating textures and drawing text.\n\n**Returns:** a TTF_TextEngine object or NULL on failure; call SDL_GetError()\nfor more information.\n\n**Thread Safety:** This function should be called on the thread that created the\nrenderer.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_DestroyRendererTextEngine\n\n**See Also:** TTF_DrawRendererText\n\n**See Also:** TTF_CreateRendererTextEngineWithProperties"]
581 pub fn TTF_CreateRendererTextEngine(renderer: *mut SDL_Renderer) -> *mut TTF_TextEngine;
582}
583unsafe extern "C" {
584 #[doc = "Create a text engine for drawing text on an SDL renderer, with the\nspecified properties.\n\nThese are the supported properties:\n\n- `TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER`: the renderer to use for\ncreating textures and drawing text\n- `TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER`: the size of\nthe texture atlas\n\n**Parameter:** props the properties to use.\n\n**Returns:** a TTF_TextEngine object or NULL on failure; call SDL_GetError()\nfor more information.\n\n**Thread Safety:** This function should be called on the thread that created the\nrenderer.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateRendererTextEngine\n\n**See Also:** TTF_DestroyRendererTextEngine\n\n**See Also:** TTF_DrawRendererText"]
585 pub fn TTF_CreateRendererTextEngineWithProperties(
586 props: SDL_PropertiesID,
587 ) -> *mut TTF_TextEngine;
588}
589unsafe extern "C" {
590 #[doc = "Draw text to an SDL renderer.\n\n`text` must have been created using a TTF_TextEngine from\nTTF_CreateRendererTextEngine(), and will draw using the renderer passed to\nthat function.\n\n**Parameter:** text the text to draw.\n\n**Parameter:** x the x coordinate in pixels, positive from the left edge towards\nthe right.\n\n**Parameter:** y the y coordinate in pixels, positive from the top edge towards the\nbottom.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateRendererTextEngine\n\n**See Also:** TTF_CreateText"]
591 pub fn TTF_DrawRendererText(text: *mut TTF_Text, x: f32, y: f32) -> bool;
592}
593unsafe extern "C" {
594 #[doc = "Destroy a text engine created for drawing text on an SDL renderer.\n\nAll text created by this engine should be destroyed before calling this\nfunction.\n\n**Parameter:** engine a TTF_TextEngine object created with\nTTF_CreateRendererTextEngine().\n\n**Thread Safety:** This function should be called on the thread that created the\nengine.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateRendererTextEngine"]
595 pub fn TTF_DestroyRendererTextEngine(engine: *mut TTF_TextEngine);
596}
597unsafe extern "C" {
598 #[doc = "Create a text engine for drawing text with the SDL GPU API.\n\n**Parameter:** device the SDL_GPUDevice to use for creating textures and drawing\ntext.\n\n**Returns:** a TTF_TextEngine object or NULL on failure; call SDL_GetError()\nfor more information.\n\n**Thread Safety:** This function should be called on the thread that created the\ndevice.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateGPUTextEngineWithProperties\n\n**See Also:** TTF_DestroyGPUTextEngine\n\n**See Also:** TTF_GetGPUTextDrawData"]
599 pub fn TTF_CreateGPUTextEngine(device: *mut SDL_GPUDevice) -> *mut TTF_TextEngine;
600}
601unsafe extern "C" {
602 #[doc = "Create a text engine for drawing text with the SDL GPU API, with the\nspecified properties.\n\nThese are the supported properties:\n\n- `TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER`: the SDL_GPUDevice to use for\ncreating textures and drawing text.\n- `TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER`: the size of the\ntexture atlas\n\n**Parameter:** props the properties to use.\n\n**Returns:** a TTF_TextEngine object or NULL on failure; call SDL_GetError()\nfor more information.\n\n**Thread Safety:** This function should be called on the thread that created the\ndevice.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateGPUTextEngine\n\n**See Also:** TTF_DestroyGPUTextEngine\n\n**See Also:** TTF_GetGPUTextDrawData"]
603 pub fn TTF_CreateGPUTextEngineWithProperties(props: SDL_PropertiesID) -> *mut TTF_TextEngine;
604}
605#[doc = "Draw sequence returned by TTF_GetGPUTextDrawData\n\n**Available Since:** This struct is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetGPUTextDrawData"]
606#[repr(C)]
607#[derive(Debug, Copy, Clone, Hash)]
608pub struct TTF_GPUAtlasDrawSequence {
609 #[doc = "< Texture atlas that stores the glyphs"]
610 pub atlas_texture: *mut SDL_GPUTexture,
611 #[doc = "< An array of vertex positions"]
612 pub xy: *mut SDL_FPoint,
613 #[doc = "< An array of normalized texture coordinates for each vertex"]
614 pub uv: *mut SDL_FPoint,
615 #[doc = "< Number of vertices"]
616 pub num_vertices: core::ffi::c_int,
617 #[doc = "< An array of indices into the 'vertices' arrays"]
618 pub indices: *mut core::ffi::c_int,
619 #[doc = "< Number of indices"]
620 pub num_indices: core::ffi::c_int,
621 #[doc = "< The image type of this draw sequence"]
622 pub image_type: TTF_ImageType,
623 #[doc = "< The next sequence (will be NULL in case of the last sequence)"]
624 pub next: *mut TTF_GPUAtlasDrawSequence,
625}
626#[allow(clippy::unnecessary_operation, clippy::identity_op)]
627const _: () = {
628 ["Size of TTF_GPUAtlasDrawSequence"]
629 [::core::mem::size_of::<TTF_GPUAtlasDrawSequence>() - 56usize];
630 ["Alignment of TTF_GPUAtlasDrawSequence"]
631 [::core::mem::align_of::<TTF_GPUAtlasDrawSequence>() - 8usize];
632 ["Offset of field: TTF_GPUAtlasDrawSequence::atlas_texture"]
633 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, atlas_texture) - 0usize];
634 ["Offset of field: TTF_GPUAtlasDrawSequence::xy"]
635 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, xy) - 8usize];
636 ["Offset of field: TTF_GPUAtlasDrawSequence::uv"]
637 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, uv) - 16usize];
638 ["Offset of field: TTF_GPUAtlasDrawSequence::num_vertices"]
639 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, num_vertices) - 24usize];
640 ["Offset of field: TTF_GPUAtlasDrawSequence::indices"]
641 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, indices) - 32usize];
642 ["Offset of field: TTF_GPUAtlasDrawSequence::num_indices"]
643 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, num_indices) - 40usize];
644 ["Offset of field: TTF_GPUAtlasDrawSequence::image_type"]
645 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, image_type) - 44usize];
646 ["Offset of field: TTF_GPUAtlasDrawSequence::next"]
647 [::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, next) - 48usize];
648};
649impl Default for TTF_GPUAtlasDrawSequence {
650 fn default() -> Self {
651 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
652 unsafe {
653 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
654 s.assume_init()
655 }
656 }
657}
658unsafe extern "C" {
659 #[doc = "Get the geometry data needed for drawing the text.\n\n`text` must have been created using a TTF_TextEngine from\nTTF_CreateGPUTextEngine().\n\nThe positive X-axis is taken towards the right and the positive Y-axis is\ntaken upwards for both the vertex and the texture coordinates, i.e, it\nfollows the same convention used by the SDL_GPU API. If you want to use a\ndifferent coordinate system you will need to transform the vertices\nyourself.\n\nIf the text looks blocky use linear filtering.\n\n**Parameter:** text the text to draw.\n\n**Returns:** a NULL terminated linked list of TTF_GPUAtlasDrawSequence objects\nor NULL if the passed text is empty or in case of failure; call\nSDL_GetError() for more information.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateGPUTextEngine\n\n**See Also:** TTF_CreateText"]
660 pub fn TTF_GetGPUTextDrawData(text: *mut TTF_Text) -> *mut TTF_GPUAtlasDrawSequence;
661}
662unsafe extern "C" {
663 #[doc = "Destroy a text engine created for drawing text with the SDL GPU API.\n\nAll text created by this engine should be destroyed before calling this\nfunction.\n\n**Parameter:** engine a TTF_TextEngine object created with\nTTF_CreateGPUTextEngine().\n\n**Thread Safety:** This function should be called on the thread that created the\nengine.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateGPUTextEngine"]
664 pub fn TTF_DestroyGPUTextEngine(engine: *mut TTF_TextEngine);
665}
666impl TTF_GPUTextEngineWinding {
667 pub const TTF_GPU_TEXTENGINE_WINDING_INVALID: TTF_GPUTextEngineWinding =
668 TTF_GPUTextEngineWinding(-1);
669 pub const TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE: TTF_GPUTextEngineWinding =
670 TTF_GPUTextEngineWinding(0);
671 pub const TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE: TTF_GPUTextEngineWinding =
672 TTF_GPUTextEngineWinding(1);
673}
674#[repr(transparent)]
675#[doc = "The winding order of the vertices returned by TTF_GetGPUTextDrawData\n\n**Available Since:** This enum is available since SDL_ttf 3.0.0."]
676#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
677pub struct TTF_GPUTextEngineWinding(pub core::ffi::c_int);
678unsafe extern "C" {
679 #[doc = "Sets the winding order of the vertices returned by TTF_GetGPUTextDrawData\nfor a particular GPU text engine.\n\n**Parameter:** engine a TTF_TextEngine object created with\nTTF_CreateGPUTextEngine().\n\n**Parameter:** winding the new winding order option.\n\n**Thread Safety:** This function should be called on the thread that created the\nengine.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetGPUTextEngineWinding"]
680 pub fn TTF_SetGPUTextEngineWinding(
681 engine: *mut TTF_TextEngine,
682 winding: TTF_GPUTextEngineWinding,
683 );
684}
685unsafe extern "C" {
686 #[doc = "Get the winding order of the vertices returned by TTF_GetGPUTextDrawData\nfor a particular GPU text engine\n\n**Parameter:** engine a TTF_TextEngine object created with\nTTF_CreateGPUTextEngine().\n\n**Returns:** the winding order used by the GPU text engine or\nTTF_GPU_TEXTENGINE_WINDING_INVALID in case of error.\n\n**Thread Safety:** This function should be called on the thread that created the\nengine.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetGPUTextEngineWinding"]
687 pub fn TTF_GetGPUTextEngineWinding(engine: *const TTF_TextEngine) -> TTF_GPUTextEngineWinding;
688}
689unsafe extern "C" {
690 #[doc = "Create a text object from UTF-8 text and a text engine.\n\n**Parameter:** engine the text engine to use when creating the text object, may be\nNULL.\n\n**Parameter:** font the font to render with.\n\n**Parameter:** text the text to use, in UTF-8 encoding.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Returns:** a TTF_Text object or NULL on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\nfont and text engine.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_DestroyText"]
691 pub fn TTF_CreateText(
692 engine: *mut TTF_TextEngine,
693 font: *mut TTF_Font,
694 text: *const core::ffi::c_char,
695 length: usize,
696 ) -> *mut TTF_Text;
697}
698unsafe extern "C" {
699 #[doc = "Get the properties associated with a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Returns:** a valid property ID on success or 0 on failure; call\nSDL_GetError() for more information.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
700 pub fn TTF_GetTextProperties(text: *mut TTF_Text) -> SDL_PropertiesID;
701}
702unsafe extern "C" {
703 #[doc = "Set the text engine used by a text object.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** engine the text engine to use for drawing.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextEngine"]
704 pub fn TTF_SetTextEngine(text: *mut TTF_Text, engine: *mut TTF_TextEngine) -> bool;
705}
706unsafe extern "C" {
707 #[doc = "Get the text engine used by a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Returns:** the TTF_TextEngine used by the text on success or NULL on failure;\ncall SDL_GetError() for more information.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetTextEngine"]
708 pub fn TTF_GetTextEngine(text: *mut TTF_Text) -> *mut TTF_TextEngine;
709}
710unsafe extern "C" {
711 #[doc = "Set the font used by a text object.\n\nWhen a text object has a font, any changes to the font will automatically\nregenerate the text. If you set the font to NULL, the text will continue to\nrender but changes to the font will no longer affect the text.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** font the font to use, may be NULL.\n\n**Returns:** false if the text pointer is null; otherwise, true. call\nSDL_GetError() for more information.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextFont"]
712 pub fn TTF_SetTextFont(text: *mut TTF_Text, font: *mut TTF_Font) -> bool;
713}
714unsafe extern "C" {
715 #[doc = "Get the font used by a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Returns:** the TTF_Font used by the text on success or NULL on failure; call\nSDL_GetError() for more information.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetTextFont"]
716 pub fn TTF_GetTextFont(text: *mut TTF_Text) -> *mut TTF_Font;
717}
718unsafe extern "C" {
719 #[doc = "Set the direction to be used for text shaping a text object.\n\nThis function only supports left-to-right text shaping if SDL_ttf was not\nbuilt with HarfBuzz support.\n\n**Parameter:** text the text to modify.\n\n**Parameter:** direction the new direction for text to flow.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
720 pub fn TTF_SetTextDirection(text: *mut TTF_Text, direction: TTF_Direction) -> bool;
721}
722unsafe extern "C" {
723 #[doc = "Get the direction to be used for text shaping a text object.\n\nThis defaults to the direction of the font used by the text object.\n\n**Parameter:** text the text to query.\n\n**Returns:** the direction to be used for text shaping.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
724 pub fn TTF_GetTextDirection(text: *mut TTF_Text) -> TTF_Direction;
725}
726unsafe extern "C" {
727 #[doc = "Set the script to be used for text shaping a text object.\n\nThis returns false if SDL_ttf isn't built with HarfBuzz support.\n\n**Parameter:** text the text to modify.\n\n**Parameter:** script an\n[ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)\n.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_StringToTag"]
728 pub fn TTF_SetTextScript(text: *mut TTF_Text, script: Uint32) -> bool;
729}
730unsafe extern "C" {
731 #[doc = "Get the script used for text shaping a text object.\n\nThis defaults to the script of the font used by the text object.\n\n**Parameter:** text the text to query.\n\n**Returns:** an\n[ISO 15924 code](https://unicode.org/iso15924/iso15924-codes.html)\nor 0 if a script hasn't been set on either the text object or the\nfont.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_TagToString"]
732 pub fn TTF_GetTextScript(text: *mut TTF_Text) -> Uint32;
733}
734unsafe extern "C" {
735 #[doc = "Set the color of a text object.\n\nThe default text color is white (255, 255, 255, 255).\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** r the red color value in the range of 0-255.\n\n**Parameter:** g the green color value in the range of 0-255.\n\n**Parameter:** b the blue color value in the range of 0-255.\n\n**Parameter:** a the alpha value in the range of 0-255.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextColor\n\n**See Also:** TTF_SetTextColorFloat"]
736 pub fn TTF_SetTextColor(text: *mut TTF_Text, r: Uint8, g: Uint8, b: Uint8, a: Uint8) -> bool;
737}
738unsafe extern "C" {
739 #[doc = "Set the color of a text object.\n\nThe default text color is white (1.0f, 1.0f, 1.0f, 1.0f).\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** r the red color value, normally in the range of 0-1.\n\n**Parameter:** g the green color value, normally in the range of 0-1.\n\n**Parameter:** b the blue color value, normally in the range of 0-1.\n\n**Parameter:** a the alpha value in the range of 0-1.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextColorFloat\n\n**See Also:** TTF_SetTextColor"]
740 pub fn TTF_SetTextColorFloat(text: *mut TTF_Text, r: f32, g: f32, b: f32, a: f32) -> bool;
741}
742unsafe extern "C" {
743 #[doc = "Get the color of a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** r a pointer filled in with the red color value in the range of\n0-255, may be NULL.\n\n**Parameter:** g a pointer filled in with the green color value in the range of\n0-255, may be NULL.\n\n**Parameter:** b a pointer filled in with the blue color value in the range of\n0-255, may be NULL.\n\n**Parameter:** a a pointer filled in with the alpha value in the range of 0-255,\nmay be NULL.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextColorFloat\n\n**See Also:** TTF_SetTextColor"]
744 pub fn TTF_GetTextColor(
745 text: *mut TTF_Text,
746 r: *mut Uint8,
747 g: *mut Uint8,
748 b: *mut Uint8,
749 a: *mut Uint8,
750 ) -> bool;
751}
752unsafe extern "C" {
753 #[doc = "Get the color of a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** r a pointer filled in with the red color value, normally in the\nrange of 0-1, may be NULL.\n\n**Parameter:** g a pointer filled in with the green color value, normally in the\nrange of 0-1, may be NULL.\n\n**Parameter:** b a pointer filled in with the blue color value, normally in the\nrange of 0-1, may be NULL.\n\n**Parameter:** a a pointer filled in with the alpha value in the range of 0-1, may\nbe NULL.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextColor\n\n**See Also:** TTF_SetTextColorFloat"]
754 pub fn TTF_GetTextColorFloat(
755 text: *mut TTF_Text,
756 r: *mut f32,
757 g: *mut f32,
758 b: *mut f32,
759 a: *mut f32,
760 ) -> bool;
761}
762unsafe extern "C" {
763 #[doc = "Set the position of a text object.\n\nThis can be used to position multiple text objects within a single wrapping\ntext area.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** x the x offset of the upper left corner of this text in pixels.\n\n**Parameter:** y the y offset of the upper left corner of this text in pixels.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextPosition"]
764 pub fn TTF_SetTextPosition(
765 text: *mut TTF_Text,
766 x: core::ffi::c_int,
767 y: core::ffi::c_int,
768 ) -> bool;
769}
770unsafe extern "C" {
771 #[doc = "Get the position of a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** x a pointer filled in with the x offset of the upper left corner of\nthis text in pixels, may be NULL.\n\n**Parameter:** y a pointer filled in with the y offset of the upper left corner of\nthis text in pixels, may be NULL.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetTextPosition"]
772 pub fn TTF_GetTextPosition(
773 text: *mut TTF_Text,
774 x: *mut core::ffi::c_int,
775 y: *mut core::ffi::c_int,
776 ) -> bool;
777}
778unsafe extern "C" {
779 #[doc = "Set whether wrapping is enabled on a text object.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** wrap_width the maximum width in pixels, 0 to wrap on newline\ncharacters.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetTextWrapWidth"]
780 pub fn TTF_SetTextWrapWidth(text: *mut TTF_Text, wrap_width: core::ffi::c_int) -> bool;
781}
782unsafe extern "C" {
783 #[doc = "Get whether wrapping is enabled on a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** wrap_width a pointer filled in with the maximum width in pixels or 0\nif the text is being wrapped on newline characters.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetTextWrapWidth"]
784 pub fn TTF_GetTextWrapWidth(text: *mut TTF_Text, wrap_width: *mut core::ffi::c_int) -> bool;
785}
786unsafe extern "C" {
787 #[doc = "Set whether whitespace should be visible when wrapping a text object.\n\nIf the whitespace is visible, it will take up space for purposes of\nalignment and wrapping. This is good for editing, but looks better when\ncentered or aligned if whitespace around line wrapping is hidden. This\ndefaults false.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** visible true to show whitespace when wrapping text, false to hide\nit.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_TextWrapWhitespaceVisible"]
788 pub fn TTF_SetTextWrapWhitespaceVisible(text: *mut TTF_Text, visible: bool) -> bool;
789}
790unsafe extern "C" {
791 #[doc = "Return whether whitespace is shown when wrapping a text object.\n\n**Parameter:** text the TTF_Text to query.\n\n**Returns:** true if whitespace is shown when wrapping text, or false\notherwise.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SetTextWrapWhitespaceVisible"]
792 pub fn TTF_TextWrapWhitespaceVisible(text: *mut TTF_Text) -> bool;
793}
794unsafe extern "C" {
795 #[doc = "Set the UTF-8 text used by a text object.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** string the UTF-8 text to use, may be NULL.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_AppendTextString\n\n**See Also:** TTF_DeleteTextString\n\n**See Also:** TTF_InsertTextString"]
796 pub fn TTF_SetTextString(
797 text: *mut TTF_Text,
798 string: *const core::ffi::c_char,
799 length: usize,
800 ) -> bool;
801}
802unsafe extern "C" {
803 #[doc = "Insert UTF-8 text into a text object.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** offset the offset, in bytes, from the beginning of the string if >=\n0, the offset from the end of the string if < 0. Note that\nthis does not do UTF-8 validation, so you should only insert\nat UTF-8 sequence boundaries.\n\n**Parameter:** string the UTF-8 text to insert.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_AppendTextString\n\n**See Also:** TTF_DeleteTextString\n\n**See Also:** TTF_SetTextString"]
804 pub fn TTF_InsertTextString(
805 text: *mut TTF_Text,
806 offset: core::ffi::c_int,
807 string: *const core::ffi::c_char,
808 length: usize,
809 ) -> bool;
810}
811unsafe extern "C" {
812 #[doc = "Append UTF-8 text to a text object.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** string the UTF-8 text to insert.\n\n**Parameter:** length the length of the text, in bytes, or 0 for null terminated\ntext.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_DeleteTextString\n\n**See Also:** TTF_InsertTextString\n\n**See Also:** TTF_SetTextString"]
813 pub fn TTF_AppendTextString(
814 text: *mut TTF_Text,
815 string: *const core::ffi::c_char,
816 length: usize,
817 ) -> bool;
818}
819unsafe extern "C" {
820 #[doc = "Delete UTF-8 text from a text object.\n\nThis function may cause the internal text representation to be rebuilt.\n\n**Parameter:** text the TTF_Text to modify.\n\n**Parameter:** offset the offset, in bytes, from the beginning of the string if >=\n0, the offset from the end of the string if < 0. Note that\nthis does not do UTF-8 validation, so you should only delete\nat UTF-8 sequence boundaries.\n\n**Parameter:** length the length of text to delete, in bytes, or -1 for the\nremainder of the string.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_AppendTextString\n\n**See Also:** TTF_InsertTextString\n\n**See Also:** TTF_SetTextString"]
821 pub fn TTF_DeleteTextString(
822 text: *mut TTF_Text,
823 offset: core::ffi::c_int,
824 length: core::ffi::c_int,
825 ) -> bool;
826}
827unsafe extern "C" {
828 #[doc = "Get the size of a text object.\n\nThe size of the text may change when the font or font style and size\nchange.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** w a pointer filled in with the width of the text, in pixels, may be\nNULL.\n\n**Parameter:** h a pointer filled in with the height of the text, in pixels, may be\nNULL.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
829 pub fn TTF_GetTextSize(
830 text: *mut TTF_Text,
831 w: *mut core::ffi::c_int,
832 h: *mut core::ffi::c_int,
833 ) -> bool;
834}
835#[doc = "Flags for TTF_SubString\n\n**Available Since:** This datatype is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_SubString"]
836pub type TTF_SubStringFlags = Uint32;
837#[doc = "The representation of a substring within text.\n\n**Available Since:** This struct is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_GetNextTextSubString\n\n**See Also:** TTF_GetPreviousTextSubString\n\n**See Also:** TTF_GetTextSubString\n\n**See Also:** TTF_GetTextSubStringForLine\n\n**See Also:** TTF_GetTextSubStringForPoint\n\n**See Also:** TTF_GetTextSubStringsForRange"]
838#[repr(C)]
839pub struct TTF_SubString {
840 #[doc = "< The flags for this substring"]
841 pub flags: TTF_SubStringFlags,
842 #[doc = "< The byte offset from the beginning of the text"]
843 pub offset: core::ffi::c_int,
844 #[doc = "< The byte length starting at the offset"]
845 pub length: core::ffi::c_int,
846 #[doc = "< The index of the line that contains this substring"]
847 pub line_index: core::ffi::c_int,
848 #[doc = "< The internal cluster index, used for quickly iterating"]
849 pub cluster_index: core::ffi::c_int,
850 #[doc = "< The rectangle, relative to the top left of the text, containing the substring"]
851 pub rect: SDL_Rect,
852}
853#[allow(clippy::unnecessary_operation, clippy::identity_op)]
854const _: () = {
855 ["Size of TTF_SubString"][::core::mem::size_of::<TTF_SubString>() - 36usize];
856 ["Alignment of TTF_SubString"][::core::mem::align_of::<TTF_SubString>() - 4usize];
857 ["Offset of field: TTF_SubString::flags"]
858 [::core::mem::offset_of!(TTF_SubString, flags) - 0usize];
859 ["Offset of field: TTF_SubString::offset"]
860 [::core::mem::offset_of!(TTF_SubString, offset) - 4usize];
861 ["Offset of field: TTF_SubString::length"]
862 [::core::mem::offset_of!(TTF_SubString, length) - 8usize];
863 ["Offset of field: TTF_SubString::line_index"]
864 [::core::mem::offset_of!(TTF_SubString, line_index) - 12usize];
865 ["Offset of field: TTF_SubString::cluster_index"]
866 [::core::mem::offset_of!(TTF_SubString, cluster_index) - 16usize];
867 ["Offset of field: TTF_SubString::rect"]
868 [::core::mem::offset_of!(TTF_SubString, rect) - 20usize];
869};
870impl Default for TTF_SubString {
871 fn default() -> Self {
872 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
873 unsafe {
874 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
875 s.assume_init()
876 }
877 }
878}
879unsafe extern "C" {
880 #[doc = "Get the substring of a text object that surrounds a text offset.\n\nIf `offset` is less than 0, this will return a zero length substring at the\nbeginning of the text with the TTF_SUBSTRING_TEXT_START flag set. If\n`offset` is greater than or equal to the length of the text string, this\nwill return a zero length substring at the end of the text with the\nTTF_SUBSTRING_TEXT_END flag set.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** offset a byte offset into the text string.\n\n**Parameter:** substring a pointer filled in with the substring containing the\noffset.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
881 pub fn TTF_GetTextSubString(
882 text: *mut TTF_Text,
883 offset: core::ffi::c_int,
884 substring: *mut TTF_SubString,
885 ) -> bool;
886}
887unsafe extern "C" {
888 #[doc = "Get the substring of a text object that contains the given line.\n\nIf `line` is less than 0, this will return a zero length substring at the\nbeginning of the text with the TTF_SUBSTRING_TEXT_START flag set. If `line`\n\nis greater than or equal to `text->num_lines` this will return a zero\nlength substring at the end of the text with the TTF_SUBSTRING_TEXT_END\nflag set.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** line a zero-based line index, in the range [0 .. text->num_lines-1].\n\n**Parameter:** substring a pointer filled in with the substring containing the\noffset.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
889 pub fn TTF_GetTextSubStringForLine(
890 text: *mut TTF_Text,
891 line: core::ffi::c_int,
892 substring: *mut TTF_SubString,
893 ) -> bool;
894}
895unsafe extern "C" {
896 #[doc = "Get the substrings of a text object that contain a range of text.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** offset a byte offset into the text string.\n\n**Parameter:** length the length of the range being queried, in bytes, or -1 for\nthe remainder of the string.\n\n**Parameter:** count a pointer filled in with the number of substrings returned,\nmay be NULL.\n\n**Returns:** a NULL terminated array of substring pointers or NULL on failure;\ncall SDL_GetError() for more information. This is a single\nallocation that should be freed with SDL_free() when it is no\nlonger needed.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
897 pub fn TTF_GetTextSubStringsForRange(
898 text: *mut TTF_Text,
899 offset: core::ffi::c_int,
900 length: core::ffi::c_int,
901 count: *mut core::ffi::c_int,
902 ) -> *mut *mut TTF_SubString;
903}
904unsafe extern "C" {
905 #[doc = "Get the portion of a text string that is closest to a point.\n\nThis will return the closest substring of text to the given point.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** x the x coordinate relative to the left side of the text, may be\noutside the bounds of the text area.\n\n**Parameter:** y the y coordinate relative to the top side of the text, may be\noutside the bounds of the text area.\n\n**Parameter:** substring a pointer filled in with the closest substring of text to\nthe given point.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
906 pub fn TTF_GetTextSubStringForPoint(
907 text: *mut TTF_Text,
908 x: core::ffi::c_int,
909 y: core::ffi::c_int,
910 substring: *mut TTF_SubString,
911 ) -> bool;
912}
913unsafe extern "C" {
914 #[doc = "Get the previous substring in a text object\n\nIf called at the start of the text, this will return a zero length\nsubstring with the TTF_SUBSTRING_TEXT_START flag set.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** substring the TTF_SubString to query.\n\n**Parameter:** previous a pointer filled in with the previous substring in the text\nobject.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
915 pub fn TTF_GetPreviousTextSubString(
916 text: *mut TTF_Text,
917 substring: *const TTF_SubString,
918 previous: *mut TTF_SubString,
919 ) -> bool;
920}
921unsafe extern "C" {
922 #[doc = "Get the next substring in a text object\n\nIf called at the end of the text, this will return a zero length substring\nwith the TTF_SUBSTRING_TEXT_END flag set.\n\n**Parameter:** text the TTF_Text to query.\n\n**Parameter:** substring the TTF_SubString to query.\n\n**Parameter:** next a pointer filled in with the next substring.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
923 pub fn TTF_GetNextTextSubString(
924 text: *mut TTF_Text,
925 substring: *const TTF_SubString,
926 next: *mut TTF_SubString,
927 ) -> bool;
928}
929unsafe extern "C" {
930 #[doc = "Update the layout of a text object.\n\nThis is automatically done when the layout is requested or the text is\nrendered, but you can call this if you need more control over the timing of\nwhen the layout and text engine representation are updated.\n\n**Parameter:** text the TTF_Text to update.\n\n**Returns:** true on success or false on failure; call SDL_GetError() for more\ninformation.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
931 pub fn TTF_UpdateText(text: *mut TTF_Text) -> bool;
932}
933unsafe extern "C" {
934 #[doc = "Destroy a text object created by a text engine.\n\n**Parameter:** text the text to destroy.\n\n**Thread Safety:** This function should be called on the thread that created the\ntext.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_CreateText"]
935 pub fn TTF_DestroyText(text: *mut TTF_Text);
936}
937unsafe extern "C" {
938 #[doc = "Dispose of a previously-created font.\n\nCall this when done with a font. This function will free any resources\nassociated with it. It is safe to call this function on NULL, for example\non the result of a failed call to TTF_OpenFont().\n\nThe font is not valid after being passed to this function. String pointers\nfrom functions that return information on this font, such as\nTTF_GetFontFamilyName() and TTF_GetFontStyleName(), are no longer valid\nafter this call, as well.\n\n**Parameter:** font the font to dispose of.\n\n**Thread Safety:** This function should not be called while any other thread is\nusing the font.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_OpenFont\n\n**See Also:** TTF_OpenFontIO"]
939 pub fn TTF_CloseFont(font: *mut TTF_Font);
940}
941unsafe extern "C" {
942 #[doc = "Deinitialize SDL_ttf.\n\nYou must call this when done with the library, to free internal resources.\nIt is safe to call this when the library isn't initialized, as it will just\nreturn immediately.\n\nOnce you have as many quit calls as you have had successful calls to\nTTF_Init, the library will actually deinitialize.\n\nPlease note that this does not automatically close any fonts that are still\nopen at the time of deinitialization, and it is possibly not safe to close\nthem afterwards, as parts of the library will no longer be initialized to\ndeal with it. A well-written program should call TTF_CloseFont() on any\nopen fonts before calling this function!\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0."]
943 pub fn TTF_Quit();
944}
945unsafe extern "C" {
946 #[doc = "Check if SDL_ttf is initialized.\n\nThis reports the number of times the library has been initialized by a call\nto TTF_Init(), without a paired deinitialization request from TTF_Quit().\n\nIn short: if it's greater than zero, the library is currently initialized\nand ready to work. If zero, it is not initialized.\n\nDespite the return value being a signed integer, this function should not\nreturn a negative number.\n\n**Returns:** the current number of initialization calls, that need to\neventually be paired with this many calls to TTF_Quit().\n\n**Thread Safety:** It is safe to call this function from any thread.\n\n**Available Since:** This function is available since SDL_ttf 3.0.0.\n\n**See Also:** TTF_Init\n\n**See Also:** TTF_Quit"]
947 pub fn TTF_WasInit() -> core::ffi::c_int;
948}