How to write utf-8 string with DrawText

Hello,

May I ask
How to write utf-8 string with DrawText ?
I want to write a string such as u8"G#7" with graphics::DrawText
also, natural, flat, sharp etc
Thanks

The Projucer’s UTF-8 String Literal Converter Tool could be helpful.

If you just need the flat, sharp and natural symbols:

juce::String flat = juce::CharPointer_UTF8 ("\xe2\x99\xad");
juce::String sharp = juce::CharPointer_UTF8 ("\xe2\x99\xaf");
juce::String natural = juce::CharPointer_UTF8 ("\xe2\x99\xae");
1 Like

Dear aamf:
Oh, thank you so much for your help and kindness !
I just checked your solution works very all right with the font below

g.setFont(juce::Font(“Lucida Sans Unicode”, 32.0f, juce::Font::plain));

(Also, I checked it may not be visible if I use different font such as MusicalSymbols)

So, now I can handle my problem by myself

Thank you again and have a great week
See you, aamf

1 Like