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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//! Utilties for working with [Unified Font Object][ufo] files.
//!
//! The types in this crate correspond to types described in the spec.
//!
//! [ufo]: http://unifiedfontobject.org/versions/ufo3
//!
//! # Basic Usage
//!
//! Instantiate a UFO font object with a [`Font`] struct like this:
//!
//! ```no_run
//! use norad::Font;
//!
//! let inpath = "RoflsExtraDim.ufo";
//! let mut font_obj = Font::load(inpath).expect("failed to load font");
//! # let layer = font_obj.default_layer();
//! # let glyph_a = layer.get_glyph("A").expect("missing glyph");
//! # assert_eq!(glyph_a.name().as_ref(), "A");
//! # let outpath = "RoflsSemiDim.ufo";
//! # font_obj.save(outpath);
//! ```
//!
//! The API may be used to access and modify data in the [`Font`]:
//!
//!```no_run
//! # use norad::Font;
//! # let inpath = "RoflsExtraDim.ufo";
//! # let mut font_obj = Font::load(inpath).expect("failed to load font");
//! let layer = font_obj.default_layer();
//! let glyph_a = layer.get_glyph("A").expect("missing glyph");
//! assert_eq!(glyph_a.name().as_ref(), "A");
//! # let outpath = "RoflsSemiDim.ufo";
//! # font_obj.save(outpath);
//! ```
//!
//! Serialize the [`Font`] to UFO files on disk with the [`Font::save`] method:
//!
//!```no_run
//! # use norad::Font;
//! # let inpath = "RoflsExtraDim.ufo";
//! # let mut font_obj = Font::load(inpath).expect("failed to load font");
//! # let layer = font_obj.default_layer();
//! # let glyph_a = layer.get_glyph("A").expect("missing glyph");
//! # assert_eq!(glyph_a.name().as_ref(), "A");
//! let outpath = "RoflsSemiDim.ufo";
//! font_obj.save(outpath);
//! ```
//!
//! Refer to the [`examples` directory of the source repository](https://github.com/linebender/norad/tree/master/examples)
//! for additional source code examples.
//!
//! # API Documentation
//!
//! Details on the full API for working with UFO fonts are available in these docs.
//!
//! # License
//!
//! norad is licensed under the [MIT](https://github.com/linebender/norad/blob/master/LICENSE-MIT)
//! and [Apache v2.0](https://github.com/linebender/norad/blob/master/LICENSE-APACHE) licenses.
//!
//! # Source
//!
//! Source files are available at <https://github.com/linebender/norad>.

#![warn(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links, unsafe_code)]

#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_repr;

mod data_request;
pub mod datastore;
pub mod designspace;
pub mod error;
mod font;
pub mod fontinfo;
mod glyph;
mod groups;
mod guideline;
mod identifier;
mod kerning;
mod layer;
mod name;
mod names;
mod serde_xml_plist;
mod shared_types;
mod upconversion;
pub(crate) mod util;
mod write;

pub use data_request::DataRequest;
pub use font::{Font, FormatVersion, MetaInfo};
pub use fontinfo::FontInfo;
pub use glyph::{
    AffineTransform, Anchor, Codepoints, Component, Contour, ContourPoint, Glyph, Image, PointType,
};

pub use name::Name;

pub use groups::Groups;
pub use guideline::{Guideline, Line};
pub use identifier::Identifier;
pub use kerning::Kerning;
pub use layer::{Layer, LayerContents};
pub use shared_types::{Color, Plist};
pub use util::user_name_to_file_name;
pub use write::{QuoteChar, WriteOptions};