font: coretext face presentation

This commit is contained in:
Mitchell Hashimoto
2022-10-08 09:55:22 -07:00
parent 90f3b9391c
commit 723db8be2f
4 changed files with 49 additions and 4 deletions

View File

@@ -89,6 +89,12 @@ pub const Font = opaque {
@ptrToInt(c.CTFontCopyDisplayName(@ptrCast(c.CTFontRef, self))),
);
}
pub fn getSymbolicTraits(self: *Font) text.FontSymbolicTraits {
return @bitCast(text.FontSymbolicTraits, c.CTFontGetSymbolicTraits(
@ptrCast(c.CTFontRef, self),
));
}
};
pub const FontOrientation = enum(c_uint) {
@@ -108,6 +114,12 @@ test {
const font = try Font.createWithFontDescriptor(desc, 12);
defer font.release();
// Traits
{
const traits = font.getSymbolicTraits();
try testing.expect(!traits.color_glyphs);
}
var glyphs = [1]graphics.Glyph{0};
try testing.expect(font.getGlyphsForCharacters(
&[_]u16{'A'},