Any way to support multiple languages for user's custom file name?

The user case is user can use their own sample, so the language for the file name might varies a lot, I already support Chinese and English by using a specific font, but is there any way to support as much language as I can? Thanks in advance!!!

Use TextLayout instead of Graphics text facilities to display the text in your widget
It support automatic fallback fonts.
https://docs.juce.com/master/classTextLayout.html

1 Like

Thanks for the info, is there any code demo for the case using multiple fonts? I’m still learning coding that help a lot :rofl:

static juce::TextLayout createTextLayout(const juce::String &text, juce::Justification justification, const juce::Colour &colour, const juce::Font &font, int width, int height)
  {
    juce::TextLayout textLayout;
    juce::AttributedString str(text);
    str.setJustification(justification);
    str.setColour(colour);
    str.setFont(font);
    textLayout.createLayout(str, width, height);
    return textLayout;
  }

  static void drawWithTextLayout(juce::Graphics &g, const juce::String &text, juce::Justification justification, const juce::Colour &colour, const juce::Font &font, int x, int y, int width, int height)
  {
    juce::TextLayout textLayout = createTextLayout(text, justification, colour, font, width, height);
    textLayout.draw(g, juce::Rectangle<int>(x, y, width, height).toFloat());
  }

Here is an example of what I use