freetype/harfbuzz: implement freetype integration functions
This commit is contained in:
parent
ef7904bf27
commit
52a67b1809
2 changed files with 22 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
const freetype = @import("freetype");
|
||||
const c = @import("c");
|
||||
const Blob = @import("blob.zig").Blob;
|
||||
|
||||
|
|
@ -21,6 +22,10 @@ pub const Face = struct {
|
|||
return .{ .handle = c.hb_face_create(blob.handle, index).? };
|
||||
}
|
||||
|
||||
pub fn fromFtFace(face: freetype.Face) Face {
|
||||
return .{ .handle = c.hb_ft_face_create_referenced(face.handle).? };
|
||||
}
|
||||
|
||||
pub fn initEmpty() Face {
|
||||
return .{ .handle = c.hb_face_get_empty().? };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
const freetype = @import("freetype");
|
||||
const c = @import("c");
|
||||
const Face = @import("face.zig").Face;
|
||||
const Buffer = @import("buffer.zig").Buffer;
|
||||
|
|
@ -11,6 +12,10 @@ pub const Font = struct {
|
|||
return .{ .handle = c.hb_font_create(face.handle).? };
|
||||
}
|
||||
|
||||
pub fn fromFtFace(face: freetype.Face) Font {
|
||||
return .{ .handle = c.hb_ft_font_create_referenced(face.handle).? };
|
||||
}
|
||||
|
||||
pub fn createSubFont(self: Font) Font {
|
||||
return .{
|
||||
.handle = c.hb_font_create_sub_font(self.handle).?,
|
||||
|
|
@ -21,10 +26,22 @@ pub const Font = struct {
|
|||
c.hb_font_destroy(self.handle);
|
||||
}
|
||||
|
||||
pub fn ftFaceChanged(self: Font) void {
|
||||
c.hb_ft_font_changed(self.handle);
|
||||
}
|
||||
|
||||
pub fn setFtLoadFlags(self: Font, flags: freetype.LoadFlags) void {
|
||||
c.hb_ft_font_set_load_flags(self.handle, flags.cast());
|
||||
}
|
||||
|
||||
pub fn getFace(self: Font) Face {
|
||||
return .{ .handle = c.hb_font_get_face(self.handle).? };
|
||||
}
|
||||
|
||||
pub fn getFreetypeFace(self: Font) freetype.Face {
|
||||
return .{ .handle = c.hb_ft_font_get_face(self.handle) };
|
||||
}
|
||||
|
||||
pub fn getGlyph(self: Font, unicode: u32, variation_selector: u32) ?u32 {
|
||||
var g: u32 = 0;
|
||||
return if (c.hb_font_get_glyph(self.handle, unicode, variation_selector, &g) > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue