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.setColour(juce::Colours::white);
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!
platform:windows

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 ?

thanks!

Bump - we have this problem too.

Turn off “Direct write”?

won’t work either. Only TextLayout has the automatic font fallback system.

@ed95 is TextEditor supposed to support non-roman characters. Somewhat limiting if it doesn’t :slight_smile:

With some fighting (our fault) we got TextLayout to display non-roman fallback characters correctly for our filenames on Windows. We are still trying on the Mac :frowning:

Bump - still having this problem with the TextEditor…!

In other parts of the application, we were able to “enable” fallback fonts by replacing things like g.drawText(...) with AttributedStrings; (mostly those were our own custom components, so that was easy to do)

But what about TextEditor? Did anybody managed to make it work?
Is it something we can expect to be fixed at some point or shall we look at some ad-hoc fix for the time being?

Thank you! :slight_smile: