diff --git a/sdl2-sys/sdl_ttf_bindings.rs b/sdl2-sys/sdl_ttf_bindings.rs index 523764cb19..503c452cef 100644 --- a/sdl2-sys/sdl_ttf_bindings.rs +++ b/sdl2-sys/sdl_ttf_bindings.rs @@ -1,10 +1,10 @@ -/* automatically generated by rust-bindgen */ +/* automatically generated by rust-bindgen 0.69.4 */ use crate::*; pub const TTF_MAJOR_VERSION: u32 = 2; -pub const TTF_MINOR_VERSION: u32 = 0; -pub const TTF_PATCHLEVEL: u32 = 15; +pub const TTF_MINOR_VERSION: u32 = 22; +pub const TTF_PATCHLEVEL: u32 = 0; pub const TTF_STYLE_NORMAL: u32 = 0; pub const TTF_STYLE_BOLD: u32 = 1; pub const TTF_STYLE_ITALIC: u32 = 2; @@ -14,10 +14,10 @@ pub const TTF_HINTING_NORMAL: u32 = 0; pub const TTF_HINTING_LIGHT: u32 = 1; pub const TTF_HINTING_MONO: u32 = 2; pub const TTF_HINTING_NONE: u32 = 3; -pub type __uint8_t = libc::c_uchar; -pub type __uint16_t = libc::c_ushort; -pub type __uint32_t = libc::c_uint; -pub type __int64_t = libc::c_long; +pub const TTF_HINTING_LIGHT_SUBPIXEL: u32 = 4; +pub const TTF_WRAPPED_ALIGN_LEFT: u32 = 0; +pub const TTF_WRAPPED_ALIGN_CENTER: u32 = 1; +pub const TTF_WRAPPED_ALIGN_RIGHT: u32 = 2; pub type __off_t = libc::c_long; pub type __off64_t = libc::c_long; pub type Uint8 = u8; @@ -28,7 +28,21 @@ extern "C" { pub fn TTF_Linked_Version() -> *const SDL_version; } extern "C" { - pub fn TTF_ByteSwappedUNICODE(swapped: libc::c_int); + pub fn TTF_GetFreeTypeVersion( + major: *mut libc::c_int, + minor: *mut libc::c_int, + patch: *mut libc::c_int, + ); +} +extern "C" { + pub fn TTF_GetHarfBuzzVersion( + major: *mut libc::c_int, + minor: *mut libc::c_int, + patch: *mut libc::c_int, + ); +} +extern "C" { + pub fn TTF_ByteSwappedUNICODE(swapped: SDL_bool); } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -64,6 +78,53 @@ extern "C" { index: libc::c_long, ) -> *mut TTF_Font; } +extern "C" { + pub fn TTF_OpenFontDPI( + file: *const libc::c_char, + ptsize: libc::c_int, + hdpi: libc::c_uint, + vdpi: libc::c_uint, + ) -> *mut TTF_Font; +} +extern "C" { + pub fn TTF_OpenFontIndexDPI( + file: *const libc::c_char, + ptsize: libc::c_int, + index: libc::c_long, + hdpi: libc::c_uint, + vdpi: libc::c_uint, + ) -> *mut TTF_Font; +} +extern "C" { + pub fn TTF_OpenFontDPIRW( + src: *mut SDL_RWops, + freesrc: libc::c_int, + ptsize: libc::c_int, + hdpi: libc::c_uint, + vdpi: libc::c_uint, + ) -> *mut TTF_Font; +} +extern "C" { + pub fn TTF_OpenFontIndexDPIRW( + src: *mut SDL_RWops, + freesrc: libc::c_int, + ptsize: libc::c_int, + index: libc::c_long, + hdpi: libc::c_uint, + vdpi: libc::c_uint, + ) -> *mut TTF_Font; +} +extern "C" { + pub fn TTF_SetFontSize(font: *mut TTF_Font, ptsize: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn TTF_SetFontSizeDPI( + font: *mut TTF_Font, + ptsize: libc::c_int, + hdpi: libc::c_uint, + vdpi: libc::c_uint, + ) -> libc::c_int; +} extern "C" { pub fn TTF_GetFontStyle(font: *const TTF_Font) -> libc::c_int; } @@ -82,6 +143,12 @@ extern "C" { extern "C" { pub fn TTF_SetFontHinting(font: *mut TTF_Font, hinting: libc::c_int); } +extern "C" { + pub fn TTF_GetFontWrappedAlign(font: *const TTF_Font) -> libc::c_int; +} +extern "C" { + pub fn TTF_SetFontWrappedAlign(font: *mut TTF_Font, align: libc::c_int); +} extern "C" { pub fn TTF_FontHeight(font: *const TTF_Font) -> libc::c_int; } @@ -107,13 +174,16 @@ extern "C" { pub fn TTF_FontFaceIsFixedWidth(font: *const TTF_Font) -> libc::c_int; } extern "C" { - pub fn TTF_FontFaceFamilyName(font: *const TTF_Font) -> *mut libc::c_char; + pub fn TTF_FontFaceFamilyName(font: *const TTF_Font) -> *const libc::c_char; +} +extern "C" { + pub fn TTF_FontFaceStyleName(font: *const TTF_Font) -> *const libc::c_char; } extern "C" { - pub fn TTF_FontFaceStyleName(font: *const TTF_Font) -> *mut libc::c_char; + pub fn TTF_GlyphIsProvided(font: *mut TTF_Font, ch: Uint16) -> libc::c_int; } extern "C" { - pub fn TTF_GlyphIsProvided(font: *const TTF_Font, ch: Uint16) -> libc::c_int; + pub fn TTF_GlyphIsProvided32(font: *mut TTF_Font, ch: Uint32) -> libc::c_int; } extern "C" { pub fn TTF_GlyphMetrics( @@ -126,6 +196,17 @@ extern "C" { advance: *mut libc::c_int, ) -> libc::c_int; } +extern "C" { + pub fn TTF_GlyphMetrics32( + font: *mut TTF_Font, + ch: Uint32, + minx: *mut libc::c_int, + maxx: *mut libc::c_int, + miny: *mut libc::c_int, + maxy: *mut libc::c_int, + advance: *mut libc::c_int, + ) -> libc::c_int; +} extern "C" { pub fn TTF_SizeText( font: *mut TTF_Font, @@ -150,6 +231,33 @@ extern "C" { h: *mut libc::c_int, ) -> libc::c_int; } +extern "C" { + pub fn TTF_MeasureText( + font: *mut TTF_Font, + text: *const libc::c_char, + measure_width: libc::c_int, + extent: *mut libc::c_int, + count: *mut libc::c_int, + ) -> libc::c_int; +} +extern "C" { + pub fn TTF_MeasureUTF8( + font: *mut TTF_Font, + text: *const libc::c_char, + measure_width: libc::c_int, + extent: *mut libc::c_int, + count: *mut libc::c_int, + ) -> libc::c_int; +} +extern "C" { + pub fn TTF_MeasureUNICODE( + font: *mut TTF_Font, + text: *const Uint16, + measure_width: libc::c_int, + extent: *mut libc::c_int, + count: *mut libc::c_int, + ) -> libc::c_int; +} extern "C" { pub fn TTF_RenderText_Solid( font: *mut TTF_Font, @@ -171,6 +279,30 @@ extern "C" { fg: SDL_Color, ) -> *mut SDL_Surface; } +extern "C" { + pub fn TTF_RenderText_Solid_Wrapped( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUTF8_Solid_Wrapped( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUNICODE_Solid_Wrapped( + font: *mut TTF_Font, + text: *const Uint16, + fg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} extern "C" { pub fn TTF_RenderGlyph_Solid( font: *mut TTF_Font, @@ -178,6 +310,13 @@ extern "C" { fg: SDL_Color, ) -> *mut SDL_Surface; } +extern "C" { + pub fn TTF_RenderGlyph32_Solid( + font: *mut TTF_Font, + ch: Uint32, + fg: SDL_Color, + ) -> *mut SDL_Surface; +} extern "C" { pub fn TTF_RenderText_Shaded( font: *mut TTF_Font, @@ -202,6 +341,33 @@ extern "C" { bg: SDL_Color, ) -> *mut SDL_Surface; } +extern "C" { + pub fn TTF_RenderText_Shaded_Wrapped( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + bg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUTF8_Shaded_Wrapped( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + bg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUNICODE_Shaded_Wrapped( + font: *mut TTF_Font, + text: *const Uint16, + fg: SDL_Color, + bg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} extern "C" { pub fn TTF_RenderGlyph_Shaded( font: *mut TTF_Font, @@ -210,6 +376,14 @@ extern "C" { bg: SDL_Color, ) -> *mut SDL_Surface; } +extern "C" { + pub fn TTF_RenderGlyph32_Shaded( + font: *mut TTF_Font, + ch: Uint32, + fg: SDL_Color, + bg: SDL_Color, + ) -> *mut SDL_Surface; +} extern "C" { pub fn TTF_RenderText_Blended( font: *mut TTF_Font, @@ -262,6 +436,80 @@ extern "C" { fg: SDL_Color, ) -> *mut SDL_Surface; } +extern "C" { + pub fn TTF_RenderGlyph32_Blended( + font: *mut TTF_Font, + ch: Uint32, + fg: SDL_Color, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderText_LCD( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + bg: SDL_Color, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUTF8_LCD( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + bg: SDL_Color, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUNICODE_LCD( + font: *mut TTF_Font, + text: *const Uint16, + fg: SDL_Color, + bg: SDL_Color, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderText_LCD_Wrapped( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + bg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUTF8_LCD_Wrapped( + font: *mut TTF_Font, + text: *const libc::c_char, + fg: SDL_Color, + bg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderUNICODE_LCD_Wrapped( + font: *mut TTF_Font, + text: *const Uint16, + fg: SDL_Color, + bg: SDL_Color, + wrapLength: Uint32, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderGlyph_LCD( + font: *mut TTF_Font, + ch: Uint16, + fg: SDL_Color, + bg: SDL_Color, + ) -> *mut SDL_Surface; +} +extern "C" { + pub fn TTF_RenderGlyph32_LCD( + font: *mut TTF_Font, + ch: Uint32, + fg: SDL_Color, + bg: SDL_Color, + ) -> *mut SDL_Surface; +} extern "C" { pub fn TTF_CloseFont(font: *mut TTF_Font); } @@ -285,3 +533,33 @@ extern "C" { ch: Uint16, ) -> libc::c_int; } +extern "C" { + pub fn TTF_GetFontKerningSizeGlyphs32( + font: *mut TTF_Font, + previous_ch: Uint32, + ch: Uint32, + ) -> libc::c_int; +} +extern "C" { + pub fn TTF_SetFontSDF(font: *mut TTF_Font, on_off: SDL_bool) -> libc::c_int; +} +extern "C" { + pub fn TTF_GetFontSDF(font: *const TTF_Font) -> SDL_bool; +} +pub const TTF_Direction_TTF_DIRECTION_LTR: TTF_Direction = 0; +pub const TTF_Direction_TTF_DIRECTION_RTL: TTF_Direction = 1; +pub const TTF_Direction_TTF_DIRECTION_TTB: TTF_Direction = 2; +pub const TTF_Direction_TTF_DIRECTION_BTT: TTF_Direction = 3; +pub type TTF_Direction = libc::c_uint; +extern "C" { + pub fn TTF_SetDirection(direction: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn TTF_SetScript(script: libc::c_int) -> libc::c_int; +} +extern "C" { + pub fn TTF_SetFontDirection(font: *mut TTF_Font, direction: TTF_Direction) -> libc::c_int; +} +extern "C" { + pub fn TTF_SetFontScriptName(font: *mut TTF_Font, script: *const libc::c_char) -> libc::c_int; +} diff --git a/src/sdl2/ttf/font.rs b/src/sdl2/ttf/font.rs index 3a2fa2c34a..ede5989bdc 100644 --- a/src/sdl2/ttf/font.rs +++ b/src/sdl2/ttf/font.rs @@ -497,7 +497,7 @@ impl<'ttf, 'r> Font<'ttf, 'r> { /// Returns the index of the given character in this font face. pub fn find_glyph(&self, ch: char) -> Option { unsafe { - let ret = ttf::TTF_GlyphIsProvided(self.raw, ch as u16); + let ret = ttf::TTF_GlyphIsProvided32(self.raw, ch as u32); if ret == 0 { None } else { @@ -515,9 +515,9 @@ impl<'ttf, 'r> Font<'ttf, 'r> { let mut advance = 0; let ret = unsafe { - ttf::TTF_GlyphMetrics( + ttf::TTF_GlyphMetrics32( self.raw, - ch as u16, + ch as u32, &mut minx, &mut maxx, &mut miny,