From 240c560720a2caabd99685542ad7ec4e903c11e1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Oct 2022 10:16:35 -0700 Subject: [PATCH] macos: create descriptors from URL --- pkg/macos/text.zig | 1 + pkg/macos/text/font_manager.zig | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 pkg/macos/text/font_manager.zig diff --git a/pkg/macos/text.zig b/pkg/macos/text.zig index 164e60d4e..efdcf1568 100644 --- a/pkg/macos/text.zig +++ b/pkg/macos/text.zig @@ -1,6 +1,7 @@ pub usingnamespace @import("text/font.zig"); pub usingnamespace @import("text/font_collection.zig"); pub usingnamespace @import("text/font_descriptor.zig"); +pub usingnamespace @import("text/font_manager.zig"); test { @import("std").testing.refAllDecls(@This()); diff --git a/pkg/macos/text/font_manager.zig b/pkg/macos/text/font_manager.zig new file mode 100644 index 000000000..0a847d9fe --- /dev/null +++ b/pkg/macos/text/font_manager.zig @@ -0,0 +1,13 @@ +const std = @import("std"); +const Allocator = std.mem.Allocator; +const foundation = @import("../foundation.zig"); +const c = @import("c.zig"); + +pub fn createFontDescriptorsFromURL(url: *foundation.URL) ?*foundation.Array { + return @intToPtr( + ?*foundation.Array, + @ptrToInt(c.CTFontManagerCreateFontDescriptorsFromURL( + @ptrCast(c.CFURLRef, url), + )), + ); +}