mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
font: deferred face can load core text backend
This commit is contained in:
@ -339,7 +339,9 @@ pub fn create(alloc: Allocator, loop: libuv.Loop, config: *const Config) !*Windo
|
||||
font.DeferredFace.initLoaded(try font.Face.init(font_lib, face_bold_ttf, font_size)),
|
||||
);
|
||||
|
||||
// Emoji
|
||||
// Emoji fallback. We don't include this on Mac since Mac is expected
|
||||
// to always have the Apple Emoji available.
|
||||
if (builtin.os.tag != .macos or font.Discover == void) {
|
||||
try group.addFace(
|
||||
alloc,
|
||||
.regular,
|
||||
@ -350,6 +352,7 @@ pub fn create(alloc: Allocator, loop: libuv.Loop, config: *const Config) !*Windo
|
||||
.regular,
|
||||
font.DeferredFace.initLoaded(try font.Face.init(font_lib, face_emoji_text_ttf, font_size)),
|
||||
);
|
||||
}
|
||||
|
||||
break :group group;
|
||||
});
|
||||
|
@ -115,6 +115,7 @@ pub fn load(
|
||||
// both here.
|
||||
switch (font.Face) {
|
||||
@import("face/freetype.zig").Face => try self.loadCoreTextFreetype(lib, size),
|
||||
@import("face/coretext.zig").Face => try self.loadCoreText(lib, size),
|
||||
else => unreachable,
|
||||
}
|
||||
|
||||
@ -142,6 +143,17 @@ fn loadFontconfig(
|
||||
self.face = try Face.initFile(lib, filename, face_index, size);
|
||||
}
|
||||
|
||||
fn loadCoreText(
|
||||
self: *DeferredFace,
|
||||
lib: Library,
|
||||
size: font.face.DesiredSize,
|
||||
) !void {
|
||||
_ = lib;
|
||||
assert(self.face == null);
|
||||
const ct = self.ct.?;
|
||||
self.face = try Face.initFontCopy(ct.font, size);
|
||||
}
|
||||
|
||||
fn loadCoreTextFreetype(
|
||||
self: *DeferredFace,
|
||||
lib: Library,
|
||||
|
Reference in New Issue
Block a user