Crate font

Source
Expand description

Builder and parser for fonts.

§Example

use font::glyph::Segment;
use font::File;

macro_rules! ok(($result:expr) => ($result.unwrap()));

let path = "SourceSerifPro-Regular.otf";
let File { mut fonts } = ok!(File::open(path));
let glyph = ok!(ok!(fonts[0].glyph('a')));
for contour in glyph.iter() {
    for segment in contour.iter() {
        match segment {
            &Segment::Linear(..) => { /* … */ },
            &Segment::Quadratic(..) => { /* … */ },
            &Segment::Cubic(..) => { /* … */ },
        }
    }
}

Re-exports§

pub extern crate opentype;
pub extern crate webtype;
pub use self::formats::opentype::axes;
pub use self::formats::opentype::axes::Axes;
pub use self::formats::opentype::characters;
pub use self::formats::opentype::characters::Characters;
pub use self::formats::opentype::features;
pub use self::formats::opentype::features::Directory as Features;
pub use self::formats::opentype::names::Names;
pub use self::formats::opentype::palettes::Palettes;
pub use self::formats::opentype::tables::Tables;
pub use self::glyph::Glyph;

Modules§

formats
Formats.
glyph
Glyphs.

Structs§

File
A file.
Font
A font.
Metrics
Metrics.
Offset
An offset.
Timestamps
Timestamps.

Traits§

Case
A type that represents a font in a specific format.
Read
A type that can read.
Write
A type that can write.

Type Aliases§

Number
A number.