Skip to main content

Crate blinc_noto_symbols

Crate blinc_noto_symbols 

Source
Expand description

blinc_noto_symbols — drop-in text/symbol fallback for blinc_text.

§What it does

This crate bundles a single merged subset of Google’s Noto Sans Regular + Noto Sans Math Regular covering the non-emoji special characters that blinc_noto_emoji does not carry: math operators (, , ), full-width arrows (, , , ), currency symbols (, , ), and the Latin-1 Supplement punctuation block (°, ±, ×, ÷). pyftmerge combines the two source subsets into one fontTools-compatible face; scripts/rename-font-family.py rewrites its name table so fontdb registers it under the blinc-specific family name “Blinc Noto Symbols” (see FAMILY_NAME), preventing blinc_text’s generic sans-serif fallback chain from accidentally picking the subset as the primary text font.

The single public register function pushes the merged bytes into blinc_text::global_font_registry. From there, blinc_text::FontRegistry::load_symbol_font consults the “Blinc Noto Symbols” family at the top of its platform-agnostic fallback chain, so every missing-glyph lookup that the renderer routes through the symbol font finds a hit.

§How it gets called

The blinc_app web runner (crates/blinc_app/src/web.rs) calls register once, early in WebApp::new. Outside the web runner (tests, custom runners, native apps that want the same bundled font), register is a public function you can call at any point after the process starts. It is safe to call multiple times — fontdb de-duplicates identical face data internally.

§Why a single merged face

blinc_text::FontRegistry::load_symbol_font returns one font face to the renderer, which then consults that face for every non-primary glyph. Shipping two independent subsets in this crate would only let the renderer see one of them, so the crate pre-merges NotoSans and NotoSansMath at build time via pyftmerge. On cmap conflicts NotoSans wins (we list it first in the merge), contributing Latin-1 / currency; NotoSansMath fills in the math operators / double arrows NotoSans doesn’t own. The merged face inherits NotoSans’s metrics (line height, ascent/descent), which keeps shaping consistent for Latin-adjacent fallback use.

§Naming convention

Sibling of blinc_noto_emoji in the blinc_<font>_* add-on family. Each crate in the family:

  • Bundles a pre-subsetted font as a const &[u8].
  • Exposes a public register() function that pushes the bytes into blinc_text::global_font_registry() via FontRegistry::load_font_data.
  • Gets called from the platform runner(s) that want the font live, typically under a Cargo feature gate so apps that don’t need the fallback don’t pay the binary-size cost.

§What gets loaded

The bundled subset is generated from the codepoints the Blinc workspace examples actually reference (via tools/emoji-scan), with HTML-entity decoding so &nabla; / &#8377; literals in source contribute their decoded Unicode codepoints to the harvest. Only glyphs that the merged NotoSans + NotoSansMath cmap can provide end up in the output — the rest fall through to the emoji font bundled by blinc_noto_emoji. Current coverage sits at ~85 codepoints in a ~13 KB file.

If your app uses codepoints outside that set, rebuild the subset locally:

./scripts/regen-symbols-subset.sh /path/to/your/app/src

then publish a fork of this crate with the regenerated bundle.

Constants§

BLINC_NOTO_SYMBOLS_SUBSET
The bundled, merged Noto Sans + Noto Sans Math subset as a static byte slice.
FAMILY_NAME
The family name the merged subset reports in its name table. blinc_text::FontRegistry::load_symbol_font lists this name at the top of its platform-agnostic fallback chain, so any missing-glyph lookup that the renderer routes through the symbol font finds the bundled subset before walking the platform-specific entries.

Functions§

register
Install the bundled merged subset into blinc_text::global_font_registry.