build: do not build/link harfbuzz on macOS

This commit is contained in:
Mitchell Hashimoto
2024-04-04 12:22:35 -07:00
parent e41e45e1ad
commit fd4d2313d0
4 changed files with 30 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ pub const Face = struct {
/// True if our build is using Harfbuzz. If we're not, we can avoid
/// some Harfbuzz-specific code paths.
const harfbuzz_shaper = font.Shaper == font.shape.harfbuzz.Shaper;
const harfbuzz_shaper = font.options.backend.hasHarfbuzz();
/// The matrix applied to a regular font to auto-italicize it.
pub const italic_skew = macos.graphics.AffineTransform{

View File

@@ -115,6 +115,19 @@ pub const Backend = enum {
=> false,
};
}
pub fn hasHarfbuzz(self: Backend) bool {
return switch (self) {
.freetype,
.fontconfig_freetype,
.coretext_freetype,
=> true,
.coretext,
.web_canvas,
=> false,
};
}
};
/// The styles that a family can take.

View File

@@ -256,7 +256,9 @@ pub const GlobalState = struct {
std.log.info("ghostty build optimize={s}", .{build_config.mode_string});
std.log.info("runtime={}", .{build_config.app_runtime});
std.log.info("font_backend={}", .{build_config.font_backend});
std.log.info("dependency harfbuzz={s}", .{harfbuzz.versionString()});
if (comptime build_config.font_backend.hasHarfbuzz()) {
std.log.info("dependency harfbuzz={s}", .{harfbuzz.versionString()});
}
if (comptime build_config.font_backend.hasFontconfig()) {
std.log.info("dependency fontconfig={d}", .{fontconfig.version()});
}