diff --git a/nebula_app/src/config/templates/pebrel.en-US.lua b/nebula_app/src/config/templates/pebrel.en-US.lua index 194b228..31fa112 100644 --- a/nebula_app/src/config/templates/pebrel.en-US.lua +++ b/nebula_app/src/config/templates/pebrel.en-US.lua @@ -11,7 +11,7 @@ config.scrolling = { -- Font example. Remove the leading `--` from each line below to enable it. -- config.font = { --- normal = { family = 'Maple Mono NF CN', style = 'Regular' }, +-- normal = { family = 'Maple Mono Normal NF CN', style = 'Regular' }, -- size = 13.0, -- builtin_box_drawing = true, -- } diff --git a/nebula_app/src/config/templates/pebrel.zh-CN.lua b/nebula_app/src/config/templates/pebrel.zh-CN.lua index c60463b..b2dcc71 100644 --- a/nebula_app/src/config/templates/pebrel.zh-CN.lua +++ b/nebula_app/src/config/templates/pebrel.zh-CN.lua @@ -11,7 +11,7 @@ config.scrolling = { -- 字体示例。取消下面各行开头的 `--` 即可启用。 -- config.font = { --- normal = { family = 'Maple Mono NF CN', style = 'Regular' }, +-- normal = { family = 'Maple Mono Normal NF CN', style = 'Regular' }, -- size = 13.0, -- builtin_box_drawing = true, -- } diff --git a/nebula_app/src/font_install.rs b/nebula_app/src/font_install.rs index 972703a..5f06af6 100644 --- a/nebula_app/src/font_install.rs +++ b/nebula_app/src/font_install.rs @@ -2,13 +2,13 @@ use std::path::{Path, PathBuf}; use sha2::{Digest, Sha256}; -pub const REQUIRED_FONT_FAMILY: &str = "Maple Mono NF CN"; +pub const REQUIRED_FONT_FAMILY: &str = "Maple Mono Normal NF CN"; /// The bundled face is shared by the legacy rasterizer and the GPUI text /// system. Keeping one static byte slice avoids letting the two shells drift /// to different font revisions. pub static REQUIRED_FONT_BYTES: &[u8] = - include_bytes!("../../assets/fonts/MapleMono-NF-CN-Regular.ttf"); + include_bytes!("../../assets/fonts/MapleMonoNormal-NF-CN-Regular.ttf"); /// 一个系统已安装字体族,连同平台给出的等宽判定。 /// @@ -214,7 +214,7 @@ pub fn gpui_font_with_fallbacks(value: &str) -> gpui::Font { } font } -pub const REQUIRED_FONT_FILE: &str = "MapleMono-NF-CN-Regular.ttf"; +pub const REQUIRED_FONT_FILE: &str = "MapleMonoNormal-NF-CN-Regular.ttf"; /// 枚举系统已安装字体族,带 DirectWrite 的权威等宽判定(`IsMonospacedFont`)。 /// @@ -383,6 +383,19 @@ pub fn ensure_bundled_font_on_disk() -> PathBuf { mod tests { use super::*; + #[test] + fn default_face_matches_the_1_7_regular_font_asset() { + assert_eq!(REQUIRED_FONT_FAMILY, "Maple Mono Normal NF CN"); + assert_eq!(REQUIRED_FONT_FILE, "MapleMonoNormal-NF-CN-Regular.ttf"); + assert_eq!( + Sha256::digest(REQUIRED_FONT_BYTES) + .iter() + .map(|byte| format!("{byte:02x}")) + .collect::(), + "9ae0c348a44a681fa8fa20a34e782e95316cec880102295a128b65760944c0f5" + ); + } + fn sys(name: &str, monospaced: bool) -> SystemFontFamily { SystemFontFamily { name: name.to_owned(), monospaced } } diff --git a/nebula_app/src/gpui_shell/mod.rs b/nebula_app/src/gpui_shell/mod.rs index 5bef0d3..e89ef82 100644 --- a/nebula_app/src/gpui_shell/mod.rs +++ b/nebula_app/src/gpui_shell/mod.rs @@ -217,7 +217,7 @@ fn register_bundled_fonts(cx: &App) { // resolve a font so the default remains the same private face as winit. if let Err(error) = cx.text_system().add_fonts(vec![ Cow::Borrowed(crate::font_install::REQUIRED_FONT_BYTES), - Cow::Borrowed(include_bytes!("../../../assets/fonts/MapleMonoNormal-NF-CN-Regular.ttf")), + Cow::Borrowed(include_bytes!("../../../assets/fonts/MapleMono-NF-CN-Regular.ttf")), ]) { try_write_stderr(format_args!( "[nebula:gpui] failed to register bundled Maple font: {error}"