OpenType Version Status

The package provides a parser for OpenType fonts. It might be helpful to have a look at a higher-level parser called font, which internally relies on this package.

Documentation

Example

```rust extern crate opentype; extern crate truetype;

use opentype::File; use truetype::{FontHeader, HorizontalHeader, NamingTable};

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

let path = "SourceSerifPro-Regular.otf"; let mut reader = ok!(std::fs::File::open(path)); let file = ok!(File::read(&mut reader));

asserteq!(ok!(ok!(file[0].take::<_, FontHeader>(&mut reader))).unitsperem, 1000); asserteq!(ok!(ok!(file[0].take::<_, HorizontalHeader>(&mut reader))).ascender, 918); let strings = match ok!(ok!(file[0].take::<_, NamingTable>(&mut reader))) { NamingTable::Format0(ref table) => ok!(table.strings()), _ => unreachable!(), }; asserteq!(&strings[1], "Source Serif Pro"); asserteq!(&strings[9], "Frank Grießhammer"); ```

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.