Permalink
Browse files

drawStringAsShapes

  • Loading branch information...
companje committed May 22, 2012
1 parent e25dfee commit 6d38a0a68437c4d0e425a595c1c56ffb49a1dd48
Showing with 9 additions and 3 deletions.
  1. +7 −2 ofxArcText.cpp
  2. +2 −1 ofxArcText.h
View
@@ -10,7 +10,11 @@ float ofxArcText::getCharacterWidth(char ch) {
return cps[ch-NUM_CHARACTER_TO_START].setWidth;
}
-void ofxArcText::drawString(string text, float x, float y, float radius) {
+void ofxArcText::drawStringAsShapes(string text, float x, float y, float radius) {
+ drawString(text,x,y,radius,true);
+}
+
+void ofxArcText::drawString(string text, float x, float y, float radius, bool asShapes) {
ofPushMatrix();
ofTranslate(x,y);
@@ -47,7 +51,8 @@ void ofxArcText::drawString(string text, float x, float y, float radius) {
ofPushMatrix();
ofTranslate(0, radius);
ofRotateZ(-ofRadToDeg(angles[i])/2); //local rotation, use this or center letter before rotating
- ofTrueTypeFont::drawString(ofToString((char)text.at(i)),0,0);
+ if (asShapes) ofTrueTypeFont::drawStringAsShapes(ofToString((char)text.at(i)),0,0);
+ else ofTrueTypeFont::drawString(ofToString((char)text.at(i)),0,0);
ofPopMatrix();
ofRotateZ(-ofRadToDeg(angles[i]));
}
View
@@ -7,7 +7,8 @@ class ofxArcText : public ofTrueTypeFont {
ofxArcText();
- void drawString(string s, float x, float y, float radius);
+ void drawString(string s, float x, float y, float radius, bool asShapes=false);
+ void drawStringAsShapes(string s, float x, float y, float radius);
float getCharacterWidth(char ch);
enum { LEFT, CENTER, RIGHT } align;

0 comments on commit 6d38a0a

Please sign in to comment.