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::Font; 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 font = ok!(Font::read(&mut reader));

let fontheader: FontHeader = ok!(ok!(font.take(&mut reader))); asserteq!(fontheader.unitsper_em, 1000);

let horizontalheader: HorizontalHeader = ok!(ok!(font.take(&mut reader))); asserteq!(horizontal_header.ascender, 918);

let namingtable: NamingTable = ok!(ok!(font.take(&mut reader))); match namingtable { NamingTable::Format0(ref table) => { let strings = ok!(table.strings()); asserteq!(&strings[1], "Source Serif Pro"); asserteq!(&strings[9], "Frank Grießhammer"); }, _ => unreachable!(), } ```

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.