From d79c8fab39e735c9cc2563a37f44af374ef04783 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 30 Sep 2022 15:13:29 -0700 Subject: [PATCH] macos/text: matching font descriptors --- pkg/macos/text/font_collection.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/macos/text/font_collection.zig b/pkg/macos/text/font_collection.zig index 7de026f29..9335c7658 100644 --- a/pkg/macos/text/font_collection.zig +++ b/pkg/macos/text/font_collection.zig @@ -11,12 +11,26 @@ pub const FontCollection = opaque { foundation.CFRelease(self); } + pub fn createMatchingFontDescriptors(self: *FontCollection) *foundation.Array { + return CTFontCollectionCreateMatchingFontDescriptors(self); + } + pub extern "c" fn CTFontCollectionCreateFromAvailableFonts( options: ?*foundation.Dictionary, ) ?*FontCollection; + pub extern "c" fn CTFontCollectionCreateMatchingFontDescriptors( + collection: *FontCollection, + ) *foundation.Array; }; test "collection" { + const testing = std.testing; + const v = try FontCollection.createFromAvailableFonts(); defer v.release(); + + const list = v.createMatchingFontDescriptors(); + defer list.release(); + + try testing.expect(list.getCount() > 0); }