diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-01-24 16:48:24 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-01-24 17:39:49 +0100 |
| commit | 3739ab77207e0e54edb55a110a16a1eb925b84f4 (patch) | |
| tree | 06c8e5987d2fe070ad273ef94641161bbaef7095 /src/font.rs | |
| parent | db158719d67fdef1d2c76300fb232cf2d4bfb35d (diff) | |
Export into rendered images
Diffstat (limited to 'src/font.rs')
| -rw-r--r-- | src/font.rs | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/src/font.rs b/src/font.rs index c2e1beac..674ffa63 100644 --- a/src/font.rs +++ b/src/font.rs @@ -13,7 +13,7 @@ use crate::loading::{FileHash, Loader}; use crate::util::decode_mac_roman; /// A unique identifier for a loaded font face. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub struct FaceId(u32); impl FaceId { @@ -37,7 +37,6 @@ pub struct FontStore { faces: Vec<Option<Face>>, families: BTreeMap<String, Vec<FaceId>>, buffers: HashMap<FileHash, Rc<Vec<u8>>>, - on_load: Option<Box<dyn Fn(FaceId, &Face)>>, } impl FontStore { @@ -57,18 +56,9 @@ impl FontStore { faces, families, buffers: HashMap::new(), - on_load: None, } } - /// Register a callback which is invoked each time a font face is loaded. - pub fn on_load<F>(&mut self, f: F) - where - F: Fn(FaceId, &Face) + 'static, - { - self.on_load = Some(Box::new(f)); - } - /// Query for and load the font face from the given `family` that most /// closely matches the given `variant`. pub fn select(&mut self, family: &str, variant: FontVariant) -> Option<FaceId> { @@ -124,10 +114,6 @@ impl FontStore { }; let face = Face::new(Rc::clone(buffer), index)?; - if let Some(callback) = &self.on_load { - callback(id, &face); - } - *slot = Some(face); } |
