mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
font: use variable JetBrains Mono for embedded font
This cuts down our file size significantly.
This commit is contained in:
@ -520,6 +520,14 @@ pub fn add(
|
|||||||
"jetbrains_mono_bold_italic",
|
"jetbrains_mono_bold_italic",
|
||||||
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-BoldItalic.ttf") },
|
.{ .root_source_file = jb_mono.path("fonts/ttf/JetBrainsMono-BoldItalic.ttf") },
|
||||||
);
|
);
|
||||||
|
step.root_module.addAnonymousImport(
|
||||||
|
"jetbrains_mono_variable",
|
||||||
|
.{ .root_source_file = jb_mono.path("fonts/variable/JetBrainsMono[wght].ttf") },
|
||||||
|
);
|
||||||
|
step.root_module.addAnonymousImport(
|
||||||
|
"jetbrains_mono_variable_italic",
|
||||||
|
.{ .root_source_file = jb_mono.path("fonts/variable/JetBrainsMono-Italic[wght].ttf") },
|
||||||
|
);
|
||||||
|
|
||||||
// Symbols-only nerd font
|
// Symbols-only nerd font
|
||||||
const nf_symbols = b.dependency("nerd_fonts_symbols_only", .{});
|
const nf_symbols = b.dependency("nerd_fonts_symbols_only", .{});
|
||||||
|
@ -260,36 +260,42 @@ fn collection(
|
|||||||
.regular,
|
.regular,
|
||||||
.{ .fallback_loaded = try .init(
|
.{ .fallback_loaded = try .init(
|
||||||
self.font_lib,
|
self.font_lib,
|
||||||
font.embedded.regular,
|
font.embedded.variable,
|
||||||
load_options.faceOptions(),
|
load_options.faceOptions(),
|
||||||
) },
|
) },
|
||||||
);
|
);
|
||||||
_ = try c.add(
|
try (try c.getFace(try c.add(
|
||||||
self.alloc,
|
self.alloc,
|
||||||
.bold,
|
.bold,
|
||||||
.{ .fallback_loaded = try .init(
|
.{ .fallback_loaded = try .init(
|
||||||
self.font_lib,
|
self.font_lib,
|
||||||
font.embedded.bold,
|
font.embedded.variable,
|
||||||
load_options.faceOptions(),
|
load_options.faceOptions(),
|
||||||
) },
|
) },
|
||||||
|
))).setVariations(
|
||||||
|
&.{.{ .id = .init("wght"), .value = 700 }},
|
||||||
|
load_options.faceOptions(),
|
||||||
);
|
);
|
||||||
_ = try c.add(
|
_ = try c.add(
|
||||||
self.alloc,
|
self.alloc,
|
||||||
.italic,
|
.italic,
|
||||||
.{ .fallback_loaded = try .init(
|
.{ .fallback_loaded = try .init(
|
||||||
self.font_lib,
|
self.font_lib,
|
||||||
font.embedded.italic,
|
font.embedded.variable_italic,
|
||||||
load_options.faceOptions(),
|
load_options.faceOptions(),
|
||||||
) },
|
) },
|
||||||
);
|
);
|
||||||
_ = try c.add(
|
try (try c.getFace(try c.add(
|
||||||
self.alloc,
|
self.alloc,
|
||||||
.bold_italic,
|
.bold_italic,
|
||||||
.{ .fallback_loaded = try .init(
|
.{ .fallback_loaded = try .init(
|
||||||
self.font_lib,
|
self.font_lib,
|
||||||
font.embedded.bold_italic,
|
font.embedded.variable_italic,
|
||||||
load_options.faceOptions(),
|
load_options.faceOptions(),
|
||||||
) },
|
) },
|
||||||
|
))).setVariations(
|
||||||
|
&.{.{ .id = .init("wght"), .value = 700 }},
|
||||||
|
load_options.faceOptions(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Nerd-font symbols fallback.
|
// Nerd-font symbols fallback.
|
||||||
|
@ -6,14 +6,18 @@
|
|||||||
//! redistribution and include their license as necessary.
|
//! redistribution and include their license as necessary.
|
||||||
|
|
||||||
/// Default fonts that we prefer for Ghostty.
|
/// Default fonts that we prefer for Ghostty.
|
||||||
|
pub const variable = @embedFile("jetbrains_mono_variable");
|
||||||
|
pub const variable_italic = @embedFile("jetbrains_mono_variable_italic");
|
||||||
|
|
||||||
|
/// Symbols-only nerd font.
|
||||||
|
pub const symbols_nerd_font = @embedFile("nerd_fonts_symbols_only");
|
||||||
|
|
||||||
|
/// Static jetbrains mono faces, currently unused.
|
||||||
pub const regular = @embedFile("jetbrains_mono_regular");
|
pub const regular = @embedFile("jetbrains_mono_regular");
|
||||||
pub const bold = @embedFile("jetbrains_mono_bold");
|
pub const bold = @embedFile("jetbrains_mono_bold");
|
||||||
pub const italic = @embedFile("jetbrains_mono_italic");
|
pub const italic = @embedFile("jetbrains_mono_italic");
|
||||||
pub const bold_italic = @embedFile("jetbrains_mono_bold_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
|
/// Emoji fonts
|
||||||
pub const emoji = @embedFile("res/NotoColorEmoji.ttf");
|
pub const emoji = @embedFile("res/NotoColorEmoji.ttf");
|
||||||
pub const emoji_text = @embedFile("res/NotoEmoji-Regular.ttf");
|
pub const emoji_text = @embedFile("res/NotoEmoji-Regular.ttf");
|
||||||
@ -22,7 +26,6 @@ pub const emoji_text = @embedFile("res/NotoEmoji-Regular.ttf");
|
|||||||
|
|
||||||
/// Fonts with general properties
|
/// Fonts with general properties
|
||||||
pub const arabic = @embedFile("res/KawkabMono-Regular.ttf");
|
pub const arabic = @embedFile("res/KawkabMono-Regular.ttf");
|
||||||
pub const variable = @embedFile("res/Lilex-VF.ttf");
|
|
||||||
|
|
||||||
/// A font for testing which is patched with nerd font symbols.
|
/// A font for testing which is patched with nerd font symbols.
|
||||||
pub const test_nerd_font = @embedFile("res/JetBrainsMonoNerdFont-Regular.ttf");
|
pub const test_nerd_font = @embedFile("res/JetBrainsMonoNerdFont-Regular.ttf");
|
||||||
|
Reference in New Issue
Block a user