Skip to main content

Module font

Module font 

Source
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§

ChemGlyph
One chem-label glyph with script role and face (markup bold/italic).
FaceMetrics
Typographic constants in em units (font +Y up).
GlyphMetrics
One character metrics in em units (font +Y up).

Enums§

FaceStyle
Liberation Sans face variant.
ScriptRole
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).