WIP on rebuilding with extracted UI framework

This commit is contained in:
Nathan Sobo
2021-03-18 13:13:31 -06:00
parent 356bc41752
commit 23308e17a9
33 changed files with 2673 additions and 657 deletions
+30
View File
@@ -0,0 +1,30 @@
use crate::watch;
use anyhow::Result;
use gpui::fonts::{FamilyId, FontCache};
#[derive(Clone)]
pub struct Settings {
pub buffer_font_family: FamilyId,
pub buffer_font_size: f32,
pub tab_size: usize,
pub ui_font_family: FamilyId,
pub ui_font_size: f32,
}
impl Settings {
pub fn new(font_cache: &FontCache) -> Result<Self> {
Ok(Self {
buffer_font_family: font_cache.load_family(&["Fira Code", "Monaco"])?,
buffer_font_size: 16.0,
tab_size: 4,
ui_font_family: font_cache.load_family(&["SF Pro Display"])?,
ui_font_size: 12.0,
})
}
}
pub fn channel(
font_cache: &FontCache,
) -> Result<(watch::Sender<Settings>, watch::Receiver<Settings>)> {
Ok(watch::channel(Settings::new(font_cache)?))
}