Extract platform-dependant FontSystem

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-03-24 16:51:28 +01:00
parent e0e4cff815
commit 9178e91cc0
17 changed files with 453 additions and 399 deletions

View file

@ -2,7 +2,7 @@ use crate::{
app::{AppContext, MutableAppContext, WindowInvalidation},
elements::Element,
fonts::FontCache,
platform::Event,
platform::{self, Event},
text_layout::TextLayoutCache,
AssetCache, ElementBox, Scene,
};
@ -22,6 +22,7 @@ impl Presenter {
pub fn new(
window_id: usize,
font_cache: Arc<FontCache>,
fonts: Arc<dyn platform::FontSystem>,
asset_cache: Arc<AssetCache>,
app: &MutableAppContext,
) -> Self {
@ -30,7 +31,7 @@ impl Presenter {
rendered_views: app.render_views(window_id).unwrap(),
parents: HashMap::new(),
font_cache,
text_layout_cache: TextLayoutCache::new(),
text_layout_cache: TextLayoutCache::new(fonts),
asset_cache,
}
}