Crate opentype [−] [src]
A parser for OpenType fonts.
Example
extern crate opentype; extern crate truetype; use opentype::File; use truetype::NamingTable; let path = "SourceSerifPro-Regular.otf"; let file = File::open(path).unwrap(); assert_eq!(file.font_header.as_ref().unwrap().units_per_em, 1000); assert_eq!(file.horizontal_header.as_ref().unwrap().ascender, 918); let strings = match file.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");
Structs
File |
A font file. |
Type Definitions
Error |
An error. |
Result |
A result. |