mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-09 03:57:39 +00:00
settings.json: Suggest font names for buffer_font_family
This commit is contained in:
parent
a1049546a2
commit
8d294211db
2 changed files with 28 additions and 7 deletions
|
@ -65,6 +65,9 @@ impl TextSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn all_font_families(&self) -> Vec<String> {
|
||||||
|
self.platform_text_system.all_font_families()
|
||||||
|
}
|
||||||
pub fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> Result<()> {
|
pub fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> Result<()> {
|
||||||
self.platform_text_system.add_fonts(fonts)
|
self.platform_text_system.add_fonts(fonts)
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,9 +194,21 @@ impl settings::Settings for ThemeSettings {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
root_schema
|
let available_fonts = cx
|
||||||
.definitions
|
.text_system()
|
||||||
.extend([("ThemeName".into(), theme_name_schema.into())]);
|
.all_font_families()
|
||||||
|
.into_iter()
|
||||||
|
.map(Value::String)
|
||||||
|
.collect();
|
||||||
|
let fonts_schema = SchemaObject {
|
||||||
|
instance_type: Some(InstanceType::String.into()),
|
||||||
|
enum_values: Some(available_fonts),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
root_schema.definitions.extend([
|
||||||
|
("ThemeName".into(), theme_name_schema.into()),
|
||||||
|
("FontFamilies".into(), fonts_schema.into()),
|
||||||
|
]);
|
||||||
|
|
||||||
root_schema
|
root_schema
|
||||||
.schema
|
.schema
|
||||||
|
@ -204,10 +216,16 @@ impl settings::Settings for ThemeSettings {
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.properties
|
.properties
|
||||||
.extend([(
|
.extend([
|
||||||
|
(
|
||||||
"theme".to_owned(),
|
"theme".to_owned(),
|
||||||
Schema::new_ref("#/definitions/ThemeName".into()),
|
Schema::new_ref("#/definitions/ThemeName".into()),
|
||||||
)]);
|
),
|
||||||
|
(
|
||||||
|
"buffer_font_family".to_owned(),
|
||||||
|
Schema::new_ref("#/definitions/FontFamilies".into()),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
root_schema
|
root_schema
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue