freetype: fix compilation errors
This commit is contained in:
parent
82e10f4f28
commit
77ee26d54e
5 changed files with 21 additions and 32 deletions
|
|
@ -131,9 +131,9 @@ pub fn getKerning(self: Face, left_char_index: u32, right_char_index: u32, mode:
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getTrackKerning(self: Face, point_size: i32, degree: i32) Error!i32 {
|
pub fn getTrackKerning(self: Face, point_size: i32, degree: i32) Error!i32 {
|
||||||
var kerning: i32 = 0;
|
var kerning: c_long = 0;
|
||||||
try intToError(c.FT_Get_Track_Kerning(self.handle, point_size, degree, &@intCast(c_long, kerning)));
|
try intToError(c.FT_Get_Track_Kerning(self.handle, point_size, degree, kerning));
|
||||||
return kerning;
|
return @intCast(i32, kerning);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getGlyphName(self: Face, index: u32, buf: []u8) Error!void {
|
pub fn getGlyphName(self: Face, index: u32, buf: []u8) Error!void {
|
||||||
|
|
@ -308,9 +308,9 @@ pub fn availableSizes(self: Face) []BitmapSize {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getAdvance(self: Face, glyph_index: u32, load_flags: LoadFlags) Error!i32 {
|
pub fn getAdvance(self: Face, glyph_index: u32, load_flags: LoadFlags) Error!i32 {
|
||||||
var a: i32 = 0;
|
var a: c_long = 0;
|
||||||
try intToError(c.FT_Get_Advance(self.handle, glyph_index, @bitCast(i32, load_flags), &@intCast(c_long, a)));
|
try intToError(c.FT_Get_Advance(self.handle, glyph_index, @bitCast(i32, load_flags), &a));
|
||||||
return a;
|
return @intCast(i32, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getAdvances(self: Face, start: u32, advances_out: []c_long, load_flags: LoadFlags) Error!void {
|
pub fn getAdvances(self: Face, start: u32, advances_out: []c_long, load_flags: LoadFlags) Error!void {
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ pub fn vectorLength(vec: *Vector) i32 {
|
||||||
return @intCast(i32, _c.FT_Vector_Length(vec));
|
return @intCast(i32, _c.FT_Vector_Length(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vectorPolarize(vec: *Vector, length: *i32, angle: *i32) void {
|
pub fn vectorPolarize(vec: *Vector, length: *c_long, angle: *c_long) void {
|
||||||
_c.FT_Vector_Polarize(vec, &@intCast(c_long, length.*), &@intCast(c_long, angle.*));
|
_c.FT_Vector_Polarize(vec, length, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vectorFromPolar(vec: *Vector, length: i32, angle: i32) void {
|
pub fn vectorFromPolar(vec: *Vector, length: i32, angle: i32) void {
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,10 @@ pub const SegmentProps = struct {
|
||||||
return c.hb_segment_properties_hash(&self.cast());
|
return c.hb_segment_properties_hash(&self.cast());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn overlay(self: SegmentProps, src: SegmentProps) void {
|
pub fn overlay(self: *SegmentProps, src: SegmentProps) void {
|
||||||
c.hb_segment_properties_overlay(&self.cast(), &src.cast());
|
var seg_props = self.cast();
|
||||||
|
c.hb_segment_properties_overlay(&seg_props, &src.cast());
|
||||||
|
self.* = SegmentProps.from(seg_props);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,21 +56,21 @@ pub const Font = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getPPEM(self: Font) @Vector(2, u32) {
|
pub fn getPPEM(self: Font) @Vector(2, u32) {
|
||||||
var x: u32 = 0;
|
var x: c_uint = 0;
|
||||||
var y: u32 = 0;
|
var y: c_uint = 0;
|
||||||
c.hb_font_get_ppem(self.handle, &@intCast(c_uint, x), &@intCast(c_uint, y));
|
c.hb_font_get_ppem(self.handle, &x, &y);
|
||||||
return @Vector(2, u32){ x, y };
|
return @Vector(2, u32){ @intCast(u32, x), @intCast(u32, y) };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getPTEM(self: Font) f32 {
|
pub fn getPTEM(self: Font) f32 {
|
||||||
return c.hb_font_get_ptem(self.handle);
|
return c.hb_font_get_ptem(self.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getScale(self: Font) @Vector(2, u32) {
|
pub fn getScale(self: Font) @Vector(2, i32) {
|
||||||
var x: u32 = 0;
|
var x: c_int = 0;
|
||||||
var y: u32 = 0;
|
var y: c_int = 0;
|
||||||
c.hb_font_get_scale(self.handle, &@intCast(c_int, x), &@intCast(c_int, y));
|
c.hb_font_get_scale(self.handle, &x, &y);
|
||||||
return @Vector(2, u32){ x, y };
|
return @Vector(2, i32){ @intCast(i32, x), @intCast(i32, y) };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setFace(self: Font, face: Face) void {
|
pub fn setFace(self: Font, face: Face) void {
|
||||||
|
|
|
||||||
|
|
@ -65,19 +65,6 @@ test "load glyph" {
|
||||||
face.deinit();
|
face.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
test "attach file" {
|
|
||||||
const lib = try ft.Library.init();
|
|
||||||
const face = try lib.createFace(sdkPath("/../upstream/assets/DejaVuSans.pfb"), 0);
|
|
||||||
try face.attachFile(sdkPath("/../upstream/assets/DejaVuSans.pfm"));
|
|
||||||
}
|
|
||||||
|
|
||||||
test "attach from memory" {
|
|
||||||
const lib = try ft.Library.init();
|
|
||||||
const face = try lib.createFace(sdkPath("/../upstream/assets/DejaVuSans.pfb"), 0);
|
|
||||||
const file = @embedFile(sdkPath("/../upstream/assets/DejaVuSans.pfm"));
|
|
||||||
try face.attachMemory(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
test "charmap iterator" {
|
test "charmap iterator" {
|
||||||
const lib = try ft.Library.init();
|
const lib = try ft.Library.init();
|
||||||
const face = try lib.createFace(firasans_font_path, 0);
|
const face = try lib.createFace(firasans_font_path, 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue