mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-08 19:43:11 +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<()> {
|
||||
self.platform_text_system.add_fonts(fonts)
|
||||
}
|
||||
|
|
|
@ -194,9 +194,21 @@ impl settings::Settings for ThemeSettings {
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
root_schema
|
||||
.definitions
|
||||
.extend([("ThemeName".into(), theme_name_schema.into())]);
|
||||
let available_fonts = cx
|
||||
.text_system()
|
||||
.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
|
||||
.schema
|
||||
|
@ -204,10 +216,16 @@ impl settings::Settings for ThemeSettings {
|
|||
.as_mut()
|
||||
.unwrap()
|
||||
.properties
|
||||
.extend([(
|
||||
"theme".to_owned(),
|
||||
Schema::new_ref("#/definitions/ThemeName".into()),
|
||||
)]);
|
||||
.extend([
|
||||
(
|
||||
"theme".to_owned(),
|
||||
Schema::new_ref("#/definitions/ThemeName".into()),
|
||||
),
|
||||
(
|
||||
"buffer_font_family".to_owned(),
|
||||
Schema::new_ref("#/definitions/FontFamilies".into()),
|
||||
),
|
||||
]);
|
||||
|
||||
root_schema
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue