Move from Zed fonts to IBM Plex (#13596)

Release Notes:

- Changed the default fonts to IBM Plex Sans and IBM Plex Mono. If you'd
like to go back to using Zed Sans/Zed mono you need to
[download](https://github.com/zed-industries/zed-fonts/releases/tag/1.2.0)
them and install them.
This commit is contained in:
Conrad Irwin 2024-06-27 14:36:44 -06:00 committed by GitHub
parent 6a1b257d39
commit 7d7fd7d25d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 288 additions and 55 deletions

View file

@ -52,4 +52,13 @@ impl Assets {
cx.text_system().add_fonts(embedded_fonts)
}
pub fn load_test_fonts(&self, cx: &AppContext) {
cx.text_system()
.add_fonts(vec![self
.load("fonts/plex-mono/ZedPlexMono-Regular.ttf")
.unwrap()
.unwrap()])
.unwrap()
}
}

View file

@ -1221,7 +1221,7 @@ mod tests {
use super::*;
use crate::display_map::inlay_map::InlayMap;
use crate::display_map::{fold_map::FoldMap, tab_map::TabMap, wrap_map::WrapMap};
use gpui::{div, font, px, AssetSource, Element};
use gpui::{div, font, px, Element};
use multi_buffer::MultiBuffer;
use rand::prelude::*;
use settings::SettingsStore;
@ -2014,12 +2014,7 @@ mod tests {
let settings = SettingsStore::test(cx);
cx.set_global(settings);
theme::init(theme::LoadThemes::JustBase, cx);
cx.text_system()
.add_fonts(vec![assets::Assets
.load("fonts/zed-mono/zed-mono-extended.ttf")
.unwrap()
.unwrap()])
.unwrap();
assets::Assets.load_test_fonts(cx);
}
impl TransformBlock {

View file

@ -10,8 +10,8 @@ use crate::{
};
use futures::StreamExt;
use gpui::{
div, AssetSource, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext,
WindowBounds, WindowOptions,
div, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext, WindowBounds,
WindowOptions,
};
use indoc::indoc;
use language::{
@ -12489,12 +12489,7 @@ pub(crate) fn update_test_project_settings(
pub(crate) fn init_test(cx: &mut TestAppContext, f: fn(&mut AllLanguageSettingsContent)) {
_ = cx.update(|cx| {
cx.text_system()
.add_fonts(vec![assets::Assets
.load("fonts/zed-mono/zed-mono-extended.ttf")
.unwrap()
.unwrap()])
.unwrap();
assets::Assets.load_test_fonts(cx);
let store = SettingsStore::test(cx);
cx.set_global(store);
theme::init(theme::LoadThemes::JustBase, cx);

View file

@ -25,7 +25,7 @@ pub fn marked_display_snapshot(
let (unmarked_text, markers) = marked_text_offsets(text);
let font = Font {
family: "Zed Mono".into(),
family: "Zed Plex Mono".into(),
features: FontFeatures::default(),
weight: FontWeight::default(),
style: FontStyle::default(),

View file

@ -10,7 +10,7 @@ use serde_json::json;
use crate::{Editor, ToPoint};
use collections::HashSet;
use futures::Future;
use gpui::{AssetSource, View, ViewContext, VisualTestContext};
use gpui::{View, ViewContext, VisualTestContext};
use indoc::indoc;
use language::{
point_to_lsp, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageQueries,
@ -39,12 +39,7 @@ impl EditorLspTestContext {
let app_state = cx.update(AppState::test);
cx.update(|cx| {
cx.text_system()
.add_fonts(vec![assets::Assets
.load("fonts/zed-mono/zed-mono-extended.ttf")
.unwrap()
.unwrap()])
.unwrap();
assets::Assets.load_test_fonts(cx);
language::init(cx);
crate::init(cx);
workspace::init(app_state.clone(), cx);

View file

@ -205,7 +205,7 @@ impl CosmicTextSystemState {
) -> Result<SmallVec<[FontId; 4]>> {
// TODO: Determine the proper system UI font.
let name = if name == ".SystemUIFont" {
"Zed Sans"
"Zed Plex Sans"
} else {
name
};

View file

@ -64,7 +64,7 @@ impl TextSystem {
fallback_font_stack: smallvec![
// TODO: This is currently Zed-specific.
// We should allow GPUI users to provide their own fallback font stack.
font("Zed Mono"),
font("Zed Plex Mono"),
font("Helvetica"),
font("Cantarell"), // Gnome
font("Ubuntu"), // Gnome (Ubuntu)

View file

@ -154,12 +154,12 @@ mod tests {
let cx = TestAppContext::new(dispatcher, None);
cx.text_system()
.add_fonts(vec![std::fs::read(
"../../assets/fonts/zed-mono/zed-mono-extended.ttf",
"../../assets/fonts/plex-mono/ZedPlexMono-Regular.ttf",
)
.unwrap()
.into()])
.unwrap();
let id = cx.text_system().font_id(&font("Zed Mono")).unwrap();
let id = cx.text_system().font_id(&font("Zed Plex Mono")).unwrap();
cx.update(|cx| {
let text_system = cx.text_system().clone();

View file

@ -109,13 +109,13 @@ pub fn main() {
MARKDOWN_EXAMPLE.to_string(),
MarkdownStyle {
code_block: gpui::TextStyleRefinement {
font_family: Some("Zed Mono".into()),
font_family: Some("Zed Plex Mono".into()),
color: Some(cx.theme().colors().editor_foreground),
background_color: Some(cx.theme().colors().editor_background),
..Default::default()
},
inline_code: gpui::TextStyleRefinement {
font_family: Some("Zed Mono".into()),
font_family: Some("Zed Plex Mono".into()),
// @nate: Could we add inline-code specific styles to the theme?
color: Some(cx.theme().colors().editor_foreground),
background_color: Some(cx.theme().colors().editor_background),

View file

@ -116,7 +116,7 @@ impl DevServerProjects {
let markdown_style = MarkdownStyle {
code_block: gpui::TextStyleRefinement {
font_family: Some("Zed Mono".into()),
font_family: Some("Zed Plex Mono".into()),
color: Some(cx.theme().colors().editor_foreground),
background_color: Some(cx.theme().colors().editor_background),
..Default::default()

View file

@ -117,7 +117,7 @@ impl Render for StoryWrapper {
.flex()
.flex_col()
.size_full()
.font_family("Zed Mono")
.font_family("Zed Plex Mono")
.child(self.story.clone())
}
}

View file

@ -3111,11 +3111,11 @@ mod tests {
cx.text_system()
.add_fonts(vec![
Assets
.load("fonts/zed-sans/zed-sans-extended.ttf")
.load("fonts/plex-mono/ZedPlexMono-Regular.ttf")
.unwrap()
.unwrap(),
Assets
.load("fonts/zed-mono/zed-mono-extended.ttf")
.load("fonts/plex-sans/ZedPlexSans-Regular.ttf")
.unwrap()
.unwrap(),
])

View file

@ -3,6 +3,8 @@ use gpui::{
InteractiveElement, IntoElement, ParentElement, PromptHandle, PromptLevel, PromptResponse,
Render, RenderablePromptHandle, Styled, ViewContext, VisualContext, WindowContext,
};
use settings::Settings;
use theme::ThemeSettings;
use ui::{
h_flex, v_flex, ButtonCommon, ButtonStyle, Clickable, ElevationIndex, FluentBuilder, LabelSize,
TintColor,
@ -56,6 +58,8 @@ impl FallbackPromptRenderer {
}
impl Render for FallbackPromptRenderer {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let settings = ThemeSettings::get_global(cx);
let font_family = settings.ui_font.family.clone();
let prompt = v_flex()
.key_context("Prompt")
.cursor_default()
@ -67,7 +71,7 @@ impl Render for FallbackPromptRenderer {
.overflow_hidden()
.p_4()
.gap_4()
.font_family("Zed Sans")
.font_family(font_family)
.child(
div()
.w_full()