freetype: complete *Quick retrieval of advance value* binding

This commit is contained in:
Ali Chraghi 2022-08-25 17:18:28 +04:30 committed by Stephen Gutekanst
parent b471a9cc98
commit f6f1187526
2 changed files with 11 additions and 0 deletions

View file

@ -308,6 +308,16 @@ pub fn availableSizes(self: Face) ?BitmapSize {
null; null;
} }
pub fn getAdvance(self: Face, glyph_index: u32, load_flags: LoadFlags) Error!i32 {
var a: i32 = 0;
try intToError(c.FT_Get_Advance(self.handle, glyph_index, load_flags.cast(), &@intCast(c_long, a)));
return a;
}
pub fn getAdvances(self: Face, start: u32, advances_out: []c_long, load_flags: LoadFlags) Error!void {
try intToError(c.FT_Get_Advances(self.handle, start, @intCast(c_uint, advances_out.len), load_flags.cast(), advances_out.ptr));
}
pub fn numCharmaps(self: Face) u32 { pub fn numCharmaps(self: Face) u32 {
return @intCast(u32, self.handle.*.num_charmaps); return @intCast(u32, self.handle.*.num_charmaps);
} }

View file

@ -1,5 +1,6 @@
pub usingnamespace @cImport({ pub usingnamespace @cImport({
@cInclude("hb-ft.h"); @cInclude("hb-ft.h");
@cInclude("freetype/ftadvanc.h");
@cInclude("freetype/ftbbox.h"); @cInclude("freetype/ftbbox.h");
@cInclude("freetype/ftbitmap.h"); @cInclude("freetype/ftbitmap.h");
@cInclude("freetype/ftcolor.h"); @cInclude("freetype/ftcolor.h");