Overhaul handling of font families

* Specify font families in the theme.
* Load fonts eagerly when loading themes, instead of loading
  them lazily when rendering.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-08-26 15:06:00 -07:00
parent ee9ee294ad
commit 3bb5610ad1
23 changed files with 438 additions and 397 deletions

View file

@ -6,11 +6,10 @@ use crate::{
settings::{self, ThemeRegistry},
time::ReplicaId,
user::UserStore,
AppState, Settings,
AppState,
};
use gpui::{AppContext, Entity, ModelHandle, MutableAppContext};
use gpui::{Entity, ModelHandle, MutableAppContext};
use parking_lot::Mutex;
use postage::watch;
use smol::channel;
use std::{
marker::PhantomData,
@ -156,14 +155,10 @@ fn write_tree(path: &Path, tree: serde_json::Value) {
}
}
pub fn build_settings(cx: &AppContext) -> watch::Receiver<Settings> {
settings::channel(&cx.font_cache()).unwrap().1
}
pub fn build_app_state(cx: &mut MutableAppContext) -> Arc<AppState> {
let (settings_tx, settings) = settings::channel(&cx.font_cache()).unwrap();
pub fn test_app_state(cx: &mut MutableAppContext) -> Arc<AppState> {
let (settings_tx, settings) = settings::test(cx);
let languages = Arc::new(LanguageRegistry::new());
let themes = ThemeRegistry::new(());
let themes = ThemeRegistry::new((), cx.font_cache().clone());
let rpc = rpc::Client::new();
let user_store = Arc::new(UserStore::new(rpc.clone()));
Arc::new(AppState {