1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! A parser for OpenType fonts.
//!
//! ## Example
//!
//! ```
//! extern crate opentype;
//!
//! use std::collections::HashMap;
//!
//! use opentype::Font;
//! use opentype::truetype::{FontHeader, HorizontalHeader};
//! use opentype::truetype::naming_table::{NameID, NamingTable};
//!
//! macro_rules! ok(($result:expr) => ($result.unwrap()));
//!
//! # fn main() {
//! let path = "SourceSerifPro-Regular.otf";
//! # let path = "tests/fixtures/SourceSerifPro-Regular.otf";
//! let mut reader = ok!(std::fs::File::open(path));
//! let font = ok!(Font::read(&mut reader));
//!
//! let font_header: FontHeader = ok!(ok!(font.take(&mut reader)));
//! assert_eq!(font_header.units_per_em, 1000);
//!
//! let horizontal_header: HorizontalHeader = ok!(ok!(font.take(&mut reader)));
//! assert_eq!(horizontal_header.ascender, 918);
//!
//! let naming_table: NamingTable = ok!(ok!(font.take(&mut reader)));
//! let names: Vec<_> = naming_table.collect();
//! let names: HashMap<_, _> = names
//!     .iter()
//!     .map(|((name_id, _), value)| (*name_id, value.as_deref()))
//!     .collect();
//! assert_eq!(ok!(names[&NameID::FullFontName]), "Source Serif Pro");
//! assert_eq!(ok!(names[&NameID::DesignerName]), "Frank Grießhammer");
//! # }
//! ```

pub extern crate postscript;
pub extern crate truetype;

#[macro_use(flags, jump_take, jump_take_maybe, jump_take_given, raise, table)]
extern crate typeface;

pub mod compact2;
pub mod glyph_definition;
pub mod glyph_positioning;
pub mod glyph_substitution;
pub mod layout;
pub mod variation;

mod file;
mod font;
mod table;

pub use typeface::{Error, Result, Tape, Value, Walue};

pub use file::File;
pub use font::Font;
pub use glyph_definition::GlyphDefinition;
pub use glyph_positioning::GlyphPositioning;
pub use glyph_substitution::GlyphSubstitution;
pub use table::Table;