Skip to main content

Crate glyphore

Crate glyphore 

Source
Expand description

MapLibre glyph PBF generation for Rust.

This facade re-exports FontFace, generate_range, and Error from glyphore-core.

§Command-line interface

Install and build every covered range from a directory of fonts:

cargo install glyphore
glyphore build ./fonts -o ./glyphs

§Feature flags

The default cli feature builds the glyphore command-line interface and enables its argument parser. Disable default features when only the Rust API is needed.

§Rust example

use glyphore::{FontFace, generate_range};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let bytes = std::fs::read("NotoSans-Regular.ttf")?;
    let face = FontFace::parse(&bytes)?;
    let pbf = generate_range(&face, 0)?;
    std::fs::write("0-255.pbf", pbf)?;
    Ok(())
}

Structs§

FontFace
A parsed font prepared for glyph generation.

Enums§

Error
An error produced while parsing a font or generating a glyph range.

Functions§

generate_range
Generates one MapLibre glyph PBF for start..=start + 255.