opentype 0.12.0

The package provides a parser for OpenType fonts.
Documentation

OpenType Version Status

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

Documentation

Example

extern crate opentype;
extern crate truetype;

use opentype::File;
use truetype::NamingTable;

let path = "SourceSerifPro-Regular.otf";
let file = File::open(path).unwrap();
let font = &file[0];

assert_eq!(font.font_header.as_ref().unwrap().units_per_em, 1000);
assert_eq!(font.horizontal_header.as_ref().unwrap().ascender, 918);
let strings = match font.naming_table {
    Some(NamingTable::Format0(ref table)) => table.strings().unwrap(),
    _ => unreachable!(),
};
assert_eq!(&strings[1], "Source Serif Pro");
assert_eq!(&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.