freetype: fix failing test / do not return pointer to stack
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
80157a99fc
commit
7d7eb807f8
2 changed files with 5 additions and 5 deletions
|
|
@ -139,10 +139,9 @@ pub fn getTrackKerning(self: Face, point_size: i32, degree: i32) Error!i32 {
|
||||||
return kerning;
|
return kerning;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getGlyphName(self: Face, index: u32) Error![]const u8 {
|
pub fn getGlyphName(self: Face, index: u32, name_buf: *[30]u8) Error![]const u8 {
|
||||||
var name_buf: [30]u8 = undefined;
|
try intToError(c.FT_Get_Glyph_Name(self.handle, index, name_buf, 30));
|
||||||
try intToError(c.FT_Get_Glyph_Name(self.handle, index, &name_buf, 30));
|
return std.mem.sliceTo(name_buf, 0);
|
||||||
return std.mem.sliceTo(&name_buf, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getPostscriptName(self: Face) ?[:0]const u8 {
|
pub fn getPostscriptName(self: Face) ?[:0]const u8 {
|
||||||
|
|
|
||||||
|
|
@ -74,5 +74,6 @@ test "get name index" {
|
||||||
test "get index name" {
|
test "get index name" {
|
||||||
const lib = try freetype.Library.init();
|
const lib = try freetype.Library.init();
|
||||||
const face = try lib.newFace(firasnas_font_path, 0);
|
const face = try lib.newFace(firasnas_font_path, 0);
|
||||||
try testing.expectEqualStrings("summation", try face.getGlyphName(1120));
|
var name_buf: [30]u8 = undefined;
|
||||||
|
try testing.expectEqualStrings("summation", try face.getGlyphName(1120, &name_buf));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue