freetype: fix tests for stage2 and Face.getGlyphName()
This commit is contained in:
parent
6a5bb2566e
commit
2f1a9f4364
3 changed files with 12 additions and 6 deletions
|
|
@ -137,10 +137,8 @@ pub fn getTrackKerning(self: Face, point_size: i32, degree: i32) Error!i32 {
|
|||
return kerning;
|
||||
}
|
||||
|
||||
pub fn getGlyphName(self: Face, index: u32) Error![]const u8 {
|
||||
var buf: [32]u8 = undefined;
|
||||
try intToError(c.FT_Get_Glyph_Name(self.handle, index, &buf, buf.len));
|
||||
return std.mem.sliceTo(&buf, 0);
|
||||
pub fn getGlyphName(self: Face, index: u32, buf: []u8) Error!void {
|
||||
try intToError(c.FT_Get_Glyph_Name(self.handle, index, buf.ptr, @intCast(c_uint, buf.len)));
|
||||
}
|
||||
|
||||
pub fn getPostscriptName(self: Face) ?[:0]const u8 {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@ pub const c = @import("c");
|
|||
|
||||
const std = @import("std");
|
||||
|
||||
// Remove once the stage2 compiler fixes pkg std not found
|
||||
comptime {
|
||||
_ = @import("utils");
|
||||
}
|
||||
|
||||
test {
|
||||
std.testing.refAllDeclsRecursive(@import("blob.zig"));
|
||||
std.testing.refAllDeclsRecursive(@import("buffer.zig"));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const testing = @import("std").testing;
|
||||
const std = @import("std");
|
||||
const testing = std.testing;
|
||||
const freetype = @import("freetype");
|
||||
|
||||
const firasans_font_path = "upstream/assets/FiraSans-Regular.ttf";
|
||||
|
|
@ -79,5 +80,7 @@ test "get name index" {
|
|||
test "get index name" {
|
||||
const lib = try freetype.Library.init();
|
||||
const face = try lib.newFace(firasans_font_path, 0);
|
||||
try testing.expectEqualStrings(try face.getGlyphName(1120), "summation");
|
||||
var buf: [32]u8 = undefined;
|
||||
try face.getGlyphName(1120, &buf);
|
||||
try testing.expectEqualStrings(std.mem.sliceTo(&buf, 0), "summation");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue