mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-24 16:11:43 +00:00
macos: handle missing CoreText display names (#13642)
Fixes https://github.com/ghostty-org/ghostty/discussions/13262 CTFontCopyDisplayName can return null.
This commit is contained in:
@@ -156,7 +156,7 @@ pub const Font = opaque {
|
||||
return @ptrFromInt(@intFromPtr(c.CTFontCopyFamilyName(@ptrCast(self))));
|
||||
}
|
||||
|
||||
pub fn copyDisplayName(self: *Font) *foundation.String {
|
||||
pub fn copyDisplayName(self: *Font) ?*foundation.String {
|
||||
return @ptrFromInt(@intFromPtr(c.CTFontCopyDisplayName(@ptrCast(self))));
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,8 @@ pub fn name(self: DeferredFace, buf: []u8) ![]const u8 {
|
||||
.coretext_harfbuzz,
|
||||
.coretext_noshape,
|
||||
=> if (self.ct) |ct| {
|
||||
const display_name = ct.font.copyDisplayName();
|
||||
const display_name = ct.font.copyDisplayName() orelse
|
||||
return self.familyName(buf);
|
||||
return display_name.cstringPtr(.utf8) orelse unsupported: {
|
||||
// "NULL if the internal storage of theString does not allow
|
||||
// this to be returned efficiently." In this case, we need
|
||||
|
||||
Reference in New Issue
Block a user