mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
build: add -Dfont-backend=coretext_harfbuzz to force Harfbuzz w/ CT
This commit is contained in:
@ -83,7 +83,7 @@ pub const WebCanvas = struct {
|
||||
pub fn deinit(self: *DeferredFace) void {
|
||||
switch (options.backend) {
|
||||
.fontconfig_freetype => if (self.fc) |*fc| fc.deinit(),
|
||||
.coretext, .coretext_freetype => if (self.ct) |*ct| ct.deinit(),
|
||||
.coretext, .coretext_freetype, .coretext_harfbuzz => if (self.ct) |*ct| ct.deinit(),
|
||||
.freetype => {},
|
||||
.web_canvas => if (self.wc) |*wc| wc.deinit(),
|
||||
}
|
||||
@ -98,7 +98,7 @@ pub fn familyName(self: DeferredFace, buf: []u8) ![]const u8 {
|
||||
.fontconfig_freetype => if (self.fc) |fc|
|
||||
return (try fc.pattern.get(.family, 0)).string,
|
||||
|
||||
.coretext, .coretext_freetype => if (self.ct) |ct| {
|
||||
.coretext, .coretext_freetype, .coretext_harfbuzz => if (self.ct) |ct| {
|
||||
const family_name = ct.font.copyAttribute(.family_name);
|
||||
return family_name.cstringPtr(.utf8) orelse unsupported: {
|
||||
break :unsupported family_name.cstring(buf, .utf8) orelse
|
||||
@ -121,7 +121,7 @@ pub fn name(self: DeferredFace, buf: []u8) ![]const u8 {
|
||||
.fontconfig_freetype => if (self.fc) |fc|
|
||||
return (try fc.pattern.get(.fullname, 0)).string,
|
||||
|
||||
.coretext, .coretext_freetype => if (self.ct) |ct| {
|
||||
.coretext, .coretext_freetype, .coretext_harfbuzz => if (self.ct) |ct| {
|
||||
const display_name = ct.font.copyDisplayName();
|
||||
return display_name.cstringPtr(.utf8) orelse unsupported: {
|
||||
// "NULL if the internal storage of theString does not allow
|
||||
@ -147,7 +147,7 @@ pub fn load(
|
||||
) !Face {
|
||||
return switch (options.backend) {
|
||||
.fontconfig_freetype => try self.loadFontconfig(lib, opts),
|
||||
.coretext => try self.loadCoreText(lib, opts),
|
||||
.coretext, .coretext_harfbuzz => try self.loadCoreText(lib, opts),
|
||||
.coretext_freetype => try self.loadCoreTextFreetype(lib, opts),
|
||||
.web_canvas => try self.loadWebCanvas(opts),
|
||||
|
||||
@ -262,7 +262,7 @@ pub fn hasCodepoint(self: DeferredFace, cp: u32, p: ?Presentation) bool {
|
||||
}
|
||||
},
|
||||
|
||||
.coretext, .coretext_freetype => {
|
||||
.coretext, .coretext_freetype, .coretext_harfbuzz => {
|
||||
// If we are using coretext, we check the loaded CT font.
|
||||
if (self.ct) |ct| {
|
||||
if (p) |desired_p| {
|
||||
|
@ -14,7 +14,7 @@ const log = std.log.scoped(.discovery);
|
||||
pub const Discover = switch (options.backend) {
|
||||
.freetype => void, // no discovery
|
||||
.fontconfig_freetype => Fontconfig,
|
||||
.coretext, .coretext_freetype => CoreText,
|
||||
.coretext, .coretext_freetype, .coretext_harfbuzz => CoreText,
|
||||
.web_canvas => void, // no discovery
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ pub const Face = switch (options.backend) {
|
||||
.coretext_freetype,
|
||||
=> freetype.Face,
|
||||
|
||||
.coretext => coretext.Face,
|
||||
.coretext, .coretext_harfbuzz => coretext.Face,
|
||||
.web_canvas => web_canvas.Face,
|
||||
};
|
||||
|
||||
|
@ -15,6 +15,7 @@ pub const Library = switch (options.backend) {
|
||||
|
||||
// Some backends such as CT and Canvas don't have a "library"
|
||||
.coretext,
|
||||
.coretext_harfbuzz,
|
||||
.web_canvas,
|
||||
=> NoopLibrary,
|
||||
};
|
||||
|
@ -50,12 +50,16 @@ pub const Backend = enum {
|
||||
/// Fontconfig for font discovery and FreeType for font rendering.
|
||||
fontconfig_freetype,
|
||||
|
||||
/// CoreText for both font discovery for rendering (macOS).
|
||||
/// CoreText for font discovery, rendering, and shaping (macOS).
|
||||
coretext,
|
||||
|
||||
/// CoreText for font discovery and FreeType for rendering (macOS).
|
||||
/// CoreText for font discovery, FreeType for rendering, and
|
||||
/// HarfBuzz for shaping (macOS).
|
||||
coretext_freetype,
|
||||
|
||||
/// CoreText for font discovery and rendering, HarfBuzz for shaping
|
||||
coretext_harfbuzz,
|
||||
|
||||
/// Use the browser font system and the Canvas API (wasm). This limits
|
||||
/// the available fonts to browser fonts (anything Canvas natively
|
||||
/// supports).
|
||||
@ -89,7 +93,11 @@ pub const Backend = enum {
|
||||
.fontconfig_freetype,
|
||||
.coretext_freetype,
|
||||
=> true,
|
||||
.coretext, .web_canvas => false,
|
||||
|
||||
.coretext,
|
||||
.coretext_harfbuzz,
|
||||
.web_canvas,
|
||||
=> false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -97,6 +105,7 @@ pub const Backend = enum {
|
||||
return switch (self) {
|
||||
.coretext,
|
||||
.coretext_freetype,
|
||||
.coretext_harfbuzz,
|
||||
=> true,
|
||||
|
||||
.freetype,
|
||||
@ -113,6 +122,7 @@ pub const Backend = enum {
|
||||
.freetype,
|
||||
.coretext,
|
||||
.coretext_freetype,
|
||||
.coretext_harfbuzz,
|
||||
.web_canvas,
|
||||
=> false,
|
||||
};
|
||||
@ -123,6 +133,7 @@ pub const Backend = enum {
|
||||
.freetype,
|
||||
.fontconfig_freetype,
|
||||
.coretext_freetype,
|
||||
.coretext_harfbuzz,
|
||||
=> true,
|
||||
|
||||
.coretext,
|
||||
|
@ -10,6 +10,7 @@ pub const Shaper = switch (options.backend) {
|
||||
.freetype,
|
||||
.fontconfig_freetype,
|
||||
.coretext_freetype,
|
||||
.coretext_harfbuzz,
|
||||
=> harfbuzz.Shaper,
|
||||
|
||||
// Note that coretext_freetype cannot use the coretext
|
||||
|
Reference in New Issue
Block a user