#triangulation #graphics #mesh #ttf2mesh #ttf2mesh-rs

fontmesh

Pure Rust library for converting TrueType font glyphs to 2D/3D triangle meshes

5 releases

0.4.1 Mar 1, 2026
0.4.0 Feb 26, 2026
0.3.4 Jan 6, 2026
0.3.3 Dec 29, 2025
0.1.0 Oct 24, 2025

#1597 in Game dev

Download history 18/week @ 2025-12-09 4/week @ 2026-01-13 6/week @ 2026-01-20 10/week @ 2026-01-27 26/week @ 2026-02-03 125/week @ 2026-02-10 118/week @ 2026-02-17 106/week @ 2026-02-24 87/week @ 2026-03-03 473/week @ 2026-03-10

803 downloads per month
Used in bevy_fontmesh

MIT/Apache

1MB
964 lines

fontmesh

CI Crates.io Documentation License: MIT or Apache-2.0

Library for converting TrueType font glyphs to 2D and 3D triangle meshes. A faster, pure Rust alternative to ttf2mesh.

3D Text

2D Mesh 3D Mesh

Quick Start

use fontmesh::{Face, char_to_mesh_2d, char_to_mesh_3d};

let font_data = include_bytes!("font.ttf");
let face = Face::parse(font_data, 0)?;

// 2D mesh with 20 subdivisions per curve
let mesh_2d = char_to_mesh_2d(&face, 'A', 20)?;

// 3D mesh with depth 5.0 and 50 subdivisions
let mesh_3d = char_to_mesh_3d(&face, 'A', 5.0, 50)?;

Caching

use std::collections::HashMap;
use std::sync::Arc;

// Cache just the font data
let mut cache: HashMap<String, Arc<Vec<u8>>> = HashMap::new();
cache.insert("myfont".into(), Arc::new(font_data.to_vec()));

// Parse Face when needed (cheap!)
let data = cache.get("myfont").unwrap();
let face = Face::parse(data, 0)?;
let mesh = char_to_mesh_3d(&face, 'A', 5.0, 20)?;

Examples

cargo run --example basic
cargo run --example serde --features serde

Performance

fontmesh is 2-3x faster than comparable libraries.

Benchmark Comparison

Run benchmarks: cargo bench

License

Licensed under either of MIT or Apache-2.0 at your option.

Dependencies

~9.5MB
~275K SLoC