oxideav-ttf
Pure-Rust TrueType font parser for the oxideav framework. Implements the sfnt container, the core OpenType tables, and just enough of GSUB / GPOS to do Latin/Cyrillic/Greek/CJK shaping with ligatures and kerning.
Round-1 scope (this release)
- sfnt + table directory walker.
head,hhea,maxp,cmap(formats 0, 4, 6, 12),name,OS/2,hmtx,loca,glyf(simple + composite),post.- Legacy
kerntable (format 0). GSUBLookupType 4 (ligature substitution).GPOSLookupType 2 (pair-adjustment / kerning).GDEF(glyph class definitions, used to skip mark glyphs).
The companion oxideav-scribe
crate consumes the outlines + shaping output to rasterise text to RGBA
bitmaps for subtitles and the scene compositor.
Public API
use Font;
let bytes = read?;
let font = from_bytes?;
// Metadata.
let _ = font.family_name; // Some("DejaVu Sans Mono")
let _ = font.units_per_em; // 2048
let _ = font.glyph_count;
let _ = font.ascent;
let _ = font.descent;
let _ = font.line_gap;
// Glyph lookup.
let gid_a = font.glyph_index.unwrap;
let _ = font.glyph_advance; // i16 advance width in font units
let _ = font.glyph_lsb;
let _ = font.glyph_bounding_box;
let _ = font.glyph_outline?; // contours of i16 points
// Shaping helpers.
let gid_f = font.glyph_index.unwrap;
let gid_i = font.glyph_index.unwrap;
if let Some = font.lookup_ligature
let gid_v = font.glyph_index.unwrap;
let _ = font.lookup_kerning; // negative i16 in font units
Out of scope (round 2+)
- CFF / Type 2 charstrings — moves to a sibling
oxideav-otfcrate. - Bidi, Arabic shaping, Indic conjuncts, complex contextual GSUB/GPOS.
- Variable fonts (
fvar/gvar/MVAR). - TrueType bytecode hinting (modern AA at ≥ 16 px does not need it).
- cmap formats 2, 8, 10, 13, 14.
- GSUB lookup types 1/2/3/5/6/7/8 and GPOS lookup types 1/3..9.
Test fixture
tests/fixtures/DejaVuSansMono.ttf is the upstream DejaVu Sans Mono 2.37
under the Bitstream Vera license (see tests/fixtures/DEJAVU-LICENSE).
License
MIT — see LICENSE.