mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
pkg/macos: more APIs
This commit is contained in:
@ -39,6 +39,23 @@ pub const Dictionary = opaque {
|
||||
key,
|
||||
)));
|
||||
}
|
||||
|
||||
pub fn getKeysAndValues(self: *Dictionary, alloc: Allocator) !struct {
|
||||
keys: []?*const anyopaque,
|
||||
values: []?*const anyopaque,
|
||||
} {
|
||||
const count = self.getCount();
|
||||
const keys = try alloc.alloc(?*const anyopaque, count);
|
||||
errdefer alloc.free(keys);
|
||||
const values = try alloc.alloc(?*const anyopaque, count);
|
||||
errdefer alloc.free(values);
|
||||
c.CFDictionaryGetKeysAndValues(
|
||||
@ptrCast(self),
|
||||
@ptrCast(keys.ptr),
|
||||
@ptrCast(values.ptr),
|
||||
);
|
||||
return .{ .keys = keys, .values = values };
|
||||
}
|
||||
};
|
||||
|
||||
pub const MutableDictionary = opaque {
|
||||
|
@ -1,3 +1,4 @@
|
||||
pub const c = @import("text/c.zig");
|
||||
pub usingnamespace @import("text/font.zig");
|
||||
pub usingnamespace @import("text/font_collection.zig");
|
||||
pub usingnamespace @import("text/font_descriptor.zig");
|
||||
|
@ -47,6 +47,10 @@ pub const Font = opaque {
|
||||
return @ptrCast(@constCast(c.CTFontCopyFontDescriptor(@ptrCast(self))));
|
||||
}
|
||||
|
||||
pub fn copyFeatures(self: *Font) *foundation.Array {
|
||||
return @ptrCast(@constCast(c.CTFontCopyFeatures(@ptrCast(self))));
|
||||
}
|
||||
|
||||
pub fn getGlyphCount(self: *Font) usize {
|
||||
return @intCast(c.CTFontGetGlyphCount(@ptrCast(self)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user