UTF-8 Symbol problem!


#1

Hi guys,

I have this problem with unicode utf-8 symbols. When I run the application in my computer the symbols appear normal without a problem, but when I run the application in another computer the symbols appear like square instead of their own shape.

Why does this happen ? 

Is there a way to solve this ?

Thank's.


#2

Perhaps you are using a font that is not available on the other machine?

More info would be great. What symbols? Where's the code?


#3

I have written a lookandfeel class for the typeface name and the font size of the button :

class MyLookAndFeel : public LookAndFeel_V3
    {
        Font getTextButtonFont(TextButton&, int buttonHeight) override
        {
            return Font("Segoe UI Symbol", 16.0f, Font::plain);
        }
    };

Segoe UI Symbol has these utf-8 geometrical shapes that I need for my application, like play symbol : " http://www.kreativekorp.com/charset/unicode.php?char=E102 ".

So, I use the String Literal Helper in Juce to get the code for the symbol and then paste it like this in the button text field :

playButton.setButtonText(CharPointer_UTF8("\xee\x84\x82"));

It works fine on my computer. Maybe you are right that the font isn't available on the other computer.


#4

These are private use characters, so you're almost definitely limited to Windows versions which come with that particular font.

If you only need a few simple geometrical shapes (play, pause, record, etc) then maybe it is better to construct a custom typeface with these shapes. Or just draw them directly with the Graphics.

By the way, these symbols have been added to Unicode in the misc technical block, eg:

“⏵” = U+23F5 — BLACK MEDIUM RIGHT-POINTING TRIANGLE

But AFAIK JUCE doesn't use fallback fonts for rendering fancy characters, so the subset of Unicode you can reliably use is very limited.


#5

Drawing them with Graphics is a good option but I was trying to save some time for my project.

Thanks. ;)


#6

Doesn't Webdings have these symbols? I think that's included on most OSes these days.


#7

This was really helpful. Thank you. yes

Don't know why I didn't use this typeface before. crying