freetype: rename convertError to intToError
This commit is contained in:
parent
b92770404f
commit
643753c80a
9 changed files with 129 additions and 35 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const c = @import("c.zig");
|
const c = @import("c.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
|
|
||||||
const Bitmap = @This();
|
const Bitmap = @This();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ const std = @import("std");
|
||||||
const c = @import("c.zig");
|
const c = @import("c.zig");
|
||||||
const Bitmap = @import("Bitmap.zig");
|
const Bitmap = @import("Bitmap.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
|
|
||||||
const BitmapGlyph = @This();
|
const BitmapGlyph = @This();
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ pub fn deinit(self: BitmapGlyph) void {
|
||||||
|
|
||||||
pub fn clone(self: BitmapGlyph) Error!BitmapGlyph {
|
pub fn clone(self: BitmapGlyph) Error!BitmapGlyph {
|
||||||
var res = std.mem.zeroes(c.FT_Glyph);
|
var res = std.mem.zeroes(c.FT_Glyph);
|
||||||
try convertError(c.FT_Glyph_Copy(@ptrCast(c.FT_Glyph, self.handle), &res));
|
try intToError(c.FT_Glyph_Copy(@ptrCast(c.FT_Glyph, self.handle), &res));
|
||||||
return BitmapGlyph.init(@ptrCast(c.FT_BitmapGlyph, res));
|
return BitmapGlyph.init(@ptrCast(c.FT_BitmapGlyph, res));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const types = @import("types.zig");
|
||||||
const GlyphSlot = @import("GlyphSlot.zig");
|
const GlyphSlot = @import("GlyphSlot.zig");
|
||||||
const Library = @import("Library.zig");
|
const Library = @import("Library.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
const utils = @import("utils.zig");
|
const utils = @import("utils.zig");
|
||||||
|
|
||||||
const Face = @This();
|
const Face = @This();
|
||||||
|
|
@ -98,7 +98,7 @@ pub fn init(handle: c.FT_Face) Face {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: Face) void {
|
pub fn deinit(self: Face) void {
|
||||||
convertError(c.FT_Done_Face(self.handle)) catch |err| {
|
intToError(c.FT_Done_Face(self.handle)) catch |err| {
|
||||||
std.log.err("mach/freetype: Failed to destroy Face: {}", .{err});
|
std.log.err("mach/freetype: Failed to destroy Face: {}", .{err});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -118,23 +118,23 @@ pub fn attachMemory(self: Face, bytes: []const u8) Error!void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn attachStream(self: Face, args: types.OpenArgs) Error!void {
|
pub fn attachStream(self: Face, args: types.OpenArgs) Error!void {
|
||||||
return convertError(c.FT_Attach_Stream(self.handle, &args.toCInterface()));
|
return intToError(c.FT_Attach_Stream(self.handle, &args.toCInterface()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setCharSize(self: Face, pt_width: i32, pt_height: i32, horz_resolution: u16, vert_resolution: u16) Error!void {
|
pub fn setCharSize(self: Face, pt_width: i32, pt_height: i32, horz_resolution: u16, vert_resolution: u16) Error!void {
|
||||||
return convertError(c.FT_Set_Char_Size(self.handle, pt_width, pt_height, horz_resolution, vert_resolution));
|
return intToError(c.FT_Set_Char_Size(self.handle, pt_width, pt_height, horz_resolution, vert_resolution));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setPixelSizes(self: Face, pixel_width: u32, pixel_height: u32) Error!void {
|
pub fn setPixelSizes(self: Face, pixel_width: u32, pixel_height: u32) Error!void {
|
||||||
return convertError(c.FT_Set_Pixel_Sizes(self.handle, pixel_width, pixel_height));
|
return intToError(c.FT_Set_Pixel_Sizes(self.handle, pixel_width, pixel_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn loadGlyph(self: Face, index: u32, flags: LoadFlags) Error!void {
|
pub fn loadGlyph(self: Face, index: u32, flags: LoadFlags) Error!void {
|
||||||
return convertError(c.FT_Load_Glyph(self.handle, index, flags.toBitFields()));
|
return intToError(c.FT_Load_Glyph(self.handle, index, flags.toBitFields()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn loadChar(self: Face, char: u32, flags: LoadFlags) Error!void {
|
pub fn loadChar(self: Face, char: u32, flags: LoadFlags) Error!void {
|
||||||
return convertError(c.FT_Load_Char(self.handle, char, flags.toBitFields()));
|
return intToError(c.FT_Load_Char(self.handle, char, flags.toBitFields()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setTransform(self: Face, matrix: ?types.Matrix, delta: ?types.Vector) Error!void {
|
pub fn setTransform(self: Face, matrix: ?types.Matrix, delta: ?types.Vector) Error!void {
|
||||||
|
|
@ -150,7 +150,7 @@ pub fn getCharIndex(self: Face, index: u32) ?u32 {
|
||||||
|
|
||||||
pub fn getKerning(self: Face, left_char_index: u32, right_char_index: u32, mode: KerningMode) Error!types.Vector {
|
pub fn getKerning(self: Face, left_char_index: u32, right_char_index: u32, mode: KerningMode) Error!types.Vector {
|
||||||
var vec = std.mem.zeroes(types.Vector);
|
var vec = std.mem.zeroes(types.Vector);
|
||||||
try convertError(c.FT_Get_Kerning(self.handle, left_char_index, right_char_index, @enumToInt(mode), @ptrCast(*c.FT_Vector, &vec)));
|
try intToError(c.FT_Get_Kerning(self.handle, left_char_index, right_char_index, @enumToInt(mode), @ptrCast(*c.FT_Vector, &vec)));
|
||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const BitmapGlyph = @import("BitmapGlyph.zig");
|
||||||
const Stroker = @import("Stroker.zig");
|
const Stroker = @import("Stroker.zig");
|
||||||
const types = @import("types.zig");
|
const types = @import("types.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
|
|
||||||
const Glyph = @This();
|
const Glyph = @This();
|
||||||
|
|
||||||
|
|
@ -38,14 +38,14 @@ pub fn deinit(self: Glyph) void {
|
||||||
|
|
||||||
pub fn clone(self: Glyph) Error!Glyph {
|
pub fn clone(self: Glyph) Error!Glyph {
|
||||||
var res = std.mem.zeroes(c.FT_Glyph);
|
var res = std.mem.zeroes(c.FT_Glyph);
|
||||||
try convertError(c.FT_Glyph_Copy(self.handle, &res));
|
try intToError(c.FT_Glyph_Copy(self.handle, &res));
|
||||||
return Glyph.init(res);
|
return Glyph.init(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn transform(self: Glyph, matrix: ?types.Matrix, delta: ?types.Vector) Error!void {
|
pub fn transform(self: Glyph, matrix: ?types.Matrix, delta: ?types.Vector) Error!void {
|
||||||
var m = matrix orelse std.mem.zeroes(types.Matrix);
|
var m = matrix orelse std.mem.zeroes(types.Matrix);
|
||||||
var d = delta orelse std.mem.zeroes(types.Vector);
|
var d = delta orelse std.mem.zeroes(types.Vector);
|
||||||
try convertError(c.FT_Glyph_Transform(self.handle, @ptrCast(*c.FT_Matrix, &m), @ptrCast(*c.FT_Vector, &d)));
|
try intToError(c.FT_Glyph_Transform(self.handle, @ptrCast(*c.FT_Matrix, &m), @ptrCast(*c.FT_Vector, &d)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getCBox(self: Glyph, bbox_mode: BBoxMode) types.BBox {
|
pub fn getCBox(self: Glyph, bbox_mode: BBoxMode) types.BBox {
|
||||||
|
|
@ -57,19 +57,19 @@ pub fn getCBox(self: Glyph, bbox_mode: BBoxMode) types.BBox {
|
||||||
pub fn toBitmap(self: Glyph, render_mode: types.RenderMode, origin: ?types.Vector) Error!BitmapGlyph {
|
pub fn toBitmap(self: Glyph, render_mode: types.RenderMode, origin: ?types.Vector) Error!BitmapGlyph {
|
||||||
var res = self.handle;
|
var res = self.handle;
|
||||||
var o = origin orelse std.mem.zeroes(types.Vector);
|
var o = origin orelse std.mem.zeroes(types.Vector);
|
||||||
try convertError(c.FT_Glyph_To_Bitmap(&res, @enumToInt(render_mode), @ptrCast(*c.FT_Vector, &o), 0));
|
try intToError(c.FT_Glyph_To_Bitmap(&res, @enumToInt(render_mode), @ptrCast(*c.FT_Vector, &o), 0));
|
||||||
return BitmapGlyph.init(@ptrCast(c.FT_BitmapGlyph, self.handle));
|
return BitmapGlyph.init(@ptrCast(c.FT_BitmapGlyph, self.handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stroke(self: Glyph, stroker: Stroker) Error!Glyph {
|
pub fn stroke(self: Glyph, stroker: Stroker) Error!Glyph {
|
||||||
var res = self.handle;
|
var res = self.handle;
|
||||||
try convertError(c.FT_Glyph_Stroke(&res, stroker.handle, 0));
|
try intToError(c.FT_Glyph_Stroke(&res, stroker.handle, 0));
|
||||||
return Glyph.init(res);
|
return Glyph.init(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn strokeBorder(self: Glyph, stroker: Stroker, inside: bool) Error!Glyph {
|
pub fn strokeBorder(self: Glyph, stroker: Stroker, inside: bool) Error!Glyph {
|
||||||
var res = self.handle;
|
var res = self.handle;
|
||||||
try convertError(c.FT_Glyph_StrokeBorder(&res, stroker.handle, if (inside) 1 else 0, 0));
|
try intToError(c.FT_Glyph_StrokeBorder(&res, stroker.handle, if (inside) 1 else 0, 0));
|
||||||
return Glyph.init(res);
|
return Glyph.init(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const Glyph = @import("Glyph.zig");
|
||||||
const Outline = @import("Outline.zig");
|
const Outline = @import("Outline.zig");
|
||||||
const Bitmap = @import("Bitmap.zig");
|
const Bitmap = @import("Bitmap.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
|
|
||||||
const GlyphSlot = @This();
|
const GlyphSlot = @This();
|
||||||
|
|
||||||
|
|
@ -24,18 +24,18 @@ pub fn init(handle: c.FT_GlyphSlot) GlyphSlot {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(self: GlyphSlot, render_mode: types.RenderMode) Error!void {
|
pub fn render(self: GlyphSlot, render_mode: types.RenderMode) Error!void {
|
||||||
return convertError(c.FT_Render_Glyph(self.handle, @enumToInt(render_mode)));
|
return intToError(c.FT_Render_Glyph(self.handle, @enumToInt(render_mode)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn subGlyphInfo(self: GlyphSlot, sub_index: u32) Error!SubGlyphInfo {
|
pub fn subGlyphInfo(self: GlyphSlot, sub_index: u32) Error!SubGlyphInfo {
|
||||||
var info = std.mem.zeroes(SubGlyphInfo);
|
var info = std.mem.zeroes(SubGlyphInfo);
|
||||||
try convertError(c.FT_Get_SubGlyph_Info(self.handle, sub_index, &info.index, &info.flags, &info.arg1, &info.arg2, @ptrCast(*c.FT_Matrix, &info.transform)));
|
try intToError(c.FT_Get_SubGlyph_Info(self.handle, sub_index, &info.index, &info.flags, &info.arg1, &info.arg2, @ptrCast(*c.FT_Matrix, &info.transform)));
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn glyph(self: GlyphSlot) Error!Glyph {
|
pub fn glyph(self: GlyphSlot) Error!Glyph {
|
||||||
var out = std.mem.zeroes(c.FT_Glyph);
|
var out = std.mem.zeroes(c.FT_Glyph);
|
||||||
try convertError(c.FT_Get_Glyph(self.handle, &out));
|
try intToError(c.FT_Get_Glyph(self.handle, &out));
|
||||||
return Glyph.init(out);
|
return Glyph.init(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ const types = @import("types.zig");
|
||||||
const Face = @import("Face.zig");
|
const Face = @import("Face.zig");
|
||||||
const Stroker = @import("Stroker.zig");
|
const Stroker = @import("Stroker.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
|
|
||||||
const Library = @This();
|
const Library = @This();
|
||||||
|
|
||||||
|
|
@ -19,12 +19,12 @@ handle: c.FT_Library,
|
||||||
|
|
||||||
pub fn init() Error!Library {
|
pub fn init() Error!Library {
|
||||||
var ft = std.mem.zeroes(Library);
|
var ft = std.mem.zeroes(Library);
|
||||||
try convertError(c.FT_Init_FreeType(&ft.handle));
|
try intToError(c.FT_Init_FreeType(&ft.handle));
|
||||||
return ft;
|
return ft;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: Library) void {
|
pub fn deinit(self: Library) void {
|
||||||
convertError(c.FT_Done_FreeType(self.handle)) catch |err| {
|
intToError(c.FT_Done_FreeType(self.handle)) catch |err| {
|
||||||
std.log.err("mach/freetype: Failed to deinitialize Library: {}", .{err});
|
std.log.err("mach/freetype: Failed to deinitialize Library: {}", .{err});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -45,16 +45,16 @@ pub fn newFaceMemory(self: Library, bytes: []const u8, face_index: i32) Error!Fa
|
||||||
|
|
||||||
pub fn openFace(self: Library, args: types.OpenArgs, face_index: i32) Error!Face {
|
pub fn openFace(self: Library, args: types.OpenArgs, face_index: i32) Error!Face {
|
||||||
var face = std.mem.zeroes(c.FT_Face);
|
var face = std.mem.zeroes(c.FT_Face);
|
||||||
try convertError(c.FT_Open_Face(self.handle, &args.toCInterface(), face_index, &face));
|
try intToError(c.FT_Open_Face(self.handle, &args.toCInterface(), face_index, &face));
|
||||||
return Face.init(face);
|
return Face.init(face);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn newStroker(self: Library) Error!Stroker {
|
pub fn newStroker(self: Library) Error!Stroker {
|
||||||
var stroker = std.mem.zeroes(c.FT_Stroker);
|
var stroker = std.mem.zeroes(c.FT_Stroker);
|
||||||
try convertError(c.FT_Stroker_New(self.handle, &stroker));
|
try intToError(c.FT_Stroker_New(self.handle, &stroker));
|
||||||
return Stroker.init(stroker);
|
return Stroker.init(stroker);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setLcdFilter(self: Library, lcd_filter: LcdFilter) Error!void {
|
pub fn setLcdFilter(self: Library, lcd_filter: LcdFilter) Error!void {
|
||||||
return convertError(c.FT_Library_SetLcdFilter(self.handle, @enumToInt(lcd_filter)));
|
return intToError(c.FT_Library_SetLcdFilter(self.handle, @enumToInt(lcd_filter)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const c = @import("c.zig");
|
||||||
const types = @import("types.zig");
|
const types = @import("types.zig");
|
||||||
const Glyph = @import("Glyph.zig");
|
const Glyph = @import("Glyph.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
const errorToInt = @import("error.zig").errorToInt;
|
const errorToInt = @import("error.zig").errorToInt;
|
||||||
|
|
||||||
const Outline = @This();
|
const Outline = @This();
|
||||||
|
|
@ -35,7 +35,7 @@ pub fn contours(self: Outline) []const i16 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check(self: Outline) Error!void {
|
pub fn check(self: Outline) Error!void {
|
||||||
try convertError(c.FT_Outline_Check(self.handle));
|
try intToError(c.FT_Outline_Check(self.handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn transform(self: Outline, matrix: ?types.Matrix) void {
|
pub fn transform(self: Outline, matrix: ?types.Matrix) void {
|
||||||
|
|
@ -45,7 +45,7 @@ pub fn transform(self: Outline, matrix: ?types.Matrix) void {
|
||||||
|
|
||||||
pub fn bbox(self: Outline) Error!types.BBox {
|
pub fn bbox(self: Outline) Error!types.BBox {
|
||||||
var res = std.mem.zeroes(types.BBox);
|
var res = std.mem.zeroes(types.BBox);
|
||||||
try convertError(c.FT_Outline_Get_BBox(self.handle, @ptrCast(*c.FT_BBox, &res)));
|
try intToError(c.FT_Outline_Get_BBox(self.handle, @ptrCast(*c.FT_BBox, &res)));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ pub fn OutlineFuncsWrapper(comptime Context: type) type {
|
||||||
|
|
||||||
pub fn decompose(self: Outline, ctx: anytype, callbacks: OutlineFuncs(@TypeOf(ctx))) Error!void {
|
pub fn decompose(self: Outline, ctx: anytype, callbacks: OutlineFuncs(@TypeOf(ctx))) Error!void {
|
||||||
var wrapper = OutlineFuncsWrapper(@TypeOf(ctx)){ .ctx = ctx, .callbacks = callbacks };
|
var wrapper = OutlineFuncsWrapper(@TypeOf(ctx)){ .ctx = ctx, .callbacks = callbacks };
|
||||||
try convertError(c.FT_Outline_Decompose(
|
try intToError(c.FT_Outline_Decompose(
|
||||||
self.handle,
|
self.handle,
|
||||||
&c.FT_Outline_Funcs{
|
&c.FT_Outline_Funcs{
|
||||||
.move_to = @TypeOf(wrapper).move_to,
|
.move_to = @TypeOf(wrapper).move_to,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const c = @import("c.zig");
|
const c = @import("c.zig");
|
||||||
const Error = @import("error.zig").Error;
|
const Error = @import("error.zig").Error;
|
||||||
const convertError = @import("error.zig").convertError;
|
const intToError = @import("error.zig").intToError;
|
||||||
|
|
||||||
const Stroker = @This();
|
const Stroker = @This();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ pub const Error = error{
|
||||||
CorruptedFontGlyphs,
|
CorruptedFontGlyphs,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn convertError(err: c_int) Error!void {
|
pub fn intToError(err: c_int) Error!void {
|
||||||
return switch (err) {
|
return switch (err) {
|
||||||
c.FT_Err_Ok => {},
|
c.FT_Err_Ok => {},
|
||||||
c.FT_Err_Cannot_Open_Resource => Error.CannotOpenResource,
|
c.FT_Err_Cannot_Open_Resource => Error.CannotOpenResource,
|
||||||
|
|
@ -188,9 +188,103 @@ pub fn convertError(err: c_int) Error!void {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn errorToInt(err: Error) c_int {
|
||||||
|
return switch (err) {
|
||||||
|
Error.CannotOpenResource => c.FT_Err_Cannot_Open_Resource,
|
||||||
|
Error.UnknownFileFormat => c.FT_Err_Unknown_File_Format,
|
||||||
|
Error.InvalidFileFormat => c.FT_Err_Invalid_File_Format,
|
||||||
|
Error.InvalidVersion => c.FT_Err_Invalid_Version,
|
||||||
|
Error.LowerModuleVersion => c.FT_Err_Lower_Module_Version,
|
||||||
|
Error.InvalidArgument => c.FT_Err_Invalid_Argument,
|
||||||
|
Error.UnimplementedFeature => c.FT_Err_Unimplemented_Feature,
|
||||||
|
Error.InvalidTable => c.FT_Err_Invalid_Table,
|
||||||
|
Error.InvalidOffset => c.FT_Err_Invalid_Offset,
|
||||||
|
Error.ArrayTooLarge => c.FT_Err_Array_Too_Large,
|
||||||
|
Error.MissingModule => c.FT_Err_Missing_Module,
|
||||||
|
Error.MissingProperty => c.FT_Err_Missing_Property,
|
||||||
|
Error.InvalidGlyphIndex => c.FT_Err_Invalid_Glyph_Index,
|
||||||
|
Error.InvalidCharacterCode => c.FT_Err_Invalid_Character_Code,
|
||||||
|
Error.InvalidGlyphFormat => c.FT_Err_Invalid_Glyph_Format,
|
||||||
|
Error.CannotRenderGlyph => c.FT_Err_Cannot_Render_Glyph,
|
||||||
|
Error.InvalidOutline => c.FT_Err_Invalid_Outline,
|
||||||
|
Error.InvalidComposite => c.FT_Err_Invalid_Composite,
|
||||||
|
Error.TooManyHints => c.FT_Err_Too_Many_Hints,
|
||||||
|
Error.InvalidPixelSize => c.FT_Err_Invalid_Pixel_Size,
|
||||||
|
Error.InvalidHandle => c.FT_Err_Invalid_Handle,
|
||||||
|
Error.InvalidLibraryHandle => c.FT_Err_Invalid_Library_Handle,
|
||||||
|
Error.InvalidDriverHandle => c.FT_Err_Invalid_Driver_Handle,
|
||||||
|
Error.InvalidFaceHandle => c.FT_Err_Invalid_Face_Handle,
|
||||||
|
Error.InvalidSizeHandle => c.FT_Err_Invalid_Size_Handle,
|
||||||
|
Error.InvalidSlotHandle => c.FT_Err_Invalid_Slot_Handle,
|
||||||
|
Error.InvalidCharMapHandle => c.FT_Err_Invalid_CharMap_Handle,
|
||||||
|
Error.InvalidCacheHandle => c.FT_Err_Invalid_Cache_Handle,
|
||||||
|
Error.InvalidStreamHandle => c.FT_Err_Invalid_Stream_Handle,
|
||||||
|
Error.TooManyDrivers => c.FT_Err_Too_Many_Drivers,
|
||||||
|
Error.TooManyExtensions => c.FT_Err_Too_Many_Extensions,
|
||||||
|
Error.OutOfMemory => c.FT_Err_Out_Of_Memory,
|
||||||
|
Error.UnlistedObject => c.FT_Err_Unlisted_Object,
|
||||||
|
Error.CannotOpenStream => c.FT_Err_Cannot_Open_Stream,
|
||||||
|
Error.InvalidStreamSeek => c.FT_Err_Invalid_Stream_Seek,
|
||||||
|
Error.InvalidStreamSkip => c.FT_Err_Invalid_Stream_Skip,
|
||||||
|
Error.InvalidStreamRead => c.FT_Err_Invalid_Stream_Read,
|
||||||
|
Error.InvalidStreamOperation => c.FT_Err_Invalid_Stream_Operation,
|
||||||
|
Error.InvalidFrameOperation => c.FT_Err_Invalid_Frame_Operation,
|
||||||
|
Error.NestedFrameAccess => c.FT_Err_Nested_Frame_Access,
|
||||||
|
Error.InvalidFrameRead => c.FT_Err_Invalid_Frame_Read,
|
||||||
|
Error.RasterUninitialized => c.FT_Err_Raster_Uninitialized,
|
||||||
|
Error.RasterCorrupted => c.FT_Err_Raster_Corrupted,
|
||||||
|
Error.RasterOverflow => c.FT_Err_Raster_Overflow,
|
||||||
|
Error.RasterNegativeHeight => c.FT_Err_Raster_Negative_Height,
|
||||||
|
Error.TooManyCaches => c.FT_Err_Too_Many_Caches,
|
||||||
|
Error.InvalidOpcode => c.FT_Err_Invalid_Opcode,
|
||||||
|
Error.TooFewArguments => c.FT_Err_Too_Few_Arguments,
|
||||||
|
Error.StackOverflow => c.FT_Err_Stack_Overflow,
|
||||||
|
Error.CodeOverflow => c.FT_Err_Code_Overflow,
|
||||||
|
Error.BadArgument => c.FT_Err_Bad_Argument,
|
||||||
|
Error.DivideByZero => c.FT_Err_Divide_By_Zero,
|
||||||
|
Error.InvalidReference => c.FT_Err_Invalid_Reference,
|
||||||
|
Error.DebugOpCode => c.FT_Err_Debug_OpCode,
|
||||||
|
Error.ENDFInExecStream => c.FT_Err_ENDF_In_Exec_Stream,
|
||||||
|
Error.NestedDEFS => c.FT_Err_Nested_DEFS,
|
||||||
|
Error.InvalidCodeRange => c.FT_Err_Invalid_CodeRange,
|
||||||
|
Error.ExecutionTooLong => c.FT_Err_Execution_Too_Long,
|
||||||
|
Error.TooManyFunctionDefs => c.FT_Err_Too_Many_Function_Defs,
|
||||||
|
Error.TooManyInstructionDefs => c.FT_Err_Too_Many_Instruction_Defs,
|
||||||
|
Error.TableMissing => c.FT_Err_Table_Missing,
|
||||||
|
Error.HorizHeaderMissing => c.FT_Err_Horiz_Header_Missing,
|
||||||
|
Error.LocationsMissing => c.FT_Err_Locations_Missing,
|
||||||
|
Error.NameTableMissing => c.FT_Err_Name_Table_Missing,
|
||||||
|
Error.CMapTableMissing => c.FT_Err_CMap_Table_Missing,
|
||||||
|
Error.HmtxTableMissing => c.FT_Err_Hmtx_Table_Missing,
|
||||||
|
Error.PostTableMissing => c.FT_Err_Post_Table_Missing,
|
||||||
|
Error.InvalidHorizMetrics => c.FT_Err_Invalid_Horiz_Metrics,
|
||||||
|
Error.InvalidCharMapFormat => c.FT_Err_Invalid_CharMap_Format,
|
||||||
|
Error.InvalidPPem => c.FT_Err_Invalid_PPem,
|
||||||
|
Error.InvalidVertMetrics => c.FT_Err_Invalid_Vert_Metrics,
|
||||||
|
Error.CouldNotFindContext => c.FT_Err_Could_Not_Find_Context,
|
||||||
|
Error.InvalidPostTableFormat => c.FT_Err_Invalid_Post_Table_Format,
|
||||||
|
Error.InvalidPostTable => c.FT_Err_Invalid_Post_Table,
|
||||||
|
Error.Syntax => c.FT_Err_Syntax_Error,
|
||||||
|
Error.StackUnderflow => c.FT_Err_Stack_Underflow,
|
||||||
|
Error.Ignore => c.FT_Err_Ignore,
|
||||||
|
Error.NoUnicodeGlyphName => c.FT_Err_No_Unicode_Glyph_Name,
|
||||||
|
Error.MissingStartfontField => c.FT_Err_Missing_Startfont_Field,
|
||||||
|
Error.MissingFontField => c.FT_Err_Missing_Font_Field,
|
||||||
|
Error.MissingSizeField => c.FT_Err_Missing_Size_Field,
|
||||||
|
Error.MissingFontboundingboxField => c.FT_Err_Missing_Fontboundingbox_Field,
|
||||||
|
Error.MissingCharsField => c.FT_Err_Missing_Chars_Field,
|
||||||
|
Error.MissingStartcharField => c.FT_Err_Missing_Startchar_Field,
|
||||||
|
Error.MissingEncodingField => c.FT_Err_Missing_Encoding_Field,
|
||||||
|
Error.MissingBbxField => c.FT_Err_Missing_Bbx_Field,
|
||||||
|
Error.BbxTooBig => c.FT_Err_Bbx_Too_Big,
|
||||||
|
Error.CorruptedFontHeader => c.FT_Err_Corrupted_Font_Header,
|
||||||
|
Error.CorruptedFontGlyphs => c.FT_Err_Corrupted_Font_Glyphs,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
test "error convertion" {
|
test "error convertion" {
|
||||||
const expectError = @import("std").testing.expectError;
|
const expectError = @import("std").testing.expectError;
|
||||||
|
|
||||||
try convertError(c.FT_Err_Ok);
|
try intToError(c.FT_Err_Ok);
|
||||||
try expectError(Error.OutOfMemory, convertError(c.FT_Err_Out_Of_Memory));
|
try expectError(Error.OutOfMemory, intToError(c.FT_Err_Out_Of_Memory));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue