Skip to content

Commit

Permalink
Enable using OT SVG in FreeType
Browse files Browse the repository at this point in the history
  • Loading branch information
tchayen committed Aug 26, 2024
1 parent 86fc802 commit 977ab24
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/freetype.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pub const c = @cImport({
@cInclude("freetype/ftstroke.h");
@cInclude("freetype/fttrigon.h");
@cInclude("freetype/ftsynth.h");
@cInclude("freetype/otsvg.h");
@cInclude("freetype/ftmodapi.h");
});

pub const Affine23 = c.FT_Affine23;
Expand Down Expand Up @@ -275,7 +277,8 @@ pub const LoadFlags = packed struct(c_int) {
color: bool = false,
compute_metrics: bool = false,
bitmap_metrics_only: bool = false,
_padding0: u9 = 0,
no_svg: bool = false,
_padding0: u8 = 0,
};

pub const OpenFlags = packed struct(c_int) {
Expand Down Expand Up @@ -1044,6 +1047,10 @@ pub const Library = struct {
pub fn setLcdFilter(self: Library, lcd_filter: LcdFilter) Error!void {
return intToError(c.FT_Library_SetLcdFilter(self.handle, @intFromEnum(lcd_filter)));
}

pub fn setProperty(self: Library, module_name: [*c]const u8, property_name: [*c]const u8, value: *const anyopaque) Error!void {
return intToError(c.FT_Property_Set(self.handle, module_name, property_name, value));
}
};

pub const OpenArgs = struct {
Expand Down Expand Up @@ -1567,6 +1574,7 @@ pub const Error = error{
BbxTooBig,
CorruptedFontHeader,
CorruptedFontGlyphs,
MissingSVGHooks,
};

pub fn intToError(err: c_int) Error!void {
Expand Down Expand Up @@ -1661,6 +1669,7 @@ pub fn intToError(err: c_int) Error!void {
c.FT_Err_Bbx_Too_Big => Error.BbxTooBig,
c.FT_Err_Corrupted_Font_Header => Error.CorruptedFontHeader,
c.FT_Err_Corrupted_Font_Glyphs => Error.CorruptedFontGlyphs,
c.FT_Err_Missing_SVG_Hooks => Error.MissingSVGHooks,
else => unreachable,
};
}
Expand Down

0 comments on commit 977ab24

Please sign in to comment.