Convert SDL_ttf bindings into autogenerated bindings

Had to change some mutability of some raw pointers used, but the ttf
 demo seem to work.

 Progresses on #647
This commit is contained in:
Jon Emil Jahren
2018-04-02 08:13:55 +02:00
parent d096769786
commit f2a7b7fd0a
5 changed files with 339 additions and 106 deletions

View File

@@ -284,6 +284,9 @@ fn copy_pregenerated_bindings() {
fs::copy(crate_path.join("sdl_image_bindings.rs"), out_path.join("image_bindings.rs"))
.expect("Couldn't find pregenerated SDL_image bindings!");
fs::copy(crate_path.join("sdl_ttf_bindings.rs"), out_path.join("ttf_bindings.rs"))
.expect("Couldn't find pregenerated SDL_ttf bindings!");
}
#[cfg(feature = "bindgen")]
@@ -293,6 +296,7 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
let target_os = get_os_from_triple(target).unwrap();
let mut bindings = bindgen::Builder::default();
let mut image_bindings = bindgen::Builder::default();
let mut ttf_bindings = bindgen::Builder::default();
// Set correct target triple for bindgen when cross-compiling
if target != host {
@@ -301,6 +305,9 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
image_bindings = image_bindings.clang_arg("-target");
image_bindings = image_bindings.clang_arg(target.clone());
ttf_bindings = ttf_bindings.clang_arg("-target");
ttf_bindings = ttf_bindings.clang_arg(target.clone());
}
if headers_paths.len() == 0 {
@@ -310,11 +317,13 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
include_path.push("include");
bindings = bindings.clang_arg(format!("-I{}", include_path.display()));
image_bindings = image_bindings.clang_arg(format!("-I{}", include_path.display()));
ttf_bindings = ttf_bindings.clang_arg(format!("-I{}", include_path.display()));
} else {
// if paths are included, use them for bindgen. Bindgen should use the first one.
for headers_path in headers_paths {
bindings = bindings.clang_arg(format!("-I{}", headers_path.as_ref()));
image_bindings = image_bindings.clang_arg(format!("-I{}", headers_path.as_ref()));
ttf_bindings = ttf_bindings.clang_arg(format!("-I{}", headers_path.as_ref()));
}
}
@@ -330,6 +339,12 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
image_bindings = image_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt"));
image_bindings = image_bindings.clang_arg(format!("-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include"));
image_bindings = image_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/8.1/Include/um"));
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/8.1/Include/shared"));
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files/LLVM/lib/clang/5.0.0/include"));
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt"));
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include"));
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/8.1/Include/um"));
};
// SDL2 hasn't a default configuration for Linux
@@ -338,6 +353,8 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
bindings = bindings.clang_arg("-DSDL_VIDEO_DRIVER_WAYLAND");
image_bindings = image_bindings.clang_arg("-DSDL_VIDEO_DRIVER_X11");
image_bindings = image_bindings.clang_arg("-DSDL_VIDEO_DRIVER_WAYLAND");
ttf_bindings = ttf_bindings.clang_arg("-DSDL_VIDEO_DRIVER_X11");
ttf_bindings = ttf_bindings.clang_arg("-DSDL_VIDEO_DRIVER_WAYLAND");
}
let bindings = bindings
@@ -370,6 +387,22 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
.write_to_file(out_path.join("image_bindings.rs"))
.expect("Couldn't write image_bindings!");
let ttf_bindings = ttf_bindings
.header("wrapper_ttf.h")
.whitelist_type("TTF.*")
.whitelist_function("TTF.*")
.whitelist_var("TTF.*")
.blacklist_type("SDL_.*")
.blacklist_type("_IO.*|FILE")
.generate()
.expect("Unable to generate ttf_bindings!");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
ttf_bindings
.write_to_file(out_path.join("ttf_bindings.rs"))
.expect("Couldn't write ttf_bindings!");
}
fn get_os_from_triple(triple: &str) -> Option<&str>

View File

