Expand description
Bundled Liberation Sans outlines (ttf-parser).
Replaces Python fontTools for advances, ink bounds, and glyph contours.
Contours are sampled (8 steps per curve) to match the old ContourPen, then
assembled with even-odd fill into crate::geom::Shape.
Chem scripts (H-counts, charges) are fake sub/superscripts: scale by
crate::metrics::SCRIPT_SCALE, buffer the outline to restore stem weight,
and cache the result. Dummy * uses a custom star at STAR_FRAC.
Structs§
- Chem
Glyph - One chem-label glyph with script role and face (markup bold/italic).
- Face
Metrics - Typographic constants in em units (font +Y up).
- Glyph
Metrics - One character metrics in em units (font +Y up).
Enums§
- Face
Style - Liberation Sans face variant.
- Script
Role - Sub / super / normal draw role for chem label glyphs.
Functions§
- compile_
chem_ shapes - Place a chem glyph run in SVG space (+Y down) with baseline at
y. - compile_
text_ shapes - Compile plain text to SVG-space glyph geometry (+Y down).
- face_
metrics - Face metrics for a Liberation Sans style.
- glyph_
metrics - Metrics for a single Unicode scalar.
- outline_
chem_ run_ em - Outline a chem glyph run in em space (+Y up). Returns
(shape, advance_em). - outline_
glyph_ em - Outline one character in em space (+Y up), optionally as a fake script.
- outline_
run_ em - Outline plain Unicode in font space (+Y up); return (shape, advance_em).
- outline_
star_ em - Custom five-point star in em units (centered on advance, mid cap-height).