freetype: support compiling with stage2 (-fno-stage1)

This commit is contained in:
PiergiorgioZagaria 2022-07-06 11:59:28 +02:00 committed by Stephen Gutekanst
parent d3b03901fb
commit b4ac18ec57
10 changed files with 61 additions and 29 deletions

View file

@ -333,7 +333,7 @@ pub const Buffer = struct {
pub fn getGlyphPositions(self: Buffer) ?[]Position {
return if (hb_buffer_get_glyph_positions(self.handle, null)) |positions|
positions[0..self.getLength()]
@ptrCast([*]Position, positions)[0..self.getLength()]
else
null;
}

View file

@ -13,7 +13,7 @@ pub const Direction = enum(u3) {
}
pub fn toString(self: Direction) [:0]const u8 {
return std.mem.span(c.hb_direction_to_string(@enumToInt(self)));
return std.mem.span(@ptrCast([*:0]const u8, c.hb_direction_to_string(@enumToInt(self))));
}
};
@ -210,7 +210,7 @@ pub const Language = struct {
}
pub fn toString(self: Language) [:0]const u8 {
return std.mem.span(c.hb_language_to_string(self.handle));
return std.mem.span(@ptrCast([*:0]const u8, c.hb_language_to_string(self.handle)));
}
pub fn getDefault() Language {

View file

@ -11,8 +11,9 @@ pub const ListShapers = struct {
pub fn next(self: *ListShapers) ?[:0]const u8 {
self.index += 1;
return std.mem.span(
return std.mem.span(@ptrCast(
?[*:0]const u8,
self.list[self.index - 1] orelse return null,
);
));
}
};

View file

@ -68,7 +68,7 @@ pub const ShapePlan = struct {
}
pub fn getShaper(self: ShapePlan) [:0]const u8 {
return std.mem.span(c.hb_shape_plan_get_shaper(self.handle));
return std.mem.span(@ptrCast([*:0]const u8, c.hb_shape_plan_get_shaper(self.handle)));
}
};