mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-05 21:34:42 +00:00
font/coretext: score discovered fonts
This commit is contained in:
@@ -63,7 +63,7 @@ pub const MutableArray = opaque {
|
||||
a: *const Elem,
|
||||
b: *const Elem,
|
||||
context: ?*Context,
|
||||
) ComparisonResult,
|
||||
) callconv(.C) ComparisonResult,
|
||||
) void {
|
||||
CFArraySortValues(
|
||||
self,
|
||||
@@ -122,7 +122,7 @@ test "array sorting" {
|
||||
void,
|
||||
null,
|
||||
struct {
|
||||
fn compare(a: *const u8, b: *const u8, _: ?*void) ComparisonResult {
|
||||
fn compare(a: *const u8, b: *const u8, _: ?*void) callconv(.C) ComparisonResult {
|
||||
if (a.* > b.*) return .greater;
|
||||
if (a.* == b.*) return .equal;
|
||||
return .less;
|
||||
|
||||
@@ -46,18 +46,22 @@ pub const FontDescriptor = opaque {
|
||||
) orelse Allocator.Error.OutOfMemory;
|
||||
}
|
||||
|
||||
pub fn retain(self: *FontDescriptor) void {
|
||||
_ = c.CFRetain(self);
|
||||
}
|
||||
|
||||
pub fn release(self: *FontDescriptor) void {
|
||||
c.CFRelease(self);
|
||||
}
|
||||
|
||||
pub fn copyAttribute(self: *FontDescriptor, comptime attr: FontAttribute) attr.Value() {
|
||||
pub fn copyAttribute(self: *const FontDescriptor, comptime attr: FontAttribute) attr.Value() {
|
||||
return @ptrFromInt(@intFromPtr(c.CTFontDescriptorCopyAttribute(
|
||||
@ptrCast(self),
|
||||
@ptrCast(attr.key()),
|
||||
)));
|
||||
}
|
||||
|
||||
pub fn copyAttributes(self: *FontDescriptor) *foundation.Dictionary {
|
||||
pub fn copyAttributes(self: *const FontDescriptor) *foundation.Dictionary {
|
||||
return @ptrFromInt(@intFromPtr(c.CTFontDescriptorCopyAttributes(
|
||||
@ptrCast(self),
|
||||
)));
|
||||
|
||||
Reference in New Issue
Block a user