Remove unused dependencies and avoid instantiating FontCache in tests
This commit is contained in:
parent
5f3dbb05d6
commit
0906b2a2f4
7 changed files with 11 additions and 21 deletions
|
@ -5,7 +5,7 @@ use crate::{
|
|||
platform::{self, App as _, WindowOptions},
|
||||
presenter::Presenter,
|
||||
util::post_inc,
|
||||
AssetCache, AssetSource, FontCache,
|
||||
AssetCache, AssetSource, FontCache, TextLayoutCache,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use keymap::MatchResult;
|
||||
|
@ -624,10 +624,11 @@ impl MutableAppContext {
|
|||
) {
|
||||
Err(e) => log::error!("error opening window: {}", e),
|
||||
Ok(mut window) => {
|
||||
let text_layout_cache = TextLayoutCache::new(self.platform.fonts());
|
||||
let presenter = Rc::new(RefCell::new(Presenter::new(
|
||||
window_id,
|
||||
self.font_cache.clone(),
|
||||
self.platform.fonts(),
|
||||
text_layout_cache,
|
||||
self.assets.clone(),
|
||||
self,
|
||||
)));
|
||||
|
|
|
@ -22,7 +22,7 @@ impl Presenter {
|
|||
pub fn new(
|
||||
window_id: usize,
|
||||
font_cache: Arc<FontCache>,
|
||||
fonts: Arc<dyn platform::FontSystem>,
|
||||
text_layout_cache: TextLayoutCache,
|
||||
asset_cache: Arc<AssetCache>,
|
||||
app: &MutableAppContext,
|
||||
) -> Self {
|
||||
|
@ -31,7 +31,7 @@ impl Presenter {
|
|||
rendered_views: app.render_views(window_id).unwrap(),
|
||||
parents: HashMap::new(),
|
||||
font_cache,
|
||||
text_layout_cache: TextLayoutCache::new(fonts),
|
||||
text_layout_cache,
|
||||
asset_cache,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
use crate::{
|
||||
color::ColorU,
|
||||
fonts::{FontCache, FontId, GlyphId},
|
||||
fonts::{FontId, GlyphId},
|
||||
geometry::rect::RectF,
|
||||
platform, scene, PaintContext,
|
||||
};
|
||||
use core_foundation::{
|
||||
attributed_string::CFMutableAttributedString,
|
||||
base::{CFRange, TCFType},
|
||||
string::CFString,
|
||||
};
|
||||
use core_text::{font::CTFont, line::CTLine, string_attributes::kCTFontAttributeName};
|
||||
use ordered_float::OrderedFloat;
|
||||
use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
|
||||
use pathfinder_geometry::vector::{vec2f, Vector2F};
|
||||
use pathfinder_geometry::vector::Vector2F;
|
||||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
char,
|
||||
collections::HashMap,
|
||||
convert::TryFrom,
|
||||
hash::{Hash, Hasher},
|
||||
ops::Range,
|
||||
sync::Arc,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue