Skip to main content

Module font

Module font 

Source
Expand description

v1.0 Phase C1 — bundled default fonts.

smix-annotate ships two fonts embedded via include_bytes! so text annotations work out of the box without any consumer-supplied font path:

  • Inter Regular (~312 KB) — SIL Open Font License, from rsms/inter. Covers Latin + extended punctuation + Greek + Cyrillic.
  • Noto Sans SC subset (~64 KB) — SIL Open Font License, from googlefonts/noto-cjk. Pre-subsetted to ~250 most-frequent CJK ideographs + ASCII + CJK punctuation. Covers typical QA/UI Chinese text in yaml annotations.

§Routing

pick_font_for_codepoint(cp) returns the appropriate font bytes based on the Unicode range of cp:

  • ASCII + Latin extended → Inter
  • CJK Unified Ideographs + CJK punctuation → Noto Sans SC subset
  • Everything else → Inter (fallback)

For per-glyph routing, Annotator::render iterates chars and picks the font per-codepoint, ensuring mixed-script text renders correctly.

§Overriding

Callers can supply their own font via Annotator::font(bytes) — that overrides both bundled fonts for the entire annotator’s render pass. Use for corpus-specific glyph coverage.

Constants§

INTER_REGULAR
Inter Regular — Latin/Greek/Cyrillic + extended punctuation. SIL Open Font License. From https://github.com/rsms/inter.
NOTO_SANS_SC_SUBSET
Noto Sans SC subset — top ~250 CJK ideographs + ASCII + CJK punctuation. SIL Open Font License. Subsetted from https://github.com/googlefonts/noto-cjk.

Functions§

pick_font_for_codepoint
v1.0 Phase C1 — pick the bundled font best suited to render cp.