mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
pkg/macos: copyAttribute should return optional
This commit is contained in:
@ -15,7 +15,7 @@ pub const Number = opaque {
|
|||||||
)))) orelse Allocator.Error.OutOfMemory;
|
)))) orelse Allocator.Error.OutOfMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getValue(self: *Number, comptime t: NumberType, ptr: *t.ValueType()) bool {
|
pub fn getValue(self: *const Number, comptime t: NumberType, ptr: *t.ValueType()) bool {
|
||||||
return c.CFNumberGetValue(
|
return c.CFNumberGetValue(
|
||||||
@ptrCast(self),
|
@ptrCast(self),
|
||||||
@intFromEnum(t),
|
@intFromEnum(t),
|
||||||
|
@ -145,7 +145,7 @@ pub const Font = opaque {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copyAttribute(self: *Font, comptime attr: text.FontAttribute) attr.Value() {
|
pub fn copyAttribute(self: *Font, comptime attr: text.FontAttribute) ?attr.Value() {
|
||||||
return @ptrFromInt(@intFromPtr(c.CTFontCopyAttribute(
|
return @ptrFromInt(@intFromPtr(c.CTFontCopyAttribute(
|
||||||
@ptrCast(self),
|
@ptrCast(self),
|
||||||
@ptrCast(attr.key()),
|
@ptrCast(attr.key()),
|
||||||
|
@ -54,7 +54,7 @@ pub const FontDescriptor = opaque {
|
|||||||
c.CFRelease(self);
|
c.CFRelease(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copyAttribute(self: *const FontDescriptor, comptime attr: FontAttribute) attr.Value() {
|
pub fn copyAttribute(self: *const FontDescriptor, comptime attr: FontAttribute) ?attr.Value() {
|
||||||
return @ptrFromInt(@intFromPtr(c.CTFontDescriptorCopyAttribute(
|
return @ptrFromInt(@intFromPtr(c.CTFontDescriptorCopyAttribute(
|
||||||
@ptrCast(self),
|
@ptrCast(self),
|
||||||
@ptrCast(attr.key()),
|
@ptrCast(attr.key()),
|
||||||
@ -153,7 +153,7 @@ pub const FontAttribute = enum {
|
|||||||
.enabled => *foundation.Number,
|
.enabled => *foundation.Number,
|
||||||
.downloadable => *anyopaque, // CFBoolean
|
.downloadable => *anyopaque, // CFBoolean
|
||||||
.downloaded => *anyopaque, // CFBoolean
|
.downloaded => *anyopaque, // CFBoolean
|
||||||
.variation_axes => ?*foundation.Array,
|
.variation_axes => *foundation.Array,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user