23 releases (13 breaking)
new 0.14.2 | Oct 4, 2024 |
---|---|
0.14.1 | Mar 13, 2024 |
0.14.0 | Dec 1, 2023 |
0.13.0 | Oct 27, 2023 |
0.0.1 | May 22, 2019 |
#219 in Text processing
696 downloads per month
Used in 6 crates
(5 directly)
435KB
9K
SLoC
Norad
a Rust crate for working with Unified Font Object files.
A crate for reading, writing, and manipulating Unified Font Object files, a common font-design format.
lib.rs
:
Utilities for working with Unified Font Object files.
The types in this crate correspond to types described in the spec.
Basic Usage
Instantiate a UFO font object with a Font
struct like this:
use norad::Font;
let inpath = "RoflsExtraDim.ufo";
let mut font_obj = Font::load(inpath).expect("failed to load font");
The API may be used to access and modify data in the Font
:
# 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:
# 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
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 and Apache v2.0 licenses.
Source
Source files are available at https://github.com/linebender/norad.
Dependencies
~4–5.5MB
~95K SLoC