1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::path::Path;
use typeface::Tape;
use crate::Result;
pub struct File<T> {
pub fonts: Vec<crate::font::Font<T>>,
}
impl<T: Tape + 'static> File<T> {
#[inline]
pub fn read(tape: T) -> Result<Self> {
Ok(Self {
fonts: crate::font::read(tape)?,
})
}
}
impl File<::std::fs::File> {
#[inline]
pub fn open<T: AsRef<Path>>(path: T) -> Result<Self> {
Self::read(::std::fs::File::open(path)?)
}
}
dereference! { File<T>::fonts => [crate::font::Font<T>] }