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
mod cache;
mod font;
mod mapping;
mod metrics;
mod postscript;
mod truetype;

use std::cell::RefCell;
use std::ops::DerefMut;
use std::rc::Rc;

pub use self::font::Font;

use opentype;
use typeface::Tape;

use crate::Result;

pub fn read<T: Tape + 'static>(tape: T) -> Result<Vec<Font<T>>> {
    let tape = Rc::new(RefCell::new(tape));
    let mut fonts = vec![];
    let file = opentype::File::read(tape.borrow_mut().deref_mut())?;
    for font in file.fonts.into_iter() {
        for font in font::read(tape.clone(), font)? {
            fonts.push(font);
        }
    }
    Ok(fonts)
}