Help : how can get font fall-back work on TextEditor Component!



I want input some chinese, if the font which TextEditor use does not support chinese, It just give me some boxes!

but I also notice that if I override the TextEditor’s paint method like this :

juce::Rectangle<int> textArea(getBounds());
juce::AttributedString str(getText());
str.draw(g, textArea.toFloat());

And then the chinese char can shown correctly. So AttributedString has the capability of font fallback.

So, my question is what is the best way to show chinese in textbox with font-fallback, (do not want to set font which contain chinese char, just want to use font fallback the system provide ), bcz override the TextEditor’s paint is not a proper way to do it!


It looks like

void Direct2DLowLevelGraphicsContext::drawGlyph (int glyphNumber, const AffineTransform& transform)

this function do not have the ability of font fallback.

bool Direct2DLowLevelGraphicsContext::drawTextLayout (const AttributedString& text, const Rectangle& area)

this function does have the ability of font fall back.

am I right or completely wrong?
Anyone can help me rewrite drawGlyph which using drawTextLayout ?