webtype 0.1.0

The package provides a parser for fonts in Web Open Font Format.
Documentation

WebType Package Documentation Build

The package provides a parser for fonts in Web Open Font Format.

Example

use opentype::truetype::FontHeader;
use webtype::File;

macro_rules! ok(($result:expr) => ($result.unwrap()));

let path = "NotoNaskhArabic-Regular.woff2";
let mut tape = ok!(std::fs::File::open(path));
let File { mut fonts, data } = ok!(File::read(&mut tape));
let mut tape = std::io::Cursor::new(&data);

let font_header = ok!(ok!(fonts[0].take::<_, FontHeader>(&mut tape)));
assert_eq!(font_header.units_per_em, 2048);

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.md.