font/freetype: add a test for face name decoding using embedded fonts

pull/8204/head
Jeffrey C. Ollie 2025-08-10 20:10:24 -05:00
parent 897d70982e
commit e9e32d71e4
No known key found for this signature in database
GPG Key ID: 6F86035A6D97044E
1 changed files with 27 additions and 0 deletions

View File

@ -181,6 +181,33 @@ pub const Face = struct {
return "";
}
test "face name" {
const embedded = @import("../embedded.zig");
var lib: Library = try .init(testing.allocator);
defer lib.deinit();
{
var face: Face = try .init(lib, embedded.variable, .{ .size = .{ .points = 14 } });
defer face.deinit();
var buf: [1024]u8 = undefined;
const actual = try face.name(&buf);
try testing.expectEqualStrings("JetBrains Mono", actual);
}
{
var face: Face = try .init(lib, embedded.inconsolata, .{ .size = .{ .points = 14 } });
defer face.deinit();
var buf: [1024]u8 = undefined;
const actual = try face.name(&buf);
try testing.expectEqualStrings("Inconsolata", actual);
}
}
/// Return a new face that is the same as this but also has synthetic
/// bold applied.
pub fn syntheticBold(self: *const Face, opts: font.face.Options) !Face {