diff --git a/Cargo.lock b/Cargo.lock index ce9496be5b..9bc19c7ad9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2104,9 +2104,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a" +checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" dependencies = [ "aho-corasick", "bstr", @@ -3913,9 +3913,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "6.2.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be44a6694859b7cfc955699935944a6844aa9fe416aeda5d40829e3e38dfee6" +checksum = "d40377bff8cceee81e28ddb73ac97f5c2856ce5522f0b260b763f434cdfae602" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -3924,9 +3924,9 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "6.1.0" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f567ca01565c50c67b29e535f5f67b8ea8aeadaeed16a88f10792ab57438b957" +checksum = "94e763e24ba2bf0c72bc6be883f967f794a019fafd1b86ba1daff9c91a7edd30" dependencies = [ "proc-macro2", "quote", @@ -3937,11 +3937,11 @@ dependencies = [ [[package]] name = "rust-embed-utils" -version = "7.0.0" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6116e7ab9ea963f60f2f20291d8fcf6c7273192cdd7273b3c80729a9605c97b2" +checksum = "ad22c7226e4829104deab21df575e995bfbc4adfad13a595e387477f238c1aec" dependencies = [ - "glob", + "globset", "sha2", "walkdir", ] diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 80b9ead9bc..90c25efe5b 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -283,6 +283,10 @@ impl App { Ok(app) } + pub fn background(&self) -> Arc { + self.0.borrow().background().clone() + } + pub fn on_become_active(self, mut callback: F) -> Self where F: 'static + FnMut(&mut MutableAppContext), diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 38aeac8a6b..15f218178b 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -34,7 +34,7 @@ oauth2-surf = "0.1.1" parking_lot = "0.11.1" postage = { version = "0.4.1", features = ["futures-traits"] } rand = "0.8" -rust-embed = { version = "6.2", features = ["include-exclude"] } +rust-embed = { version = "6.3", features = ["include-exclude"] } scrypt = "0.7" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/crates/workspace/src/settings.rs b/crates/workspace/src/settings.rs index c74576ef7e..a1598836a4 100644 --- a/crates/workspace/src/settings.rs +++ b/crates/workspace/src/settings.rs @@ -36,7 +36,7 @@ impl Settings { ) -> Result { Ok(Self { buffer_font_family: font_cache.load_family(&[buffer_font_family])?, - buffer_font_size: 16., + buffer_font_size: 15., tab_size: 4, soft_wrap: SoftWrap::None, preferred_line_length: 80, diff --git a/crates/zed/Cargo.toml b/crates/zed/Cargo.toml index 4d4d8f8b91..3f4cf8a96f 100644 --- a/crates/zed/Cargo.toml +++ b/crates/zed/Cargo.toml @@ -76,7 +76,7 @@ postage = { version = "0.4.1", features = ["futures-traits"] } rand = "0.8.3" regex = "1.5" rsa = "0.4" -rust-embed = { version = "6.2", features = ["include-exclude"] } +rust-embed = { version = "6.3", features = ["include-exclude"] } serde = { version = "1", features = ["derive"] } serde_json = { version = "1.0.64", features = ["preserve_order"] } serde_path_to_error = "0.1.4" diff --git a/crates/zed/assets/fonts/inconsolata/Inconsolata-Bold.ttf b/crates/zed/assets/fonts/inconsolata/Inconsolata-Bold.ttf deleted file mode 100644 index 6c930e3bc7..0000000000 Binary files a/crates/zed/assets/fonts/inconsolata/Inconsolata-Bold.ttf and /dev/null differ diff --git a/crates/zed/assets/fonts/inconsolata/Inconsolata-Regular.ttf b/crates/zed/assets/fonts/inconsolata/Inconsolata-Regular.ttf deleted file mode 100644 index 3b74e08a12..0000000000 Binary files a/crates/zed/assets/fonts/inconsolata/Inconsolata-Regular.ttf and /dev/null differ diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-bold.ttf b/crates/zed/assets/fonts/zed-mono/zed-mono-bold.ttf new file mode 100644 index 0000000000..4db0387f74 Binary files /dev/null and b/crates/zed/assets/fonts/zed-mono/zed-mono-bold.ttf differ diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-bolditalic.ttf b/crates/zed/assets/fonts/zed-mono/zed-mono-bolditalic.ttf new file mode 100644 index 0000000000..311427a7bc Binary files /dev/null and b/crates/zed/assets/fonts/zed-mono/zed-mono-bolditalic.ttf differ diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-italic.ttf b/crates/zed/assets/fonts/zed-mono/zed-mono-italic.ttf new file mode 100644 index 0000000000..2c97a2d705 Binary files /dev/null and b/crates/zed/assets/fonts/zed-mono/zed-mono-italic.ttf differ diff --git a/crates/zed/assets/fonts/zed-mono/zed-mono-regular.ttf b/crates/zed/assets/fonts/zed-mono/zed-mono-regular.ttf new file mode 100644 index 0000000000..4c6733e2a5 Binary files /dev/null and b/crates/zed/assets/fonts/zed-mono/zed-mono-regular.ttf differ diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-bold.ttf b/crates/zed/assets/fonts/zed-sans/zed-sans-bold.ttf new file mode 100644 index 0000000000..a4ed560d5a Binary files /dev/null and b/crates/zed/assets/fonts/zed-sans/zed-sans-bold.ttf differ diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-bolditalic.ttf b/crates/zed/assets/fonts/zed-sans/zed-sans-bolditalic.ttf new file mode 100644 index 0000000000..83cc0c2a4b Binary files /dev/null and b/crates/zed/assets/fonts/zed-sans/zed-sans-bolditalic.ttf differ diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-italic.ttf b/crates/zed/assets/fonts/zed-sans/zed-sans-italic.ttf new file mode 100644 index 0000000000..cc7dbb4c35 Binary files /dev/null and b/crates/zed/assets/fonts/zed-sans/zed-sans-italic.ttf differ diff --git a/crates/zed/assets/fonts/zed-sans/zed-sans-regular.ttf b/crates/zed/assets/fonts/zed-sans/zed-sans-regular.ttf new file mode 100644 index 0000000000..8bfd8202cb Binary files /dev/null and b/crates/zed/assets/fonts/zed-sans/zed-sans-regular.ttf differ diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index 389f457107..ed4c4c9039 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/crates/zed/assets/themes/_base.toml @@ -1,5 +1,5 @@ [text] -base = { family = "Inconsolata", size = 15 } +base = { family = "Zed Sans", size = 14 } [workspace] background = "$surface.0" diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 19f11ebc1e..b154241343 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -3,7 +3,7 @@ use client::{self, http, ChannelList, UserStore}; use fs::OpenOptions; -use gpui::AssetSource; +use gpui::{App, AssetSource}; use log::LevelFilter; use parking_lot::Mutex; use simplelog::SimpleLogger; @@ -18,16 +18,11 @@ fn main() { init_logger(); let app = gpui::App::new(Assets).unwrap(); - let embedded_fonts = Assets - .list("fonts") - .into_iter() - .map(|f| Arc::new(Assets.load(&f).unwrap().to_vec())) - .collect::>(); - app.platform().fonts().add_fonts(&embedded_fonts).unwrap(); + load_embedded_fonts(&app); let themes = ThemeRegistry::new(Assets, app.font_cache()); let theme = themes.get(DEFAULT_THEME_NAME).unwrap(); - let settings = Settings::new("Inconsolata", &app.font_cache(), theme) + let settings = Settings::new("Zed Mono", &app.font_cache(), theme) .unwrap() .with_overrides( language::PLAIN_TEXT.name(), @@ -147,3 +142,21 @@ fn collect_path_args() -> Vec { }) .collect::>() } + +fn load_embedded_fonts(app: &App) { + let font_paths = Assets.list("fonts"); + let embedded_fonts = Mutex::new(Vec::new()); + smol::block_on(app.background().scoped(|scope| { + for font_path in &font_paths { + scope.spawn(async { + let font_path = &*font_path; + let font_bytes = Assets.load(&font_path).unwrap().to_vec(); + embedded_fonts.lock().push(Arc::from(font_bytes)); + }); + } + })); + app.platform() + .fonts() + .add_fonts(&embedded_fonts.into_inner()) + .unwrap(); +}