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 ?


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:

1 Like

Same here. Would be great if we can make this work also with the text editor.

Any Ideas? :slight_smile:

Yes font fallback! +1000
I’ve asked for that for more than 10 years already, so i wouldn’t keep my hopes up if i were you.
You might want to consider using the Noto Sans font from Google. It looks decent, is free to use and embed, and has a broad set of supported characters right out of the box. Our UI has translation files for different languages, when a different language is chosen we pick a different flavour of the Noto font, so at least we can cover localisation that way. Sadly there isn’t one Font to rule them all, so a fallback would be still be very welcome.

1 Like

I chatted to the team and @oli1 has been working on unicode support, obviously this is quite a big update and will take some time to make it out but as I understand it font fallback will work everywhere. I realise it’s been a long wait already but hopefully that offers a glimmer of hope for the future.


will this be in juce 7 or juce 8?

juce 8.