3 ms·
No, because it's not actually possible without extra information. The codepoints in Unicode are the same if the languages use the same character (Han unificatio
by apaprocki 4y ago
No, because it's not actually possible without extra information. The codepoints in Unicode are the same if the languages use the same character (Han unification). With no extra information, if a string is only comprised of unified codepoints, it isn't inherently any one language, so you'd have to resort to a dumb external setting that lets users pick one font in that situation. Next best, you'd have to scan the entire string and find at least one non-unified codepoint and then use that to guess what language it is and then map the correct font for that language. Or, if you have external data such as an encoding string, file metadata, text source, you can simply obey what the metadata says.
Unification was done originally because early versions of Unicode were bit-constrained and there simply was not enough space to have separate codepoints for each language. This would need to be "undone" in some future version of Unicode and text encoders would need to make the backward incompatible change (in terms of rendering in unknown downstream software) of using new codepoints if this were to be done. Then the "proper" font would be deterministic.