mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
font: add jb mono and symbols-only nerd font as dependencies
Rather than using binaries statically in our source tree; this makes them easier to update. This also makes it so that they are separated from each other rather than using a patched JB mono as our fallback.
This commit is contained in:
@ -100,6 +100,16 @@
|
||||
.lazy = true,
|
||||
},
|
||||
|
||||
// Fonts
|
||||
.jetbrains_mono = .{
|
||||
.url = "https://github.com/JetBrains/JetBrainsMono/releases/download/v2.304/JetBrainsMono-2.304.zip",
|
||||
.hash = "N-V-__8AADWVlwASf7XCdCqpjVW5Jv_7oogANJ_H4_dIoEp6",
|
||||
},
|
||||
.nerd_fonts_symbols_only = .{
|
||||
.url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/NerdFontsSymbolsOnly.tar.xz",
|
||||
.hash = "N-V-__8AAI9HTABr_zPUAKuMp_GR5p_z-kjPIX_e3EtLjOqI",
|
||||
},
|
||||
|
||||
// Other
|
||||
.apple_sdk = .{ .path = "./pkg/apple-sdk" },
|
||||
.iterm2_themes = .{
|
||||
|
10
build.zig.zon.json
generated
10
build.zig.zon.json
generated
@ -59,6 +59,11 @@
|
||||
"url": "https://github.com/mbadolato/iTerm2-Color-Schemes/archive/6fa671fdc1daf1fcfa025cb960ffa3e7373a2ed8.tar.gz",
|
||||
"hash": "sha256-g9o2CIc/TfWYoUS/l/HP5KZECD7qNsdQUlFruaKkVz4="
|
||||
},
|
||||
"N-V-__8AADWVlwASf7XCdCqpjVW5Jv_7oogANJ_H4_dIoEp6": {
|
||||
"name": "jetbrains_mono",
|
||||
"url": "https://github.com/JetBrains/JetBrainsMono/releases/download/v2.304/JetBrainsMono-2.304.zip",
|
||||
"hash": "sha256-b2N2xu0pYOqKljzXOH7J124/YpElvDPR/c1+twEve78="
|
||||
},
|
||||
"N-V-__8AAJrvXQCqAT8Mg9o_tk6m0yf5Fz-gCNEOKLyTSerD": {
|
||||
"name": "libpng",
|
||||
"url": "https://deps.files.ghostty.org/libpng-1220aa013f0c83da3fb64ea6d327f9173fa008d10e28bc9349eac3463457723b1c66.tar.gz",
|
||||
@ -74,6 +79,11 @@
|
||||
"url": "https://deps.files.ghostty.org/libxml2-2.11.5.tar.gz",
|
||||
"hash": "sha256-bCgFni4+60K1tLFkieORamNGwQladP7jvGXNxdiaYhU="
|
||||
},
|
||||
"N-V-__8AAI9HTABr_zPUAKuMp_GR5p_z-kjPIX_e3EtLjOqI": {
|
||||
"name": "nerd_fonts_symbols_only",
|
||||
"url": "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/NerdFontsSymbolsOnly.tar.xz",
|
||||
"hash": "sha256-f4wJDaOw6qcQhka/NMu7btE9U1inJGBSIQiwbH7NcWo="
|
||||
},
|
||||
"N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c": {
|
||||
"name": "oniguruma",
|
||||
"url": "https://deps.files.ghostty.org/oniguruma-1220c15e72eadd0d9085a8af134904d9a0f5dfcbed5f606ad60edc60ebeccd9706bb.tar.gz",
|
||||
|
16
build.zig.zon.nix
generated
16
build.zig.zon.nix
generated
@ -177,6 +177,14 @@ in
|
||||
hash = "sha256-g9o2CIc/TfWYoUS/l/HP5KZECD7qNsdQUlFruaKkVz4=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AADWVlwASf7XCdCqpjVW5Jv_7oogANJ_H4_dIoEp6";
|
||||
path = fetchZigArtifact {
|
||||
name = "jetbrains_mono";
|
||||
url = "https://github.com/JetBrains/JetBrainsMono/releases/download/v2.304/JetBrainsMono-2.304.zip";
|
||||
hash = "sha256-b2N2xu0pYOqKljzXOH7J124/YpElvDPR/c1+twEve78=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAJrvXQCqAT8Mg9o_tk6m0yf5Fz-gCNEOKLyTSerD";
|
||||
path = fetchZigArtifact {
|
||||
@ -201,6 +209,14 @@ in
|
||||
hash = "sha256-bCgFni4+60K1tLFkieORamNGwQladP7jvGXNxdiaYhU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAI9HTABr_zPUAKuMp_GR5p_z-kjPIX_e3EtLjOqI";
|
||||
path = fetchZigArtifact {
|
||||
name = "nerd_fonts_symbols_only";
|
||||
url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/NerdFontsSymbolsOnly.tar.xz";
|
||||
hash = "sha256-f4wJDaOw6qcQhka/NMu7btE9U1inJGBSIQiwbH7NcWo=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAHjwMQDBXnLq3Q2QhaivE0kE2aD138vtX2Bq1g7c";
|
||||
path = fetchZigArtifact {
|
||||
|
2
build.zig.zon.txt
generated
2
build.zig.zon.txt
generated
@ -25,10 +25,12 @@ https://deps.files.ghostty.org/wuffs-122037b39d577ec2db3fd7b2130e7b69ef6cc1807d6
|
||||
https://deps.files.ghostty.org/zig_js-12205a66d423259567764fa0fc60c82be35365c21aeb76c5a7dc99698401f4f6fefc.tar.gz
|
||||
https://deps.files.ghostty.org/ziglyph-b89d43d1e3fb01b6074bc1f7fc980324b04d26a5.tar.gz
|
||||
https://deps.files.ghostty.org/zlib-1220fed0c74e1019b3ee29edae2051788b080cd96e90d56836eea857b0b966742efb.tar.gz
|
||||
https://github.com/JetBrains/JetBrainsMono/releases/download/v2.304/JetBrainsMono-2.304.zip
|
||||
https://github.com/glfw/glfw/archive/e7ea71be039836da3a98cea55ae5569cb5eb885c.tar.gz
|
||||
https://github.com/jcollie/ghostty-gobject/releases/download/0.14.0-2025-03-18-21-1/ghostty-gobject-0.14.0-2025-03-18-21-1.tar.zst
|
||||
https://github.com/mbadolato/iTerm2-Color-Schemes/archive/6fa671fdc1daf1fcfa025cb960ffa3e7373a2ed8.tar.gz
|
||||
https://github.com/mitchellh/libxev/archive/75a10d0fb374e8eb84948dcfc68d865e755e59c2.tar.gz
|
||||
https://github.com/mitchellh/zig-objc/archive/c9e917a4e15a983b672ca779c7985d738a2d517c.tar.gz
|
||||
https://github.com/natecraddock/zf/archive/7aacbe6d155d64d15937ca95ca6c014905eb531f.tar.gz
|
||||
https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/NerdFontsSymbolsOnly.tar.xz
|
||||
https://github.com/vancluever/z2d/archive/8bbd035f4101f02b1d27947def0d7da3215df7fe.tar.gz
|
||||
|
@ -71,6 +71,12 @@
|
||||
"dest": "vendor/p/N-V-__8AAGHcWgTaKLjwmFkxToNT4jgz5VXUHR7hz8TQ2_AS",
|
||||
"sha256": "83da3608873f4df598a144bf97f1cfe4a644083eea36c75052516bb9a2a4573e"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/JetBrains/JetBrainsMono/releases/download/v2.304/JetBrainsMono-2.304.zip",
|
||||
"dest": "vendor/p/N-V-__8AADWVlwASf7XCdCqpjVW5Jv_7oogANJ_H4_dIoEp6",
|
||||
"sha256": "6f6376c6ed2960ea8a963cd7387ec9d76e3f629125bc33d1fdcd7eb7012f7bbf"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://deps.files.ghostty.org/libpng-1220aa013f0c83da3fb64ea6d327f9173fa008d10e28bc9349eac3463457723b1c66.tar.gz",
|
||||
@ -89,6 +95,12 @@
|
||||
"dest": "vendor/p/N-V-__8AAG3RoQEyRC2Vw7Qoro5SYBf62IHn3HjqtNVY6aWK",
|
||||
"sha256": "6c28059e2e3eeb42b5b4b16489e3916a6346c1095a74fee3bc65cdc5d89a6215"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/NerdFontsSymbolsOnly.tar.xz",
|
||||
"dest": "vendor/p/N-V-__8AAI9HTABr_zPUAKuMp_GR5p_z-kjPIX_e3EtLjOqI",
|
||||
"sha256": "7f8c090da3b0eaa7108646bf34cbbb6ed13d5358a72460522108b06c7ecd716a"
|
||||
},
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://deps.files.ghostty.org/oniguruma-1220c15e72eadd0d9085a8af134904d9a0f5dfcbed5f606ad60edc60ebeccd9706bb.tar.gz",
|
||||
|
@ -500,6 +500,35 @@ pub fn add(
|
||||
try static_libs.append(utfcpp_dep.artifact("utfcpp").getEmittedBin());
|
||||
}
|
||||
|
||||
// Fonts
|
||||
{
|
||||
// JetBrains Mono
|
||||
const jb_mono = b.dependency("jetbrains_mono", .{});
|
||||
step.root_module.addAnonymousImport(
|
||||
"jetbrains_mono_regular",
|
||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Regular.ttf") },
|
||||
);
|
||||
step.root_module.addAnonymousImport(
|
||||
"jetbrains_mono_bold",
|
||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Bold.ttf") },
|
||||
);
|
||||
step.root_module.addAnonymousImport(
|
||||
"jetbrains_mono_italic",
|
||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-Italic.ttf") },
|
||||
);
|
||||
step.root_module.addAnonymousImport(
|
||||
"jetbrains_mono_bold_italic",
|
||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-BoldItalic.ttf") },
|
||||
);
|
||||
|
||||
// Symbols-only nerd font
|
||||
const nf_symbols = b.dependency("nerd_fonts_symbols_only", .{});
|
||||
step.root_module.addAnonymousImport(
|
||||
"nerd_fonts_symbols_only",
|
||||
.{ .root_source_file = nf_symbols.path("SymbolsNerdFontMono-Regular.ttf") },
|
||||
);
|
||||
}
|
||||
|
||||
// If we're building an exe then we have additional dependencies.
|
||||
if (step.kind != .lib) {
|
||||
// We always statically compile glad
|
||||
|
@ -292,6 +292,17 @@ fn collection(
|
||||
) },
|
||||
);
|
||||
|
||||
// Nerd-font symbols fallback.
|
||||
_ = try c.add(
|
||||
self.alloc,
|
||||
.regular,
|
||||
.{ .fallback_loaded = try Face.init(
|
||||
self.font_lib,
|
||||
font.embedded.symbols_nerd_font,
|
||||
load_options.faceOptions(),
|
||||
) },
|
||||
);
|
||||
|
||||
// On macOS, always search for and add the Apple Emoji font
|
||||
// as our preferred emoji font for fallback. We do this in case
|
||||
// people add other emoji fonts to their system, we always want to
|
||||
|
@ -6,19 +6,26 @@
|
||||
//! redistribution and include their license as necessary.
|
||||
|
||||
/// Default fonts that we prefer for Ghostty.
|
||||
pub const regular = @embedFile("res/JetBrainsMonoNerdFont-Regular.ttf");
|
||||
pub const bold = @embedFile("res/JetBrainsMonoNerdFont-Bold.ttf");
|
||||
pub const italic = @embedFile("res/JetBrainsMonoNerdFont-Italic.ttf");
|
||||
pub const bold_italic = @embedFile("res/JetBrainsMonoNerdFont-BoldItalic.ttf");
|
||||
pub const regular = @embedFile("jetbrains_mono_regular");
|
||||
pub const bold = @embedFile("jetbrains_mono_bold");
|
||||
pub const italic = @embedFile("jetbrains_mono_italic");
|
||||
pub const bold_italic = @embedFile("jetbrains_mono_bold_italic");
|
||||
|
||||
/// Symbols-only nerd font.
|
||||
pub const symbols_nerd_font = @embedFile("nerd_fonts_symbols_only");
|
||||
|
||||
/// Emoji fonts
|
||||
pub const emoji = @embedFile("res/NotoColorEmoji.ttf");
|
||||
pub const emoji_text = @embedFile("res/NotoEmoji-Regular.ttf");
|
||||
|
||||
// Fonts below are ONLY used for testing.
|
||||
|
||||
/// Fonts with general properties
|
||||
pub const arabic = @embedFile("res/KawkabMono-Regular.ttf");
|
||||
pub const variable = @embedFile("res/Lilex-VF.ttf");
|
||||
|
||||
/// Font with nerd fonts embedded.
|
||||
pub const nerd_font = @embedFile("res/JetBrainsMonoNerdFont-Regular.ttf");
|
||||
/// A font for testing which is patched with nerd font symbols.
|
||||
pub const test_nerd_font = @embedFile("res/JetBrainsMonoNerdFont-Regular.ttf");
|
||||
|
||||
/// Specific font families below:
|
||||
pub const code_new_roman = @embedFile("res/CodeNewRoman-Regular.otf");
|
||||
|
@ -1769,7 +1769,7 @@ fn testShaperWithFont(alloc: Allocator, font_req: TestFont) !TestShaper {
|
||||
.geist_mono => font.embedded.geist_mono,
|
||||
.jetbrains_mono => font.embedded.jetbrains_mono,
|
||||
.monaspace_neon => font.embedded.monaspace_neon,
|
||||
.nerd_font => font.embedded.nerd_font,
|
||||
.nerd_font => font.embedded.test_nerd_font,
|
||||
};
|
||||
|
||||
var lib = try Library.init(alloc);
|
||||
|
Reference in New Issue
Block a user