Use IBM Plex Sans / Lilex (#36084)
The Zed Plex fonts were found to violate the OFL by using the word Plex in the name. Lilex has better ligatures and box-drawing characters than Zed Plex Mono, but Zed Plex Sans should be identical to IBM Plex Sans. Closes #15542 Closes zed-industries/zed-fonts#31 Release Notes: - The "Zed Plex Sans" and "Zed Plex Mono" fonts have been replaced with "IBM Plex Sans" and "Lilex". The old names still work for backward compatibility. Other than fixing line-drawing characters, and improving the ligatures, there should be little visual change as the fonts are all of the same family. - Introduced ".ZedSans" and ".ZedMono" as aliases to allow us to easily change the default fonts in the future. These currently default to "IBM Plex Sans" and "Lilex" respectively.
This commit is contained in:
parent
4a35498829
commit
bd61eb0889
37 changed files with 58 additions and 110 deletions
|
@ -58,9 +58,7 @@ impl Assets {
|
|||
pub fn load_test_fonts(&self, cx: &App) {
|
||||
cx.text_system()
|
||||
.add_fonts(vec![
|
||||
self.load("fonts/plex-mono/ZedPlexMono-Regular.ttf")
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
self.load("fonts/lilex/Lilex-Regular.ttf").unwrap().unwrap(),
|
||||
])
|
||||
.unwrap()
|
||||
}
|
||||
|
|
|
@ -2290,8 +2290,6 @@ mod tests {
|
|||
fn test_blocks_on_wrapped_lines(cx: &mut gpui::TestAppContext) {
|
||||
cx.update(init_test);
|
||||
|
||||
let _font_id = cx.text_system().font_id(&font("Helvetica")).unwrap();
|
||||
|
||||
let text = "one two three\nfour five six\nseven eight";
|
||||
|
||||
let buffer = cx.update(|cx| MultiBuffer::build_simple(text, cx));
|
||||
|
|
|
@ -1223,7 +1223,7 @@ mod tests {
|
|||
let tab_size = NonZeroU32::new(rng.gen_range(1..=4)).unwrap();
|
||||
|
||||
let font = test_font();
|
||||
let _font_id = text_system.font_id(&font);
|
||||
let _font_id = text_system.resolve_font(&font);
|
||||
let font_size = px(14.0);
|
||||
|
||||
log::info!("Tab size: {}", tab_size);
|
||||
|
|
|
@ -53,7 +53,7 @@ pub fn marked_display_snapshot(
|
|||
let (unmarked_text, markers) = marked_text_offsets(text);
|
||||
|
||||
let font = Font {
|
||||
family: "Zed Plex Mono".into(),
|
||||
family: ".ZedMono".into(),
|
||||
features: FontFeatures::default(),
|
||||
fallbacks: None,
|
||||
weight: FontWeight::default(),
|
||||
|
|
|
@ -213,11 +213,7 @@ impl CosmicTextSystemState {
|
|||
features: &FontFeatures,
|
||||
) -> Result<SmallVec<[FontId; 4]>> {
|
||||
// TODO: Determine the proper system UI font.
|
||||
let name = if name == ".SystemUIFont" {
|
||||
"Zed Plex Sans"
|
||||
} else {
|
||||
name
|
||||
};
|
||||
let name = crate::text_system::font_name_with_fallbacks(name, "IBM Plex Sans");
|
||||
|
||||
let families = self
|
||||
.font_system
|
||||
|
|
|
@ -211,11 +211,7 @@ impl MacTextSystemState {
|
|||
features: &FontFeatures,
|
||||
fallbacks: Option<&FontFallbacks>,
|
||||
) -> Result<SmallVec<[FontId; 4]>> {
|
||||
let name = if name == ".SystemUIFont" {
|
||||
".AppleSystemUIFont"
|
||||
} else {
|
||||
name
|
||||
};
|
||||
let name = crate::text_system::font_name_with_fallbacks(name, ".AppleSystemUIFont");
|
||||
|
||||
let mut font_ids = SmallVec::new();
|
||||
let family = self
|
||||
|
|
|
@ -498,8 +498,9 @@ impl DirectWriteState {
|
|||
)
|
||||
.unwrap()
|
||||
} else {
|
||||
let family = self.system_ui_font_name.clone();
|
||||
self.find_font_id(
|
||||
target_font.family.as_ref(),
|
||||
font_name_with_fallbacks(target_font.family.as_ref(), family.as_ref()),
|
||||
target_font.weight,
|
||||
target_font.style,
|
||||
&target_font.features,
|
||||
|
@ -512,7 +513,6 @@ impl DirectWriteState {
|
|||
}
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
{
|
||||
let family = self.system_ui_font_name.clone();
|
||||
log::error!("{} not found, use {} instead.", target_font.family, family);
|
||||
self.get_font_id_from_font_collection(
|
||||
family.as_ref(),
|
||||
|
|
|
@ -65,7 +65,7 @@ impl TextSystem {
|
|||
font_runs_pool: Mutex::default(),
|
||||
fallback_font_stack: smallvec![
|
||||
// TODO: Remove this when Linux have implemented setting fallbacks.
|
||||
font("Zed Plex Mono"),
|
||||
font(".ZedMono"),
|
||||
font("Helvetica"),
|
||||
font("Segoe UI"), // Windows
|
||||
font("Cantarell"), // Gnome
|
||||
|
@ -96,7 +96,7 @@ impl TextSystem {
|
|||
}
|
||||
|
||||
/// Get the FontId for the configure font family and style.
|
||||
pub fn font_id(&self, font: &Font) -> Result<FontId> {
|
||||
fn font_id(&self, font: &Font) -> Result<FontId> {
|
||||
fn clone_font_id_result(font_id: &Result<FontId>) -> Result<FontId> {
|
||||
match font_id {
|
||||
Ok(font_id) => Ok(*font_id),
|
||||
|
@ -844,3 +844,16 @@ impl FontMetrics {
|
|||
(self.bounding_box / self.units_per_em as f32 * font_size.0).map(px)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn font_name_with_fallbacks<'a>(name: &'a str, system: &'a str) -> &'a str {
|
||||
// Note: the "Zed Plex" fonts were deprecated as we are not allowed to use "Plex"
|
||||
// in a derived font name. They are essentially indistinguishable from IBM Plex/Lilex,
|
||||
// and so retained here for backward compatibility.
|
||||
match name {
|
||||
".SystemUIFont" => system,
|
||||
".ZedSans" | "Zed Plex Sans" => "IBM Plex Sans",
|
||||
".ZedMono" | "Zed Plex Mono" => "Lilex",
|
||||
_ => name,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ mod tests {
|
|||
fn build_wrapper() -> LineWrapper {
|
||||
let dispatcher = TestDispatcher::new(StdRng::seed_from_u64(0));
|
||||
let cx = TestAppContext::build(dispatcher, None);
|
||||
let id = cx.text_system().font_id(&font("Zed Plex Mono")).unwrap();
|
||||
let id = cx.text_system().resolve_font(&font(".ZedMono"));
|
||||
LineWrapper::new(id, px(16.), cx.text_system().platform_text_system.clone())
|
||||
}
|
||||
|
||||
|
|
|
@ -77,16 +77,16 @@ impl Render for MarkdownExample {
|
|||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let markdown_style = MarkdownStyle {
|
||||
base_text_style: gpui::TextStyle {
|
||||
font_family: "Zed Plex Sans".into(),
|
||||
font_family: ".ZedSans".into(),
|
||||
color: cx.theme().colors().terminal_ansi_black,
|
||||
..Default::default()
|
||||
},
|
||||
code_block: StyleRefinement::default()
|
||||
.font_family("Zed Plex Mono")
|
||||
.font_family(".ZedMono")
|
||||
.m(rems(1.))
|
||||
.bg(rgb(0xAAAAAAA)),
|
||||
inline_code: gpui::TextStyleRefinement {
|
||||
font_family: Some("Zed Mono".into()),
|
||||
font_family: Some(".ZedMono".into()),
|
||||
color: Some(cx.theme().colors().editor_foreground),
|
||||
background_color: Some(cx.theme().colors().editor_background),
|
||||
..Default::default()
|
||||
|
|
|
@ -128,7 +128,7 @@ impl Render for StoryWrapper {
|
|||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.font_family("Zed Plex Mono")
|
||||
.font_family(".ZedMono")
|
||||
.child(self.story.clone())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,9 +284,7 @@ pub fn init(cx: &mut App) {
|
|||
let count = Vim::take_count(cx).unwrap_or(1) as f32;
|
||||
Vim::take_forced_motion(cx);
|
||||
let theme = ThemeSettings::get_global(cx);
|
||||
let Ok(font_id) = window.text_system().font_id(&theme.buffer_font) else {
|
||||
return;
|
||||
};
|
||||
let font_id = window.text_system().resolve_font(&theme.buffer_font);
|
||||
let Ok(width) = window
|
||||
.text_system()
|
||||
.advance(font_id, theme.buffer_font_size(cx), 'm')
|
||||
|
@ -300,9 +298,7 @@ pub fn init(cx: &mut App) {
|
|||
let count = Vim::take_count(cx).unwrap_or(1) as f32;
|
||||
Vim::take_forced_motion(cx);
|
||||
let theme = ThemeSettings::get_global(cx);
|
||||
let Ok(font_id) = window.text_system().font_id(&theme.buffer_font) else {
|
||||
return;
|
||||
};
|
||||
let font_id = window.text_system().resolve_font(&theme.buffer_font);
|
||||
let Ok(width) = window
|
||||
.text_system()
|
||||
.advance(font_id, theme.buffer_font_size(cx), 'm')
|
||||
|
|
|
@ -4401,11 +4401,11 @@ mod tests {
|
|||
cx.text_system()
|
||||
.add_fonts(vec![
|
||||
Assets
|
||||
.load("fonts/plex-mono/ZedPlexMono-Regular.ttf")
|
||||
.load("fonts/lilex/Lilex-Regular.ttf")
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
Assets
|
||||
.load("fonts/plex-sans/ZedPlexSans-Regular.ttf")
|
||||
.load("fonts/ibm-plex-sans/IBMPlexSans-Regular.ttf")
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue