In native android apps such as Whatsapp, you can enter mixed language text in the text box (e.g. some Thai plus some Chinese plus some English, etc) and they will all display properly.
But in OpenFL, as I have to specify the font for a text field and most likely a single font won’t cover all languages, so some text won’t display properly. (e.g. If I use a Chinese font, then the Thai won’t get displayed)
So I am wondering how Android native textfield handles this situation. Do they have a universal font that cover all languages? or they are clever enough to separate the text into segments and apply the appropriate font by detecting the language of each segments?
I am also interested in knowing any solution for OpenFL textfields.
You can try fonts that have a broad range of glyph support, such as Arial Unicode or Lucida Sans Unicode, but these are not all-encompassing, Chinese alone would be quite extensive.
I’m not sure that multiple font support is in the TextField class right now (without using HTML5 -Ddom mode or the Flash target). I once wrote a robust font replacement mechanism for Flash 8, which had character codes stored for various fonts, and supported a list of fallback font families when a glyph was not found, not entirely unlike the CSS “font-family” styles, but per glyph.
I’m sure that Freetype (or other libraries) could tell us what glyphs are supported by a certain font, and this could be compared to know whether to fallback or not, though the layout gets complex. I’m hoping that Harfbuzz helps us out for getting unicode text layout down