Back to API Reference
Class
LanguageRegistry
static
Process-wide registry mapping BCP 47 language tags to HarfBuzz language handles and compact byte indices suitable for per-codepoint attribute storage.
Remarks
HarfBuzz language handles (hb_language_t) are opaque pointers cached internally by HarfBuzz, so equal BCP 47 strings resolve to the same pointer. HarfBuzz maps BCP 47 to OpenType language tags (e.g. zh-Hans → ZHS, ja → JAN) automatically, which drives the locl GSUB feature in pan-CJK fonts. The registry is additive: once a tag is registered, its index stays stable for the lifetime of the process. Index 0 is reserved for "unset" and maps to HB_LANGUAGE_INVALID.
Registers a BCP 47 language tag and returns its compact byte index. Returns Unset when the registry is full or the tag is not well-formed — well-formed means subtags of 1–8 ASCII letters or digits separated by - or _, the first made of letters only.
public static IntPtr GetHandle(byte index)Returns the HarfBuzz language handle for a registry index, or Zero if unset.
