Expand description
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
:
let layer = font_obj.default_layer();
let glyph_a = layer.get_glyph("A").expect("missing glyph");
assert_eq!(glyph_a.name().as_ref(), "A");
Serialize the Font
to UFO files on disk with the Font::save
method:
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.
Re-exports§
pub use fontinfo::FontInfo;
Modules§
- datastore
- Storage structures for UFO data and images.
- designspace
- Reading and writing designspace files.
- error
- Error types.
- fontinfo
- The contents of
fontinfo.plist
.
Structs§
- Affine
Transform - A 2D affine transformation.
- Anchor
- A reference position in a glyph, such as for attaching accents.
- Codepoints
- A set of Unicode codepoints
- Color
- A color in RGBA (Red-Green-Blue-Alpha) format.
- Component
- A reference to another glyph, to be included in this glyph’s outline.
- Contour
- A single open or closed bezier path segment.
- Contour
Point - A single point in a
Contour
. - Data
Request - A type that describes which components of a UFO should be loaded.
- Font
- A font object, corresponding to a UFO directory. A Unified Font Object.
- Glyph
- A glyph, loaded from a
.glif
file. - Guideline
- A guideline associated with a glyph.
- Identifier
- A UFO Object Identifier.
- Image
- An image included in a glyph.
- Layer
- A UFO layer, corresponding to a ‘glyphs’ sub-directory.
- Layer
Contents - The ordered list of
Layer
objects within a UFO. - Meta
Info - The contents of the
metainfo.plist
file. - Name
- A name used to identify a
Glyph
or aLayer
. - Write
Options - Options that can be set when writing the UFO to disk.
Enums§
- Format
Version - A version of the UFO spec.
- Line
- An infinite line.
- Point
Type - Possible types of points that can exist in a
Contour
. - Quote
Char - The quote character used to write the XML declaration.
Functions§
- user_
name_ to_ file_ name - Given a
name
, return an appropriate file name.