An extension of ofTrueTypeFont class for using UNICODE characters. Tested on OSX, iOS, and Windows.
An extension of ofTrueTypeFont class for using UNICODE characters. Tested on OSX, iOS, and Windows.
No additional library is required.
ofxTrueTypeFontUC
ofxTrueTypeFontUC
folder in the addons
folder in your openFrameworks root folderAdd ofxTrueTypeFontUC.h
and ofxTrueTypeFontUC.cpp
to your project
(Refer to IDE setup guide http://openframeworks.cc/setup/ for detail)
Put font file (ex. yourFont.ttf
) in yourProjectFolder/bin/data
folder
Include ofxTrueTypeFontUC.h
// ofApp.h
#include "ofxTrueTypeFontUC.h"
Declare an instance
// ofApp.h
class ofApp : public ofBaseApp{
...
ofxTrueTypeFontUC myFont;
};
Load a font
// ofApp.cpp
void ofApp::setup(){
...
myFont.loadFont("yourFont.ttf", 64, true, true);
}
Draw string
// ofApp.cpp
void ofApp::draw(){
...
myFont.drawStringAsShapes("こんにちは", 100, 100);
myFont.drawString("はじめまして", 100, 200);
}
Refer ofxTrueTypeFontUC.h
with regard to other functions.
ofxTrueTypeFontUC is distributed under the MIT License.
This gives everyone the freedoms to use ofxTrueTypeFontUC in any context: commercial or non-commercial, public or private, open or closed source.
Please see License.txt for details.