Back to API Reference
Class
LanguageModifier
Applies a BCP 47 language tag to a text range for OpenType-aware shaping.
Remarks
The language tag is forwarded to HarfBuzz as hb_language_t, which drives the OpenType locl (Localized Forms) GSUB feature. This is essential for pan-CJK fonts such as Noto Sans CJK and Source Han Sans, where a single code point renders with different region-specific glyphs (Simplified Chinese, Traditional Chinese, Japanese, Korean) depending on the language tag. Common tags: zh-Hans, zh-Hant, zh-HK, ja, ko, en, ar, he. HarfBuzz converts BCP 47 to OpenType language tags automatically (zh-Hans → ZHS, ja → JAN, etc.). Apply to the entire text via RangeRule ("..") for a global default, or per-range via the rich-text tag <lang=zh-Hans>...</lang> for mixed-language content.
