/* automatically generated by rust-bindgen 0.72.1 */
use sdl_sys_bindgen::*;
pub const SDL_TTF_MAJOR_VERSION: u32 = 3;
pub const SDL_TTF_MINOR_VERSION: u32 = 3;
pub const SDL_TTF_MICRO_VERSION: u32 = 0;
pub const TTF_PROP_FONT_CREATE_FILENAME_STRING: &[u8; 29] = b"SDL_ttf.font.create.filename\0";
pub const TTF_PROP_FONT_CREATE_IOSTREAM_POINTER: &[u8; 29] = b"SDL_ttf.font.create.iostream\0";
pub const TTF_PROP_FONT_CREATE_IOSTREAM_OFFSET_NUMBER: &[u8; 36] =
b"SDL_ttf.font.create.iostream.offset\0";
pub const TTF_PROP_FONT_CREATE_IOSTREAM_AUTOCLOSE_BOOLEAN: &[u8; 39] =
b"SDL_ttf.font.create.iostream.autoclose\0";
pub const TTF_PROP_FONT_CREATE_SIZE_FLOAT: &[u8; 25] = b"SDL_ttf.font.create.size\0";
pub const TTF_PROP_FONT_CREATE_FACE_NUMBER: &[u8; 25] = b"SDL_ttf.font.create.face\0";
pub const TTF_PROP_FONT_CREATE_HORIZONTAL_DPI_NUMBER: &[u8; 25] = b"SDL_ttf.font.create.hdpi\0";
pub const TTF_PROP_FONT_CREATE_VERTICAL_DPI_NUMBER: &[u8; 25] = b"SDL_ttf.font.create.vdpi\0";
pub const TTF_PROP_FONT_CREATE_EXISTING_FONT_POINTER: &[u8; 34] =
b"SDL_ttf.font.create.existing_font\0";
pub const TTF_PROP_FONT_OUTLINE_LINE_CAP_NUMBER: &[u8; 30] = b"SDL_ttf.font.outline.line_cap\0";
pub const TTF_PROP_FONT_OUTLINE_LINE_JOIN_NUMBER: &[u8; 31] = b"SDL_ttf.font.outline.line_join\0";
pub const TTF_PROP_FONT_OUTLINE_MITER_LIMIT_NUMBER: &[u8; 33] =
b"SDL_ttf.font.outline.miter_limit\0";
pub const TTF_STYLE_NORMAL: u32 = 0;
pub const TTF_STYLE_BOLD: u32 = 1;
pub const TTF_STYLE_ITALIC: u32 = 2;
pub const TTF_STYLE_UNDERLINE: u32 = 4;
pub const TTF_STYLE_STRIKETHROUGH: u32 = 8;
pub const TTF_FONT_WEIGHT_THIN: u32 = 100;
pub const TTF_FONT_WEIGHT_EXTRA_LIGHT: u32 = 200;
pub const TTF_FONT_WEIGHT_LIGHT: u32 = 300;
pub const TTF_FONT_WEIGHT_NORMAL: u32 = 400;
pub const TTF_FONT_WEIGHT_MEDIUM: u32 = 500;
pub const TTF_FONT_WEIGHT_SEMI_BOLD: u32 = 600;
pub const TTF_FONT_WEIGHT_BOLD: u32 = 700;
pub const TTF_FONT_WEIGHT_EXTRA_BOLD: u32 = 800;
pub const TTF_FONT_WEIGHT_BLACK: u32 = 900;
pub const TTF_FONT_WEIGHT_EXTRA_BLACK: u32 = 950;
pub const TTF_PROP_RENDERER_TEXT_ENGINE_RENDERER_POINTER: &[u8; 45] =
b"SDL_ttf.renderer_text_engine.create.renderer\0";
pub const TTF_PROP_RENDERER_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER: &[u8; 55] =
b"SDL_ttf.renderer_text_engine.create.atlas_texture_size\0";
pub const TTF_PROP_GPU_TEXT_ENGINE_DEVICE_POINTER: &[u8; 38] =
b"SDL_ttf.gpu_text_engine.create.device\0";
pub const TTF_PROP_GPU_TEXT_ENGINE_ATLAS_TEXTURE_SIZE_NUMBER: &[u8; 50] =
b"SDL_ttf.gpu_text_engine.create.atlas_texture_size\0";
pub const TTF_SUBSTRING_DIRECTION_MASK: u32 = 255;
pub const TTF_SUBSTRING_TEXT_START: u32 = 256;
pub const TTF_SUBSTRING_LINE_START: u32 = 512;
pub const TTF_SUBSTRING_LINE_END: u32 = 1024;
pub const TTF_SUBSTRING_TEXT_END: u32 = 2048;
unsafe extern "C" {
#[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."]
pub fn TTF_Version() -> core::ffi::c_int;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFreeTypeVersion(
major: *mut core::ffi::c_int,
minor: *mut core::ffi::c_int,
patch: *mut core::ffi::c_int,
);
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetHarfBuzzVersion(
major: *mut core::ffi::c_int,
minor: *mut core::ffi::c_int,
patch: *mut core::ffi::c_int,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TTF_Font {
_unused: [u8; 0],
}
unsafe extern "C" {
#[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"]
pub fn TTF_Init() -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_OpenFont(file: *const core::ffi::c_char, ptsize: f32) -> *mut TTF_Font;
}
unsafe extern "C" {
#[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"]
pub fn TTF_OpenFontIO(src: *mut SDL_IOStream, closeio: bool, ptsize: f32) -> *mut TTF_Font;
}
unsafe extern "C" {
#[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"]
pub fn TTF_OpenFontWithProperties(props: SDL_PropertiesID) -> *mut TTF_Font;
}
unsafe extern "C" {
#[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"]
pub fn TTF_CopyFont(existing_font: *mut TTF_Font) -> *mut TTF_Font;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontProperties(font: *mut TTF_Font) -> SDL_PropertiesID;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontGeneration(font: *mut TTF_Font) -> Uint32;
}
unsafe extern "C" {
#[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"]
pub fn TTF_AddFallbackFont(font: *mut TTF_Font, fallback: *mut TTF_Font) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RemoveFallbackFont(font: *mut TTF_Font, fallback: *mut TTF_Font);
}
unsafe extern "C" {
#[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"]
pub fn TTF_ClearFallbackFonts(font: *mut TTF_Font);
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontSize(font: *mut TTF_Font, ptsize: f32) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontSizeDPI(
font: *mut TTF_Font,
ptsize: f32,
hdpi: core::ffi::c_int,
vdpi: core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontSize(font: *mut TTF_Font) -> f32;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontDPI(
font: *mut TTF_Font,
hdpi: *mut core::ffi::c_int,
vdpi: *mut core::ffi::c_int,
) -> bool;
}
#[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"]
pub type TTF_FontStyleFlags = Uint32;
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontStyle(font: *mut TTF_Font, style: TTF_FontStyleFlags);
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontStyle(font: *const TTF_Font) -> TTF_FontStyleFlags;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontOutline(font: *mut TTF_Font, outline: core::ffi::c_int) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontOutline(font: *const TTF_Font) -> core::ffi::c_int;
}
impl TTF_HintingFlags {
pub const TTF_HINTING_INVALID: TTF_HintingFlags = TTF_HintingFlags(-1);
#[doc = "< Normal hinting applies standard grid-fitting."]
pub const TTF_HINTING_NORMAL: TTF_HintingFlags = TTF_HintingFlags(0);
#[doc = "< Light hinting applies subtle adjustments to improve rendering."]
pub const TTF_HINTING_LIGHT: TTF_HintingFlags = TTF_HintingFlags(1);
#[doc = "< Monochrome hinting adjusts the font for better rendering at lower resolutions."]
pub const TTF_HINTING_MONO: TTF_HintingFlags = TTF_HintingFlags(2);
#[doc = "< No hinting, the font is rendered without any grid-fitting."]
pub const TTF_HINTING_NONE: TTF_HintingFlags = TTF_HintingFlags(3);
#[doc = "< Light hinting with subpixel rendering for more precise font edges."]
pub const TTF_HINTING_LIGHT_SUBPIXEL: TTF_HintingFlags = TTF_HintingFlags(4);
}
#[repr(transparent)]
#[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"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TTF_HintingFlags(pub core::ffi::c_int);
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontHinting(font: *mut TTF_Font, hinting: TTF_HintingFlags);
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetNumFontFaces(font: *const TTF_Font) -> core::ffi::c_int;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontHinting(font: *const TTF_Font) -> TTF_HintingFlags;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontSDF(font: *mut TTF_Font, enabled: bool) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontSDF(font: *const TTF_Font) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontWeight(font: *const TTF_Font) -> core::ffi::c_int;
}
impl TTF_HorizontalAlignment {
pub const TTF_HORIZONTAL_ALIGN_INVALID: TTF_HorizontalAlignment = TTF_HorizontalAlignment(-1);
pub const TTF_HORIZONTAL_ALIGN_LEFT: TTF_HorizontalAlignment = TTF_HorizontalAlignment(0);
pub const TTF_HORIZONTAL_ALIGN_CENTER: TTF_HorizontalAlignment = TTF_HorizontalAlignment(1);
pub const TTF_HORIZONTAL_ALIGN_RIGHT: TTF_HorizontalAlignment = TTF_HorizontalAlignment(2);
}
#[repr(transparent)]
#[doc = "The horizontal alignment used when rendering wrapped text.\n\n**Available Since:** This enum is available since SDL_ttf 3.0.0."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TTF_HorizontalAlignment(pub core::ffi::c_int);
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontWrapAlignment(font: *mut TTF_Font, align: TTF_HorizontalAlignment);
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontWrapAlignment(font: *const TTF_Font) -> TTF_HorizontalAlignment;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontHeight(font: *const TTF_Font) -> core::ffi::c_int;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontAscent(font: *const TTF_Font) -> core::ffi::c_int;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontDescent(font: *const TTF_Font) -> core::ffi::c_int;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontLineSkip(font: *mut TTF_Font, lineskip: core::ffi::c_int);
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontLineSkip(font: *const TTF_Font) -> core::ffi::c_int;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontKerning(font: *mut TTF_Font, enabled: bool);
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontKerning(font: *const TTF_Font) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_FontIsFixedWidth(font: *const TTF_Font) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_FontIsScalable(font: *const TTF_Font) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontFamilyName(font: *const TTF_Font) -> *const core::ffi::c_char;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontStyleName(font: *const TTF_Font) -> *const core::ffi::c_char;
}
impl TTF_Direction {
pub const TTF_DIRECTION_INVALID: TTF_Direction = TTF_Direction(0);
#[doc = "< Left to Right"]
pub const TTF_DIRECTION_LTR: TTF_Direction = TTF_Direction(4);
#[doc = "< Right to Left"]
pub const TTF_DIRECTION_RTL: TTF_Direction = TTF_Direction(5);
#[doc = "< Top to Bottom"]
pub const TTF_DIRECTION_TTB: TTF_Direction = TTF_Direction(6);
#[doc = "< Bottom to Top"]
pub const TTF_DIRECTION_BTT: TTF_Direction = TTF_Direction(7);
}
#[repr(transparent)]
#[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"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TTF_Direction(pub core::ffi::c_uint);
unsafe extern "C" {
#[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."]
pub fn TTF_SetFontDirection(font: *mut TTF_Font, direction: TTF_Direction) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontDirection(font: *mut TTF_Font) -> TTF_Direction;
}
unsafe extern "C" {
#[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."]
pub fn TTF_SetFontCharSpacing(font: *mut TTF_Font, spacing: core::ffi::c_int) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetFontCharSpacing(font: *mut TTF_Font) -> core::ffi::c_int;
}
unsafe extern "C" {
#[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"]
pub fn TTF_StringToTag(string: *const core::ffi::c_char) -> Uint32;
}
unsafe extern "C" {
#[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"]
pub fn TTF_TagToString(tag: Uint32, string: *mut core::ffi::c_char, size: usize);
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetFontScript(font: *mut TTF_Font, script: Uint32) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetFontScript(font: *mut TTF_Font) -> Uint32;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetGlyphScript(ch: Uint32) -> Uint32;
}
unsafe extern "C" {
#[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."]
pub fn TTF_SetFontLanguage(
font: *mut TTF_Font,
language_bcp47: *const core::ffi::c_char,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_FontHasGlyph(font: *mut TTF_Font, ch: Uint32) -> bool;
}
impl TTF_ImageType {
pub const TTF_IMAGE_INVALID: TTF_ImageType = TTF_ImageType(0);
#[doc = "< The color channels are white"]
pub const TTF_IMAGE_ALPHA: TTF_ImageType = TTF_ImageType(1);
#[doc = "< The color channels have image data"]
pub const TTF_IMAGE_COLOR: TTF_ImageType = TTF_ImageType(2);
#[doc = "< The alpha channel has signed distance field information"]
pub const TTF_IMAGE_SDF: TTF_ImageType = TTF_ImageType(3);
}
#[repr(transparent)]
#[doc = "The type of data in a glyph image\n\n**Available Since:** This enum is available since SDL_ttf 3.0.0."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TTF_ImageType(pub core::ffi::c_uint);
unsafe extern "C" {
#[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."]
pub fn TTF_GetGlyphImage(
font: *mut TTF_Font,
ch: Uint32,
image_type: *mut TTF_ImageType,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetGlyphImageForIndex(
font: *mut TTF_Font,
glyph_index: Uint32,
image_type: *mut TTF_ImageType,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetGlyphMetrics(
font: *mut TTF_Font,
ch: Uint32,
minx: *mut core::ffi::c_int,
maxx: *mut core::ffi::c_int,
miny: *mut core::ffi::c_int,
maxy: *mut core::ffi::c_int,
advance: *mut core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetGlyphKerning(
font: *mut TTF_Font,
previous_ch: Uint32,
ch: Uint32,
kerning: *mut core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetStringSize(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
w: *mut core::ffi::c_int,
h: *mut core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetStringSizeWrapped(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
wrap_width: core::ffi::c_int,
w: *mut core::ffi::c_int,
h: *mut core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_MeasureString(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
max_width: core::ffi::c_int,
measured_width: *mut core::ffi::c_int,
measured_length: *mut usize,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_Solid(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_Solid_Wrapped(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
wrapLength: core::ffi::c_int,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderGlyph_Solid(
font: *mut TTF_Font,
ch: Uint32,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_Shaded(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_Shaded_Wrapped(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
bg: SDL_Color,
wrap_width: core::ffi::c_int,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderGlyph_Shaded(
font: *mut TTF_Font,
ch: Uint32,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_Blended(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_Blended_Wrapped(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
wrap_width: core::ffi::c_int,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderGlyph_Blended(
font: *mut TTF_Font,
ch: Uint32,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_LCD(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderText_LCD_Wrapped(
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
fg: SDL_Color,
bg: SDL_Color,
wrap_width: core::ffi::c_int,
) -> *mut SDL_Surface;
}
unsafe extern "C" {
#[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"]
pub fn TTF_RenderGlyph_LCD(
font: *mut TTF_Font,
ch: Uint32,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TTF_TextEngine {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct TTF_TextData {
_unused: [u8; 0],
}
#[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"]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct TTF_Text {
#[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."]
pub text: *mut core::ffi::c_char,
#[doc = "< The number of lines in the text, 0 if it's empty"]
pub num_lines: core::ffi::c_int,
#[doc = "< Application reference count, used when freeing surface"]
pub refcount: core::ffi::c_int,
#[doc = "< Private"]
pub internal: *mut TTF_TextData,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of TTF_Text"][::core::mem::size_of::<TTF_Text>() - 16usize];
["Alignment of TTF_Text"][::core::mem::align_of::<TTF_Text>() - 4usize];
["Offset of field: TTF_Text::text"][::core::mem::offset_of!(TTF_Text, text) - 0usize];
["Offset of field: TTF_Text::num_lines"][::core::mem::offset_of!(TTF_Text, num_lines) - 4usize];
["Offset of field: TTF_Text::refcount"][::core::mem::offset_of!(TTF_Text, refcount) - 8usize];
["Offset of field: TTF_Text::internal"][::core::mem::offset_of!(TTF_Text, internal) - 12usize];
};
impl Default for TTF_Text {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
unsafe extern "C" {
#[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"]
pub fn TTF_CreateSurfaceTextEngine() -> *mut TTF_TextEngine;
}
unsafe extern "C" {
#[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"]
pub fn TTF_DrawSurfaceText(
text: *mut TTF_Text,
x: core::ffi::c_int,
y: core::ffi::c_int,
surface: *mut SDL_Surface,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_DestroySurfaceTextEngine(engine: *mut TTF_TextEngine);
}
unsafe extern "C" {
#[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"]
pub fn TTF_CreateRendererTextEngine(renderer: *mut SDL_Renderer) -> *mut TTF_TextEngine;
}
unsafe extern "C" {
#[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"]
pub fn TTF_CreateRendererTextEngineWithProperties(
props: SDL_PropertiesID,
) -> *mut TTF_TextEngine;
}
unsafe extern "C" {
#[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"]
pub fn TTF_DrawRendererText(text: *mut TTF_Text, x: f32, y: f32) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_DestroyRendererTextEngine(engine: *mut TTF_TextEngine);
}
unsafe extern "C" {
#[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"]
pub fn TTF_CreateGPUTextEngine(device: *mut SDL_GPUDevice) -> *mut TTF_TextEngine;
}
unsafe extern "C" {
#[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"]
pub fn TTF_CreateGPUTextEngineWithProperties(props: SDL_PropertiesID) -> *mut TTF_TextEngine;
}
#[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"]
#[repr(C)]
#[derive(Debug, Copy, Clone, Hash)]
pub struct TTF_GPUAtlasDrawSequence {
#[doc = "< Texture atlas that stores the glyphs"]
pub atlas_texture: *mut SDL_GPUTexture,
#[doc = "< An array of vertex positions"]
pub xy: *mut SDL_FPoint,
#[doc = "< An array of normalized texture coordinates for each vertex"]
pub uv: *mut SDL_FPoint,
#[doc = "< Number of vertices"]
pub num_vertices: core::ffi::c_int,
#[doc = "< An array of indices into the 'vertices' arrays"]
pub indices: *mut core::ffi::c_int,
#[doc = "< Number of indices"]
pub num_indices: core::ffi::c_int,
#[doc = "< The image type of this draw sequence"]
pub image_type: TTF_ImageType,
#[doc = "< The next sequence (will be NULL in case of the last sequence)"]
pub next: *mut TTF_GPUAtlasDrawSequence,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of TTF_GPUAtlasDrawSequence"]
[::core::mem::size_of::<TTF_GPUAtlasDrawSequence>() - 32usize];
["Alignment of TTF_GPUAtlasDrawSequence"]
[::core::mem::align_of::<TTF_GPUAtlasDrawSequence>() - 4usize];
["Offset of field: TTF_GPUAtlasDrawSequence::atlas_texture"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, atlas_texture) - 0usize];
["Offset of field: TTF_GPUAtlasDrawSequence::xy"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, xy) - 4usize];
["Offset of field: TTF_GPUAtlasDrawSequence::uv"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, uv) - 8usize];
["Offset of field: TTF_GPUAtlasDrawSequence::num_vertices"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, num_vertices) - 12usize];
["Offset of field: TTF_GPUAtlasDrawSequence::indices"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, indices) - 16usize];
["Offset of field: TTF_GPUAtlasDrawSequence::num_indices"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, num_indices) - 20usize];
["Offset of field: TTF_GPUAtlasDrawSequence::image_type"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, image_type) - 24usize];
["Offset of field: TTF_GPUAtlasDrawSequence::next"]
[::core::mem::offset_of!(TTF_GPUAtlasDrawSequence, next) - 28usize];
};
impl Default for TTF_GPUAtlasDrawSequence {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetGPUTextDrawData(text: *mut TTF_Text) -> *mut TTF_GPUAtlasDrawSequence;
}
unsafe extern "C" {
#[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"]
pub fn TTF_DestroyGPUTextEngine(engine: *mut TTF_TextEngine);
}
impl TTF_GPUTextEngineWinding {
pub const TTF_GPU_TEXTENGINE_WINDING_INVALID: TTF_GPUTextEngineWinding =
TTF_GPUTextEngineWinding(-1);
pub const TTF_GPU_TEXTENGINE_WINDING_CLOCKWISE: TTF_GPUTextEngineWinding =
TTF_GPUTextEngineWinding(0);
pub const TTF_GPU_TEXTENGINE_WINDING_COUNTER_CLOCKWISE: TTF_GPUTextEngineWinding =
TTF_GPUTextEngineWinding(1);
}
#[repr(transparent)]
#[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."]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct TTF_GPUTextEngineWinding(pub core::ffi::c_int);
unsafe extern "C" {
#[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"]
pub fn TTF_SetGPUTextEngineWinding(
engine: *mut TTF_TextEngine,
winding: TTF_GPUTextEngineWinding,
);
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetGPUTextEngineWinding(engine: *const TTF_TextEngine) -> TTF_GPUTextEngineWinding;
}
unsafe extern "C" {
#[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"]
pub fn TTF_CreateText(
engine: *mut TTF_TextEngine,
font: *mut TTF_Font,
text: *const core::ffi::c_char,
length: usize,
) -> *mut TTF_Text;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetTextProperties(text: *mut TTF_Text) -> SDL_PropertiesID;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextEngine(text: *mut TTF_Text, engine: *mut TTF_TextEngine) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetTextEngine(text: *mut TTF_Text) -> *mut TTF_TextEngine;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextFont(text: *mut TTF_Text, font: *mut TTF_Font) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetTextFont(text: *mut TTF_Text) -> *mut TTF_Font;
}
unsafe extern "C" {
#[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."]
pub fn TTF_SetTextDirection(text: *mut TTF_Text, direction: TTF_Direction) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetTextDirection(text: *mut TTF_Text) -> TTF_Direction;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextScript(text: *mut TTF_Text, script: Uint32) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetTextScript(text: *mut TTF_Text) -> Uint32;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextColor(text: *mut TTF_Text, r: Uint8, g: Uint8, b: Uint8, a: Uint8) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextColorFloat(text: *mut TTF_Text, r: f32, g: f32, b: f32, a: f32) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetTextColor(
text: *mut TTF_Text,
r: *mut Uint8,
g: *mut Uint8,
b: *mut Uint8,
a: *mut Uint8,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetTextColorFloat(
text: *mut TTF_Text,
r: *mut f32,
g: *mut f32,
b: *mut f32,
a: *mut f32,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextPosition(
text: *mut TTF_Text,
x: core::ffi::c_int,
y: core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetTextPosition(
text: *mut TTF_Text,
x: *mut core::ffi::c_int,
y: *mut core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextWrapWidth(text: *mut TTF_Text, wrap_width: core::ffi::c_int) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_GetTextWrapWidth(text: *mut TTF_Text, wrap_width: *mut core::ffi::c_int) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextWrapWhitespaceVisible(text: *mut TTF_Text, visible: bool) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_TextWrapWhitespaceVisible(text: *mut TTF_Text) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_SetTextString(
text: *mut TTF_Text,
string: *const core::ffi::c_char,
length: usize,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_InsertTextString(
text: *mut TTF_Text,
offset: core::ffi::c_int,
string: *const core::ffi::c_char,
length: usize,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_AppendTextString(
text: *mut TTF_Text,
string: *const core::ffi::c_char,
length: usize,
) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_DeleteTextString(
text: *mut TTF_Text,
offset: core::ffi::c_int,
length: core::ffi::c_int,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetTextSize(
text: *mut TTF_Text,
w: *mut core::ffi::c_int,
h: *mut core::ffi::c_int,
) -> bool;
}
#[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"]
pub type TTF_SubStringFlags = Uint32;
#[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"]
#[repr(C)]
pub struct TTF_SubString {
#[doc = "< The flags for this substring"]
pub flags: TTF_SubStringFlags,
#[doc = "< The byte offset from the beginning of the text"]
pub offset: core::ffi::c_int,
#[doc = "< The byte length starting at the offset"]
pub length: core::ffi::c_int,
#[doc = "< The index of the line that contains this substring"]
pub line_index: core::ffi::c_int,
#[doc = "< The internal cluster index, used for quickly iterating"]
pub cluster_index: core::ffi::c_int,
#[doc = "< The rectangle, relative to the top left of the text, containing the substring"]
pub rect: SDL_Rect,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of TTF_SubString"][::core::mem::size_of::<TTF_SubString>() - 36usize];
["Alignment of TTF_SubString"][::core::mem::align_of::<TTF_SubString>() - 4usize];
["Offset of field: TTF_SubString::flags"]
[::core::mem::offset_of!(TTF_SubString, flags) - 0usize];
["Offset of field: TTF_SubString::offset"]
[::core::mem::offset_of!(TTF_SubString, offset) - 4usize];
["Offset of field: TTF_SubString::length"]
[::core::mem::offset_of!(TTF_SubString, length) - 8usize];
["Offset of field: TTF_SubString::line_index"]
[::core::mem::offset_of!(TTF_SubString, line_index) - 12usize];
["Offset of field: TTF_SubString::cluster_index"]
[::core::mem::offset_of!(TTF_SubString, cluster_index) - 16usize];
["Offset of field: TTF_SubString::rect"]
[::core::mem::offset_of!(TTF_SubString, rect) - 20usize];
};
impl Default for TTF_SubString {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetTextSubString(
text: *mut TTF_Text,
offset: core::ffi::c_int,
substring: *mut TTF_SubString,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetTextSubStringForLine(
text: *mut TTF_Text,
line: core::ffi::c_int,
substring: *mut TTF_SubString,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetTextSubStringsForRange(
text: *mut TTF_Text,
offset: core::ffi::c_int,
length: core::ffi::c_int,
count: *mut core::ffi::c_int,
) -> *mut *mut TTF_SubString;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetTextSubStringForPoint(
text: *mut TTF_Text,
x: core::ffi::c_int,
y: core::ffi::c_int,
substring: *mut TTF_SubString,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetPreviousTextSubString(
text: *mut TTF_Text,
substring: *const TTF_SubString,
previous: *mut TTF_SubString,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_GetNextTextSubString(
text: *mut TTF_Text,
substring: *const TTF_SubString,
next: *mut TTF_SubString,
) -> bool;
}
unsafe extern "C" {
#[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."]
pub fn TTF_UpdateText(text: *mut TTF_Text) -> bool;
}
unsafe extern "C" {
#[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"]
pub fn TTF_DestroyText(text: *mut TTF_Text);
}
unsafe extern "C" {
#[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"]
pub fn TTF_CloseFont(font: *mut TTF_Font);
}
unsafe extern "C" {
#[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."]
pub fn TTF_Quit();
}
unsafe extern "C" {
#[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"]
pub fn TTF_WasInit() -> core::ffi::c_int;
}