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

**URL:** <https://forum.juce.com/t/any-way-to-support-multiple-languages-for-users-custom-file-name/53196>\
**Category:** General JUCE discussion\
**Created:** [September 30, 2022, 8:14am UTC](https://forum.juce.com/t/any-way-to-support-multiple-languages-for-users-custom-file-name/53196 "2022-09-30T08:14:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [September 30, 2022, 8:14am UTC](https://forum.juce.com/t/any-way-to-support-multiple-languages-for-users-custom-file-name/53196/1 "2022-09-30T08:14:17Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [September 30, 2022, 8:42am UTC](https://forum.juce.com/t/any-way-to-support-multiple-languages-for-users-custom-file-name/53196/2 "2022-09-30T08:42:27Z")

</div>

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](https://docs.juce.com/master/classTextLayout.html)

---

<div class="post-metadata">

**Author:** ![playpm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/playpm/32/14429_2.png) [@playpm](https://forum.juce.com/u/playpm)\
**Post date:** [September 30, 2022, 8:53am UTC](https://forum.juce.com/t/any-way-to-support-multiple-languages-for-users-custom-file-name/53196/3 "2022-09-30T08:53:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [September 30, 2022, 11:55am UTC](https://forum.juce.com/t/any-way-to-support-multiple-languages-for-users-custom-file-name/53196/5 "2022-09-30T11:55:54Z")

</div>

```auto
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
