# drawText/drawFittedText that supports fallback font

**URL:** <https://forum.juce.com/t/drawtext-drawfittedtext-that-supports-fallback-font/13978>\
**Category:** General JUCE discussion\
**Created:** [December 5, 2014, 9:51am UTC](https://forum.juce.com/t/drawtext-drawfittedtext-that-supports-fallback-font/13978 "2014-12-05T09:51:50Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [December 5, 2014, 9:51am UTC](https://forum.juce.com/t/drawtext-drawfittedtext-that-supports-fallback-font/13978/1 "2014-12-05T09:51:50Z")

</div>

Hi Jules,

&nbsp;

Would it be possible to add an equivalent of&nbsp;drawFittedText or drawText with the same parameters which uses internally

TextLayout which would basically do this ?

juce::TextLayout textLayout;  
juce::AttributedString str(text);  
str.setJustification(justificationFlags);  
str.setColour(colour);  
str.setFont(context.getFont());  
textLayout.createLayout(str, width);  
textLayout.draw(g, juce::Rectangle\<int\>(x, y, width, height).toFloat());  
&nbsp;

It helps supporting non latin text display.

If you want a faster version, you can cache the TextLayout in your code but it's not always mandatory so it a useful addition to simplify some code.

&nbsp;

Thanks,

&nbsp;

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [December 12, 2014, 1:22pm UTC](https://forum.juce.com/t/drawtext-drawfittedtext-that-supports-fallback-font/13978/2 "2014-12-12T13:22:59Z")

</div>

I can't really see a good argument&nbsp;for adding something like&nbsp;that to the Graphics class.. It'd work equally well as a free function that you can write yourself, and which you can tailor to do exactly as much as you need.

---

<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:** [December 12, 2014, 3:31pm UTC](https://forum.juce.com/t/drawtext-drawfittedtext-that-supports-fallback-font/13978/3 "2014-12-12T15:31:32Z")

</div>

ok, no pb.

As long as you add the height argument in&nbsp;createLayout, I'm fine :)

&nbsp;

Thanks !
