armadillu / ofxFontStash

Easy (and fast) unicode string rendering addon for OpenFrameworks. FontStash is made by Andreas Krinke and Mikko Mononen
http://uri.cat/
92 stars 42 forks source link

how can we change the font file on the fly? #29

Closed moebiussurfing closed 5 years ago

moebiussurfing commented 5 years ago

I see that setup can be only be called once. There's the addFont method but I don't know how to select after added. There's some way to clear the font and load another one?

armadillu commented 5 years ago

drawMultiColumnFormatted() allows mixing fonts, sizes and colors. Look at the example, and here you specify fonts with @1, @2, etc where the number is dictated by the order in which you setup() and addFont()- It's note quite finished.

Otherwise I recommend you keep around different ofxFontStash objects, each setup with the font you need, or just destroy your current fontstash and setup again

ofxFontStash font;
font.setup("myFont.ttf");
font.draw()
....
font = ofxFontStash();
font.setup("myFont2.ttf");
font.draw()