Skip to main content

char_script

Function char_script 

Source
pub fn char_script(c: char) -> Script
Expand description

Classify one character into the four-way script bucket a font scheme is indexed by. Deviation from the originally-proposed standalone CharScript enum: this port already has context::Script (set-dominant-*-script) with the exact same four constructors in the exact same order (HanIdeographic=0, Kana=1, Latin=2, OtherScript=3) — introducing a second, structurally-identical enum just to keep “per-char classifier” and “context-stored dominant script” conceptually separate would add a conversion at every call site for no behavioral gain, so this reuses Script directly as the per-char classification result too.

Upstream classifies via Scripts.txt + East-Asian-width (scriptDataMap.ml:74-167, itself labelled “temporary” by its own comment); this range classifier has no unidata file to ship and matches upstream’s observable output for the stdja corpus, not the full Unicode script property. CJK punctuation/fullwidth forms classify as HanIdeographic (not OtherScript) so 「」。、 render in the CJK (mincho) face, matching upstream’s Kana/Han default-font assignment.