1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
mod font;

pub use self::font::Font;

use std::cell::RefCell;
use std::io::{Cursor, Result};
use std::rc::Rc;

use typeface::Tape;

pub fn read<T: Tape>(mut tape: T) -> Result<Vec<Font<Cursor<Vec<u8>>>>> {
    let mut fonts = vec![];
    let file = webtype::File::read(&mut tape)?;
    let tape = Rc::new(RefCell::new(file.tape));
    for font in file.fonts.into_iter() {
        fonts.extend(self::font::read(tape.clone(), font)?);
    }
    Ok(fonts)
}