Browse Source

textium: add some getters to the cache

master
Erin 8 years ago
parent
commit
d7dd08d027
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      textium/src/cache.rs

+ 10
- 0
textium/src/cache.rs View File

@ -62,6 +62,16 @@ impl<'a, B> Cache<'a, B> where B: Buffer2d {
None => Err(CacheError::NoSuchFont(name.into())), None => Err(CacheError::NoSuchFont(name.into())),
} }
} }
pub fn get_font(&self, name: &str) -> Option<&Font> {
self.fonts.get(name)
}
pub fn get_face(&self, name: &str, scale: f32) -> Option<&CachedFaceData<B>> {
let key = FaceKey {name: String::from(name), scale: Scale(scale)};
self.faces.get(&key)
}
} }
impl<B> CachedFaceData<B> where B: Buffer2d { impl<B> CachedFaceData<B> where B: Buffer2d {


Loading…
Cancel
Save