I first want to say that ofxTrueTypeFontUC is an amazing addon to get unicode characters rendering on screen in OpenFrameworks. I am having some difficulty getting it to do exactly what I want though. Specifically, I can’t figure out how to use more than one font at a time because it seems like ofxTrueTypeFontUC renders text using the chronologically-last font that was loaded into any ofxTrueTypeFontUC object and even then weirdness abounds. I only get the letter ‘p’ to render from the first chronological font that is loaded.
IE. Suppose that ‘italic.ttf’ and ‘bold.ttf’ are font files.
The only partial-solution I was able to find was using ofxTrueTypeFontUC.reload() prior to drawing a given string. Although this prints with the correct font it dramatically slows rendering with even a little text with different fonts and and eventually crashes after a few minutes.
Have you found a solution? I’m faced with the same problem.
I’m trying to load a same font but at different sizes, so my solution is to use ofScale() everytime I draw texts at another size, but it has an awkward effect especially with serif font.
@kokinomura, presumably you’re using the latest version of the add-on? feel free to send the add-on over for me to test out (though i have an identical setup).
Thank you @mantissa, it’s the latest version. If I use ofTrueTypeFont, it works. But I want to draw Japanese strings, so I need ofxTrueTypeFontUC.<a class=“attachment”
And this is the source files of ofxTrueTypeFontUC I’m using.
@koki it looks like i was the one running an older version of ofxTrueTypeFontUC. indeed, when i run this attached version (which looks like it was updated about a month ago) i get the behavior you described.
i wasn’t able to get the add-on to compile with the changes you recommended – but i can share with you the earlier version that i was using. src.zip (10.3 KB)
i recommend reaching out to the developer and describing the problem.