Add ui_font settings and set default rem size accordingly (#3346)
[[PR Description]] - Adds ui_font_family, ui_font_features, ui_font_size to settings and default settings - Use the new ui font settings to set the rem size when the workspace is created. Release Notes: - N/A
This commit is contained in:
commit
a526f23c81
5 changed files with 46 additions and 16 deletions
|
@ -34,6 +34,10 @@ pub struct ThemeSettingsContent {
|
|||
#[serde(default)]
|
||||
pub ui_font_size: Option<f32>,
|
||||
#[serde(default)]
|
||||
pub ui_font_family: Option<String>,
|
||||
#[serde(default)]
|
||||
pub ui_font_features: Option<FontFeatures>,
|
||||
#[serde(default)]
|
||||
pub buffer_font_family: Option<String>,
|
||||
#[serde(default)]
|
||||
pub buffer_font_size: Option<f32>,
|
||||
|
@ -120,10 +124,10 @@ impl settings::Settings for ThemeSettings {
|
|||
let themes = cx.default_global::<ThemeRegistry>();
|
||||
|
||||
let mut this = Self {
|
||||
ui_font_size: defaults.ui_font_size.unwrap_or(16.).into(),
|
||||
ui_font_size: defaults.ui_font_size.unwrap().into(),
|
||||
ui_font: Font {
|
||||
family: "Helvetica".into(),
|
||||
features: Default::default(),
|
||||
family: defaults.ui_font_family.clone().unwrap().into(),
|
||||
features: defaults.ui_font_features.clone().unwrap(),
|
||||
weight: Default::default(),
|
||||
style: Default::default(),
|
||||
},
|
||||
|
@ -149,6 +153,13 @@ impl settings::Settings for ThemeSettings {
|
|||
this.buffer_font.features = value;
|
||||
}
|
||||
|
||||
if let Some(value) = value.ui_font_family {
|
||||
this.ui_font.family = value.into();
|
||||
}
|
||||
if let Some(value) = value.ui_font_features {
|
||||
this.ui_font.features = value;
|
||||
}
|
||||
|
||||
if let Some(value) = &value.theme {
|
||||
if let Some(theme) = themes.get(value).log_err() {
|
||||
this.active_theme = theme;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue