Skip to content

Documentation problem in ofTrueTypeFont #833

@kresdjan

Description

@kresdjan

Maybe it would make more sense to change bool filled = true; // or false for contours to bool filled = false so that the example code works and the polylines points are drawn to the screen?

void testApp::draw(){

    // get the string as paths
    bool vflip = true; // OF flips y coordinate in the default perspective, 
                       // should be false if using a camera for example
    bool filled = false; // or false for contours
   vector < ofPath > paths = font.getStringAsPoints("hello!", vflip, filled);

    ofPushMatrix();
    ofTranslate(ofGetWidth()/2, ofGetHeight()/2);

    for (int i = 0; i < paths.size(); i++){

        // for every character break it out to polylines

        vector <ofPolyline> polylines = paths[i].getOutline();

        // for every polyline, draw every fifth point

        for (int j = 0; j < polylines.size(); j++){
            for (int k = 0; k < polylines[j].size(); k+=5){         // draw every "fifth" point
                ofDrawCircle( polylines[j][k], 3);
            }
        }
    }

    ofPopMatrix();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions