opentype 0.3.4

The package provides a parser for OpenType fonts.
docs.rs failed to build opentype-0.3.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: opentype-0.35.2

OpenType Version Status

The package provides a parser for OpenType fonts.

Documentation

Example

use opentype::Font;
use opentype::compound::NamingTable;
use std::fs::File;

let path = "SourceSerifPro-Regular.otf";
let mut file = File::open(path).unwrap();
let font = Font::read(&mut file).unwrap();

match font.font_header {
    Some(ref table) => assert_eq!(table.unitsPerEm, 1000),
    _ => unreachable!(),
}
match font.horizontal_header {
    Some(ref table) => assert_eq!(table.Ascender, 918),
    _ => unreachable!(),
}
match font.naming_table {
    Some(NamingTable::Format0(ref table)) => {
        let strings = table.strings().unwrap();
        assert_eq!(&strings[1], "Source Serif Pro");
        assert_eq!(&strings[9], "Frank Grießhammer");
    },
    _ => unreachable!(),
}

Contributing

  1. Fork the project.
  2. Implement your idea.
  3. Open a pull request.