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
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue