I’m trying to show some texts written in Croatian language in my OF application.
The text includes characters like this one “više muška šest žena”, which show as question marks in my application.
I already saw this post but wasn’t successfull as there was not much guidance and i’m pretty new to OF.
Can anyone guide me in the right direction?
Thanks a lot
if you are loading a font using ofTrueTypeFont you have the following options when loading.
bool loadFont(string filename,
As you can see the default for bFullCharacterSet is false. By turning it to true it will work.
That would be something like
myFont.load("myFontFace.ttf", true, true);
Thanks a lot @roymacdonald.
I’ve already tried this, but doesn’t change anything. It works for German but not for the Croatian.
ofTrueTypeFont will only deal with ASCII characters, if your string need UTF-8 encoding it will probably won’t work.
That is to say, if the characters you want to draw are out of the 0-255 possible ones in the ASCII specs, you’re out of luck and will need to use a different font engine.
You may have some luck with this : https://github.com/armadillu/ofxFontStash (or otherwise do a google search with unicode/utf8 and ofx keywords…)
as @silverbahamut says you might need a different font engine. Checkout ofxaddons.com for font engines. There are several. I think that ofxFont will make the job.
Thanks for your help @roymacdonald @silverbahamut.
I tried it with ofxFontStash and was successfull on windows, but I can’t get it to compile on Ubuntu.
Since this is a different issue, I created another topic for it.
I used in the past ofxTrueTypeFontUC successfully, maybe it would help you.
I used ofxTrueTypeFontUC and it works.
The only thing is that the text looks jigged, like it is a low quality text. Even when I try it with AntiAliasing set to true, it’s also like tha. Do you have any idea what might cause this?
Now you are saying this, I might have had the same problem. But in my case it was fine and was not looking too bad compared to the rest so don’t think I did anything to fix it.
I have also another issue, which is that some of the croatian characters are not shown correctly even with the ofxTrueTypeFontUC addon.
So characters like “ž” are shown correctly, but with characters like “č” or “ć” I get an empty square in place of the character.
EDIT: I solved the second problem by changing my font. Apparently the first font I used didn’t support all the characters. I’m still working on the low quality issue!