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::Characters;
  • pub use self::formats::opentype::features;
  • pub use self::formats::opentype::features::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§

Structs§

Traits§

  • A type that represents a font in a specific format.
  • A type that can read.
  • A type that can write.

Type Aliases§