Expand description
Core MapLibre glyph PBF (SDF) generation for glyphore.
Pure logic only: no filesystem access, no clocks, no randomness, no wasm-bindgen. Output follows node-fontnik conventions (24px, 3px buffer, radius 8, cutoff 0.25).
Parse font bytes once with FontFace::parse, inspect the sorted range
starts with FontFace::covered_ranges, and pass each start to
generate_range.
§Example
use glyphore_core::{FontFace, generate_range};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let bytes = std::fs::read("NotoSans-Regular.ttf")?;
let face = FontFace::parse(&bytes)?;
for start in face.covered_ranges() {
let pbf = generate_range(&face, start)?;
std::fs::write(format!("{start}-{}.pbf", start + 255), pbf)?;
}
Ok(())
}Structs§
- Font
Face - 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.