Skip to content

Instantly share code, notes, and snippets.

@bakercp
Created October 25, 2013 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakercp/7157643 to your computer and use it in GitHub Desktop.
Save bakercp/7157643 to your computer and use it in GitHub Desktop.
// in your .h file
ofTrueTypeFont font;
/// in your cpp file
// we load our font with contours (see the docs for more info on the args)
font.loadFont("verdana.ttf", 50, true, true, true);
vector<ofPath> paths = font.getStringAsPoints("hello");
for(int i = 0; i < paths.size(); i++)
{
ofPath path = paths[i];
vector<ofPolyline> polylines = path.getOutline();
for(int j = 0; j < polylines.size(); j++)
{
ofPolyline polyline = polylines[i];
for(int k = 0; k < polyline.size(); k++)
{
ofVec2f point = polyline[k];
// your point paths live here!
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment