diff --git a/examples/gkurve/label.zig b/examples/gkurve/label.zig index b20ca799..a821b9b7 100644 --- a/examples/gkurve/label.zig +++ b/examples/gkurve/label.zig @@ -46,7 +46,7 @@ pub fn writer(label: *Label, app: *App, position: Vec2, text_color: Vec4) Writer pub fn init(lib: ft.Library, font_path: []const u8, face_index: i32, char_size: i32, allocator: std.mem.Allocator) !Label { return Label{ - .face = try lib.newFace(font_path, face_index), + .face = try lib.createFace(font_path, face_index), .size = char_size, .char_map = std.AutoHashMap(u21, GlyphInfo).init(allocator), .allocator = allocator, diff --git a/examples/gkurve/resizable_label.zig b/examples/gkurve/resizable_label.zig index 1b69f864..cc9502d4 100644 --- a/examples/gkurve/resizable_label.zig +++ b/examples/gkurve/resizable_label.zig @@ -65,7 +65,7 @@ pub fn writer(label: *ResizableLabel, app: *App, position: Vec4, text_color: Vec pub fn init(self: *ResizableLabel, lib: ft.Library, font_path: []const u8, face_index: i32, allocator: std.mem.Allocator, white_texture: UVData) !void { self.* = ResizableLabel{ - .face = try lib.newFace(font_path, face_index), + .face = try lib.createFace(font_path, face_index), .char_map = std.AutoHashMap(u21, CharVertices).init(allocator), .allocator = allocator, .tessellator = undefined, diff --git a/freetype/src/freetype/Library.zig b/freetype/src/freetype/Library.zig index 2ff65b0d..cac4c39b 100644 --- a/freetype/src/freetype/Library.zig +++ b/freetype/src/freetype/Library.zig @@ -27,14 +27,14 @@ pub fn deinit(self: Library) void { _ = c.FT_Done_FreeType(self.handle); } -pub fn newFace(self: Library, path: []const u8, face_index: i32) Error!Face { +pub fn createFace(self: Library, path: []const u8, face_index: i32) Error!Face { return self.openFace(.{ .flags = .{ .path = true }, .data = .{ .path = path }, }, face_index); } -pub fn newFaceMemory(self: Library, bytes: []const u8, face_index: i32) Error!Face { +pub fn createFaceMemory(self: Library, bytes: []const u8, face_index: i32) Error!Face { return self.openFace(.{ .flags = .{ .memory = true }, .data = .{ .memory = bytes }, @@ -58,7 +58,7 @@ pub fn version(self: Library) Version { return v; } -pub fn newStroker(self: Library) Error!Stroker { +pub fn createStroker(self: Library) Error!Stroker { var s: c.FT_Stroker = undefined; try intToError(c.FT_Stroker_New(self.handle, &s)); return Stroker{ .handle = s }; diff --git a/freetype/test/main.zig b/freetype/test/main.zig index ed0beaeb..99d112a5 100644 --- a/freetype/test/main.zig +++ b/freetype/test/main.zig @@ -10,19 +10,19 @@ comptime { _ = @import("utils"); } -test "new face from file" { +test "create face from file" { const lib = try freetype.Library.init(); - _ = try lib.newFace(firasans_font_path, 0); + _ = try lib.createFace(firasans_font_path, 0); } -test "new face from memory" { +test "create face from memory" { const lib = try freetype.Library.init(); - _ = try lib.newFaceMemory(firasans_font_data, 0); + _ = try lib.createFaceMemory(firasans_font_data, 0); } -test "new stroker" { +test "create stroker" { const lib = try freetype.Library.init(); - _ = try lib.newStroker(); + _ = try lib.createStroker(); } test "set lcd filter" { @@ -36,7 +36,7 @@ test "set lcd filter" { test "load glyph" { const lib = try freetype.Library.init(); - const face = try lib.newFace(firasans_font_path, 0); + const face = try lib.createFace(firasans_font_path, 0); try face.setPixelSizes(100, 100); try face.setCharSize(10 * 10, 0, 72, 0); @@ -49,20 +49,20 @@ test "load glyph" { test "attach file" { const lib = try freetype.Library.init(); - const face = try lib.newFace("upstream/assets/DejaVuSans.pfb", 0); + const face = try lib.createFace("upstream/assets/DejaVuSans.pfb", 0); try face.attachFile("upstream/assets/DejaVuSans.pfm"); } test "attach from memory" { const lib = try freetype.Library.init(); - const face = try lib.newFace("upstream/assets/DejaVuSans.pfb", 0); + const face = try lib.createFace("upstream/assets/DejaVuSans.pfb", 0); const file = @embedFile("../upstream/assets/DejaVuSans.pfm"); try face.attachMemory(file); } test "charmap iterator" { const lib = try freetype.Library.init(); - const face = try lib.newFace(firasans_font_path, 0); + const face = try lib.createFace(firasans_font_path, 0); var iterator = face.getCharmapIterator(); var old_char: usize = 0; while (iterator.next()) |c| { @@ -73,14 +73,14 @@ test "charmap iterator" { test "get name index" { const lib = try freetype.Library.init(); - const face = try lib.newFace(firasans_font_path, 0); + const face = try lib.createFace(firasans_font_path, 0); try testing.expectEqual(@as(u32, 1120), face.getNameIndex("summation").?); } test "get index name" { const lib = try freetype.Library.init(); - const face = try lib.newFace(firasans_font_path, 0); + const face = try lib.createFace(firasans_font_path, 0); var buf: [32]u8 = undefined; try face.getGlyphName(1120, &buf); try testing.expectEqualStrings(std.mem.sliceTo(&buf, 0), "summation"); -} +} \ No newline at end of file