Last active
May 3, 2016 02:42
-
-
Save unohee/779ca2292f801b965a8c5b56bc50149b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofMain.h" | |
class ofxMeshFont2D :public ofTrueTypeFont{ | |
public: | |
void loadFont(string file, int size){ | |
ofTrueTypeFont::load(file, size,true,true,true); | |
} | |
void createNewString(string input){ | |
letterPaths = getStringAsPoints(input); | |
bbox = getStringBoundingBox(input, 0, 0); | |
for(int i=0; i<letterPaths.size(); i++) | |
{ | |
ofMesh front = letterPaths[i].getTessellation(); | |
typeFaceMesh.push_back( front ); | |
} | |
} | |
void drawAsMesh(){ | |
ofPushMatrix(); | |
ofTranslate(position); | |
ofTranslate(0, bbox.height/2.0); | |
for(int i=0; i<typeFaceMesh.size(); i++) | |
{ | |
typeFaceMesh[i].draw(); | |
typeFaceMesh[i].clear(); | |
} | |
ofPopMatrix(); | |
} | |
vector<ofMesh>typeFaceMesh; | |
ofRectangle bbox; | |
ofVec3f position; | |
protected: | |
vector<ofTTFCharacter> letterPaths; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment