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

Download history 26/week @ 2024-06-14 67/week @ 2024-06-21 76/week @ 2024-06-28 64/week @ 2024-07-05 239/week @ 2024-07-12 139/week @ 2024-07-19 68/week @ 2024-07-26 142/week @ 2024-08-02 60/week @ 2024-08-09 109/week @ 2024-08-16 159/week @ 2024-08-23 248/week @ 2024-08-30 187/week @ 2024-09-06 114/week @ 2024-09-13 62/week @ 2024-09-20 204/week @ 2024-09-27

696 downloads per month
Used in 6 crates (5 directly)

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:

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