@@ -0,0 +1,288 @@
/* automatically generated by rust-bindgen */
pub const TTF_MAJOR_VERSION: u32 = 2;
pub const TTF_MINOR_VERSION: u32 = 0;
pub const TTF_PATCHLEVEL: u32 = 14;
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_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 = ::std::os::raw::c_uchar;
pub type __uint16_t = ::std::os::raw::c_ushort;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
pub type Uint8 = u8;
pub type Uint16 = u16;
pub type Uint32 = u32;
pub type Sint64 = i64;
extern "C" {
pub fn TTF_Linked_Version() -> *const SDL_version;
}
extern "C" {
pub fn TTF_ByteSwappedUNICODE(swapped: ::std::os::raw::c_int);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _TTF_Font {
_unused: [u8; 0],
}
pub type TTF_Font = _TTF_Font;
extern "C" {
pub fn TTF_Init() -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_OpenFont(
file: *const ::std::os::raw::c_char,
ptsize: ::std::os::raw::c_int,
) -> *mut TTF_Font;
}
extern "C" {
pub fn TTF_OpenFontIndex(
file: *const ::std::os::raw::c_char,
ptsize: ::std::os::raw::c_int,
index: ::std::os::raw::c_long,
) -> *mut TTF_Font;
}
extern "C" {
pub fn TTF_OpenFontRW(
src: *mut SDL_RWops,
freesrc: ::std::os::raw::c_int,
ptsize: ::std::os::raw::c_int,
) -> *mut TTF_Font;
}
extern "C" {
pub fn TTF_OpenFontIndexRW(
src: *mut SDL_RWops,
freesrc: ::std::os::raw::c_int,
ptsize: ::std::os::raw::c_int,
index: ::std::os::raw::c_long,
) -> *mut TTF_Font;
}
extern "C" {
pub fn TTF_GetFontStyle(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_SetFontStyle(font: *mut TTF_Font, style: ::std::os::raw::c_int);
}
extern "C" {
pub fn TTF_GetFontOutline(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_SetFontOutline(font: *mut TTF_Font, outline: ::std::os::raw::c_int);
}
extern "C" {
pub fn TTF_GetFontHinting(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_SetFontHinting(font: *mut TTF_Font, hinting: ::std::os::raw::c_int);
}
extern "C" {
pub fn TTF_FontHeight(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_FontAscent(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_FontDescent(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_FontLineSkip(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_GetFontKerning(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_SetFontKerning(font: *mut TTF_Font, allowed: ::std::os::raw::c_int);
}
extern "C" {
pub fn TTF_FontFaces(font: *const TTF_Font) -> ::std::os::raw::c_long;
}
extern "C" {
pub fn TTF_FontFaceIsFixedWidth(font: *const TTF_Font) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_FontFaceFamilyName(font: *const TTF_Font) -> *mut ::std::os::raw::c_char;
}
extern "C" {
pub fn TTF_FontFaceStyleName(font: *const TTF_Font) -> *mut ::std::os::raw::c_char;
}
extern "C" {
pub fn TTF_GlyphIsProvided(font: *const TTF_Font, ch: Uint16) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_GlyphMetrics(
font: *mut TTF_Font,
ch: Uint16,
minx: *mut ::std::os::raw::c_int,
maxx: *mut ::std::os::raw::c_int,
miny: *mut ::std::os::raw::c_int,
maxy: *mut ::std::os::raw::c_int,
advance: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_SizeText(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
w: *mut ::std::os::raw::c_int,
h: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_SizeUTF8(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
w: *mut ::std::os::raw::c_int,
h: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_SizeUNICODE(
font: *mut TTF_Font,
text: *const Uint16,
w: *mut ::std::os::raw::c_int,
h: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_RenderText_Solid(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUTF8_Solid(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUNICODE_Solid(
font: *mut TTF_Font,
text: *const Uint16,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderGlyph_Solid(
font: *mut TTF_Font,
ch: Uint16,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderText_Shaded(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUTF8_Shaded(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUNICODE_Shaded(
font: *mut TTF_Font,
text: *const Uint16,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderGlyph_Shaded(
font: *mut TTF_Font,
ch: Uint16,
fg: SDL_Color,
bg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderText_Blended(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUTF8_Blended(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUNICODE_Blended(
font: *mut TTF_Font,
text: *const Uint16,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderText_Blended_Wrapped(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
wrapLength: Uint32,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUTF8_Blended_Wrapped(
font: *mut TTF_Font,
text: *const ::std::os::raw::c_char,
fg: SDL_Color,
wrapLength: Uint32,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderUNICODE_Blended_Wrapped(
font: *mut TTF_Font,
text: *const Uint16,
fg: SDL_Color,
wrapLength: Uint32,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_RenderGlyph_Blended(
font: *mut TTF_Font,
ch: Uint16,
fg: SDL_Color,
) -> *mut SDL_Surface;
}
extern "C" {
pub fn TTF_CloseFont(font: *mut TTF_Font);
}
extern "C" {
pub fn TTF_Quit();
}
extern "C" {
pub fn TTF_WasInit() -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_GetFontKerningSize(
font: *mut TTF_Font,
prev_index: ::std::os::raw::c_int,
index: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn TTF_GetFontKerningSizeGlyphs(
font: *mut TTF_Font,
previous_ch: Uint16,
ch: Uint16,
) -> ::std::os::raw::c_int;
}

View File

@@ -1,97 +1,2 @@
use std::os::raw::{c_int, c_char, c_long, c_void};
use ::{SDL_Surface, SDL_Color, SDL_RWops};
pub const TTF_STYLE_NORMAL : c_int = 0x00;
pub const TTF_STYLE_BOLD : c_int = 0x01;
pub const TTF_STYLE_ITALIC : c_int = 0x02;
pub const TTF_STYLE_UNDERLINE : c_int = 0x04;
pub const TTF_STYLE_STRIKETHROUGH : c_int = 0x08;
pub const TTF_HINTING_NORMAL : c_int = 0;
pub const TTF_HINTING_LIGHT : c_int = 1;
pub const TTF_HINTING_MONO : c_int = 2;
pub const TTF_HINTING_NONE : c_int = 3;
pub type TTF_Font = c_void;
extern "C" {
pub fn TTF_Linked_Version() -> *const ::SDL_version;
pub fn TTF_ByteSwappedUNICODE(swapped: c_int);
pub fn TTF_Init() -> c_int;
pub fn TTF_OpenFont(file: *const c_char, ptsize: c_int) -> *const TTF_Font;
pub fn TTF_OpenFontIndex(file: *const c_char, ptsize: c_int, index: c_long) ->
*const TTF_Font;
pub fn TTF_OpenFontRW(src: *const SDL_RWops, freesrc: c_int, ptsize: c_int)
-> *const TTF_Font;
pub fn TTF_OpenFontIndexRW(src: *const SDL_RWops, freesrc: c_int,
ptsize: c_int, index: c_long) -> *const TTF_Font;
pub fn TTF_GetFontStyle(font: *const TTF_Font) -> c_int;
pub fn TTF_SetFontStyle(font: *const TTF_Font, style: c_int);
pub fn TTF_GetFontOutline(font: *const TTF_Font) -> c_int;
pub fn TTF_SetFontOutline(font: *const TTF_Font, outline: c_int);
pub fn TTF_GetFontHinting(font: *const TTF_Font) -> c_int;
pub fn TTF_SetFontHinting(font: *const TTF_Font, hinting: c_int);
pub fn TTF_FontHeight(font: *const TTF_Font) -> c_int;
pub fn TTF_FontAscent(font: *const TTF_Font) -> c_int;
pub fn TTF_FontDescent(font: *const TTF_Font) -> c_int;
pub fn TTF_FontLineSkip(font: *const TTF_Font) -> c_int;
pub fn TTF_GetFontKerning(font: *const TTF_Font) -> c_int;
pub fn TTF_SetFontKerning(font: *const TTF_Font, allowed: c_int);
pub fn TTF_FontFaces(font: *const TTF_Font) -> c_long;
pub fn TTF_FontFaceIsFixedWidth(font: *const TTF_Font) -> c_int;
pub fn TTF_FontFaceFamilyName(font: *const TTF_Font) -> *const c_char;
pub fn TTF_FontFaceStyleName(font: *const TTF_Font) -> *const c_char;
pub fn TTF_GlyphIsProvided(font: *const TTF_Font, ch: u16) -> c_int;
pub fn TTF_GlyphMetrics(font: *const TTF_Font, ch: u16, minx: *const c_int,
maxx: *const c_int, miny: *const c_int,
maxy: *const c_int, advance: *const c_int) -> c_int;
pub fn TTF_SizeText(font: *const TTF_Font, text: *const c_char, w: *const c_int,
h: *const c_int) -> c_int;
pub fn TTF_SizeUTF8(font: *const TTF_Font, text: *const c_char, w: *mut c_int,
h: *mut c_int) -> c_int;
pub fn TTF_SizeUNICODE(font: *const TTF_Font, text: *const u16, w: *mut c_int,
h: *mut c_int) -> c_int;
pub fn TTF_RenderText_Solid(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_RenderUTF8_Solid(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_RenderUNICODE_Solid(font: *const TTF_Font, text: *const u16,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_RenderGlyph_Solid(font: *const TTF_Font, ch: u16,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_RenderText_Shaded(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color, bg: SDL_Color) ->
*mut SDL_Surface;
pub fn TTF_RenderUTF8_Shaded(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color, bg: SDL_Color) ->
*mut SDL_Surface;
pub fn TTF_RenderUNICODE_Shaded(font: *const TTF_Font, text: *const u16,
fg: SDL_Color, bg: SDL_Color) ->
*mut SDL_Surface;
pub fn TTF_RenderGlyph_Shaded(font: *const TTF_Font, ch: u16,
fg: SDL_Color, bg: SDL_Color) ->
*mut SDL_Surface;
pub fn TTF_RenderText_Blended(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_RenderUTF8_Blended(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_RenderUNICODE_Blended(font: *const TTF_Font, text: *const u16,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_RenderText_Blended_Wrapped(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color, wrapLength: u32)
-> *mut SDL_Surface;
pub fn TTF_RenderUTF8_Blended_Wrapped(font: *const TTF_Font, text: *const c_char,
fg: SDL_Color, wrapLength: u32)
-> *mut SDL_Surface;
pub fn TTF_RenderUNICODE_Blended_Wrapped(font: *const TTF_Font,
text: *const u16, fg: SDL_Color,
wrapLength: u32) ->
*const SDL_Surface;
pub fn TTF_RenderGlyph_Blended(font: *const TTF_Font, ch: u16,
fg: SDL_Color) -> *mut SDL_Surface;
pub fn TTF_CloseFont(font: *const TTF_Font);
pub fn TTF_Quit();
pub fn TTF_WasInit() -> c_int;
pub fn TTF_GetFontKerningSize(font: *const TTF_Font, prev_index: c_int,
index: c_int) -> c_int;
}
use ::*;
include!(concat!(env!("OUT_DIR"), "/ttf_bindings.rs"));

1
sdl2-sys/wrapper_ttf.h Normal file
View File

@@ -0,0 +1 @@
#include <SDL2/SDL_ttf.h>

View File

@@ -1,5 +1,5 @@
use std::ffi::{CString, CStr};
use std::os::raw::{c_int, c_long};
use std::os::raw::{c_uint, c_int, c_long};
use std::path::Path;
use std::error;
use std::error::Error;
@@ -238,7 +238,7 @@ impl<'f,'text> PartialRendering<'f,'text> {
/// A loaded TTF font.
pub struct Font<'ttf_module,'rwops> {
raw: *const sys::ttf::TTF_Font,
raw: *mut sys::ttf::TTF_Font,
// RWops is only stored here because it must not outlive
// the Font struct, and this RWops should not be used by
// anything else
@@ -278,7 +278,7 @@ pub fn internal_load_font<'ttf,P:AsRef<Path>>(path: P, ptsize: u16) -> Result<Fo
}
/// Internally used to load a font (for internal visibility).
pub fn internal_load_font_from_ll<'ttf,'r, R>(raw: *const sys::ttf::TTF_Font, rwops: R)
pub fn internal_load_font_from_ll<'ttf,'r, R>(raw: *mut sys::ttf::TTF_Font, rwops: R)
-> Font<'ttf,'r>
where R: Into<Option<RWops<'r>>> {
Font { raw: raw, rwops: rwops.into(), _marker: PhantomData }
@@ -302,7 +302,7 @@ pub fn internal_load_font_at_index<'ttf,P: AsRef<Path>>(path: P, index: u32, pts
impl<'ttf,'r> Font<'ttf,'r> {
/// Returns the underlying C font object.
unsafe fn raw(&self) -> *const sys::ttf::TTF_Font {
unsafe fn raw(&self) -> *mut sys::ttf::TTF_Font {
self.raw
}
@@ -356,9 +356,9 @@ impl<'ttf,'r> Font<'ttf,'r> {
-> FontResult<(u32, u32)> {
let c_string = try!(RenderableText::Latin1(text).convert());
let (res, size) = unsafe {
let mut w = 0; // mutated by C code
let mut h = 0; // mutated by C code
let ret = sys::ttf::TTF_SizeText(self.raw, c_string.as_ptr(), &w, &h);
let mut w : i32 = 0; // mutated by C code
let mut h : i32 = 0; // mutated by C code
let ret = sys::ttf::TTF_SizeText(self.raw, c_string.as_ptr(), &w as *const _ as *mut i32, &h as *const _ as *mut i32);
(ret, (w as u32, h as u32))
};
if res == 0 {
@@ -408,7 +408,7 @@ impl<'ttf,'r> Font<'ttf,'r> {
/// Returns the font's freetype hints.
pub fn get_hinting(&self) -> Hinting {
unsafe {
match sys::ttf::TTF_GetFontHinting(self.raw) as c_int {
match sys::ttf::TTF_GetFontHinting(self.raw) as c_uint {
sys::ttf::TTF_HINTING_NORMAL => Hinting::Normal,
sys::ttf::TTF_HINTING_LIGHT => Hinting::Light,
sys::ttf::TTF_HINTING_MONO => Hinting::Mono,
@@ -527,7 +527,13 @@ impl<'ttf,'r> Font<'ttf,'r> {
let advance = 0;
let ret = unsafe {
sys::ttf::TTF_GlyphMetrics(
self.raw, ch as u16, &minx, &maxx, &miny, &maxy, &advance
self.raw,
ch as u16,
&minx as *const _ as *mut _,
&maxx as *const _ as *mut _,
&miny as *const _ as *mut _,
&maxy as *const _ as *mut _,
&advance as *const _ as *mut _
)
};
if ret == 0 {