#font #ufo #fonts

norad

Read and write Unified Font Object files

15 releases (9 breaking)

0.10.0 Mar 17, 2023
0.8.0 Dec 5, 2022
0.7.0 Mar 3, 2022
0.6.0 Oct 21, 2021
0.0.1 May 22, 2019

#201 in Text processing

Download history 251/week @ 2022-12-05 407/week @ 2022-12-12 131/week @ 2022-12-19 89/week @ 2022-12-26 263/week @ 2023-01-02 390/week @ 2023-01-09 177/week @ 2023-01-16 294/week @ 2023-01-23 87/week @ 2023-01-30 110/week @ 2023-02-06 160/week @ 2023-02-13 65/week @ 2023-02-20 147/week @ 2023-02-27 233/week @ 2023-03-06 440/week @ 2023-03-13 856/week @ 2023-03-20

1,678 downloads per month
Used in 4 crates

MIT/Apache

400KB
8K 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:

Utilties 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");
# 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]:

 # 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

~3–15MB
~284K SLoC