freetype: don't require buffer in getGlyphName
This commit is contained in:
parent
dd0a6064fb
commit
d5e4c41266
2 changed files with 5 additions and 5 deletions
|
|
@ -139,9 +139,10 @@ pub fn getTrackKerning(self: Face, point_size: i32, degree: i32) Error!i32 {
|
|||
return kerning;
|
||||
}
|
||||
|
||||
pub fn getGlyphName(self: Face, index: u32, name_buf: *[30]u8) Error![]const u8 {
|
||||
try intToError(c.FT_Get_Glyph_Name(self.handle, index, name_buf, 30));
|
||||
return std.mem.sliceTo(name_buf, 0);
|
||||
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 getPostscriptName(self: Face) ?[:0]const u8 {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,5 @@ test "get name index" {
|
|||
test "get index name" {
|
||||
const lib = try freetype.Library.init();
|
||||
const face = try lib.newFace(firasans_font_path, 0);
|
||||
var name_buf: [30]u8 = undefined;
|
||||
try testing.expectEqualStrings("summation", try face.getGlyphName(1120, &name_buf));
|
||||
try testing.expectEqualStrings(try face.getGlyphName(1120), "summation");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue