macos/text: matching font descriptors

This commit is contained in:
Mitchell Hashimoto
2022-09-30 15:13:29 -07:00
parent 93f2a99b64
commit d79c8fab39

View File

@ -11,12 +11,26 @@ pub const FontCollection = opaque {
foundation.CFRelease(self); foundation.CFRelease(self);
} }
pub fn createMatchingFontDescriptors(self: *FontCollection) *foundation.Array {
return CTFontCollectionCreateMatchingFontDescriptors(self);
}
pub extern "c" fn CTFontCollectionCreateFromAvailableFonts( pub extern "c" fn CTFontCollectionCreateFromAvailableFonts(
options: ?*foundation.Dictionary, options: ?*foundation.Dictionary,
) ?*FontCollection; ) ?*FontCollection;
pub extern "c" fn CTFontCollectionCreateMatchingFontDescriptors(
collection: *FontCollection,
) *foundation.Array;
}; };
test "collection" { test "collection" {
const testing = std.testing;
const v = try FontCollection.createFromAvailableFonts(); const v = try FontCollection.createFromAvailableFonts();
defer v.release(); defer v.release();
const list = v.createMatchingFontDescriptors();
defer list.release();
try testing.expect(list.getCount() > 0);
} }