22 releases (13 breaking)

0.14.1 Mar 13, 2024
0.14.0 Dec 1, 2023
0.13.0 Oct 27, 2023
0.10.2 Jun 29, 2023
0.0.1 May 22, 2019

#113 in Text processing

Download history 6/week @ 2023-12-30 162/week @ 2024-01-06 85/week @ 2024-01-13 57/week @ 2024-01-20 271/week @ 2024-01-27 216/week @ 2024-02-03 147/week @ 2024-02-10 63/week @ 2024-02-17 70/week @ 2024-02-24 108/week @ 2024-03-02 338/week @ 2024-03-09 295/week @ 2024-03-16 102/week @ 2024-03-23 191/week @ 2024-03-30 104/week @ 2024-04-06 118/week @ 2024-04-13

540 downloads per month
Used in 4 crates

MIT/Apache

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:

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");

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