diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-03 00:12:09 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-03 00:12:09 +0100 |
| commit | aae67bd572ad86f4c57e364daa51a9dc883b8913 (patch) | |
| tree | 0aba021e0748ebad2197ea390385ec5f93ccbc6e /src/font.rs | |
| parent | 1c40dc42e7bc7b799b77f06d25414aca59a044ba (diff) | |
Move and rename many things 🚛
Diffstat (limited to 'src/font.rs')
| -rw-r--r-- | src/font.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/font.rs b/src/font.rs index 68a2db67..40ec5918 100644 --- a/src/font.rs +++ b/src/font.rs @@ -3,19 +3,16 @@ use fontdock::{ContainsChar, FaceFromVec, FontSource}; use ttf_parser::Face; -/// A font loader backed by a dynamic source. -pub type FontLoader = fontdock::FontLoader<Box<DynSource>>; - -/// The dynamic font source. -pub type DynSource = dyn FontSource<Face = OwnedFace>; +/// A font loader that is backed by a dynamic source. +pub type FontLoader = fontdock::FontLoader<Box<dyn FontSource<Face = FaceBuf>>>; /// An owned font face. -pub struct OwnedFace { +pub struct FaceBuf { data: Box<[u8]>, face: Face<'static>, } -impl OwnedFace { +impl FaceBuf { /// Get a reference to the underlying face. pub fn get(&self) -> &Face<'_> { // We can't implement Deref because that would leak the internal 'static @@ -29,7 +26,7 @@ impl OwnedFace { } } -impl FaceFromVec for OwnedFace { +impl FaceFromVec for FaceBuf { fn from_vec(vec: Vec<u8>, i: u32) -> Option<Self> { let data = vec.into_boxed_slice(); @@ -45,7 +42,7 @@ impl FaceFromVec for OwnedFace { } } -impl ContainsChar for OwnedFace { +impl ContainsChar for FaceBuf { fn contains_char(&self, c: char) -> bool { self.get().glyph_index(c).is_some() } |
