Rotate ofPath letters

Hi anyone;
I’m have an array of ofPath letters created with getCharacterAsPoints. I created a grid where each letter is in a space of the grid and I want to rotate vertically each letter over its axis depending of the mouseX position but I can’t get it. I have tried using the ofPolylines an the ofPath. I achieved rotate the letter over Y but it is displacing to left .

¿Someone can help me to find the error?

My code is

void ofApp::setup(){
ofBackground(0);
ofSetFrameRate(60);

width = ofGetWidth();
height = ofGetHeight();
centerX = width/2;
centerY = height/2;
lastMousePosX = mouseX;

percentage = 0.02f;

strText = “T T T T T T T T T T T T T T”;

fontSize = 50;
fontFilled.load(“Batang.ttf”, fontSize-10, true, true, true);
fontOutline.load(“cooperBlack.ttf”, 52, true, true, true);

//Crea grid en el que aparecerán las letras
totalRecsX = width/fontSize;
totalRecsY = height/fontSize;

for(int y=0;y < totalRecsY;y++){
for(int x=0; x < totalRecsX; x++){
int posX = width / totalRecsX * x;
int posY = height / totalRecsY * y;
ofVec2f p(posX,posY);
arrGridCoords.push_back§;
}
}

//crea un arreglo con los caracteres de la cadena strText
std::vector arrChars(strText.begin(), strText.end());

cout << "arrChars.size(): " << arrChars.size() << endl;

cout << "arrChars[0]: " << arrChars[0] << endl;

for (const char &c: arrChars)
	std::cout << c;

//uint32_t letter = ‘$’;
char letter = ‘e’;

bool vflip = true; //Indica si debe de moverse el eje vertical de la forma
bool filled = true; //Indica si debe de rellenar la letra o sólo va delineada
pathCharFilled = fontFilled.getCharacterAsPoints(arrChars[0], vflip, filled);

filled = false;
pathCharOutline = fontFilled.getCharacterAsPoints(arrChars[0], vflip, filled);

for(int i=0; i < arrChars.size(); i++){
ofPath tmpPath;
tmpPath = fontFilled.getCharacterAsPoints(arrChars[i], vflip, filled);
tmpPath.setMode(ofPath::POLYLINES);
arrPaths.push_back(tmpPath);
}

cout << "arrPaths: " << arrPaths.size() << endl;

}

void ofApp::draw(){
/*
for(int i=0; i < arrImages.size(); i++){
float imgWidth = arrImages[i].getWidth()*percentage;
float imgHeight = arrImages[i].getHeight()percentage;
arrImages[i].draw(i
30,0,imgWidth,imgHeight);
}
*/
ofSetColor(255);
pathCharFilled.draw(200,300);
ofSetColor(255,0,0);
ofDrawCircle(200,300,5,5);

ofSetColor(255);
pathCharOutline.draw(400,300);
ofSetColor(255,0,0);
ofDrawCircle(400,300,3,3);

//cout << "pathCharOutline.getOutline().size(): " << pathCharOutline.getOutline().size() << endl;

float lastPosX = 0.f;
float step = 1.f;

for(int count = 0; count < arrPaths.size(); count++){

  if(count < arrGridCoords.size()){

    ofPushMatrix();
    //ofTranslate(lastPosX, ofGetHeight()/2, 0);

    //Dibuja el cuadro del grid
    ofNoFill();
    ofSetColor(255,255,255);
    ofDrawRectangle(arrGridCoords[count].x,arrGridCoords[count].y,fontSize,fontSize);

    //Dibuja un circulo en el centro del cuadro del grid
    ofFill();
    ofSetColor(255,0,0);
    ofDrawCircle(arrGridCoords[count].x+fontSize/2,arrGridCoords[count].y+fontSize/2,5);

    cout << "mouseX: " << mouseX << endl;
    float deg = ofMap(mouseX,0,width,0,360);
    cout << "deg: " << deg << endl;
  
  
    ofPolyline line;

    //La variable filled debe ser FALSE para que getOutline().size() devuelva > 0
    for(int k = 0; k <(int)arrPaths[count].getOutline().size(); k++){

      //cout << "arrPaths[count].getOutline().size(): " << arrPaths[count].getOutline().size() << endl;
      //cout << "arrPaths[count].getOutline()["<<k<<"].size(): " << arrPaths[count].getOutline()[k].size() << endl;
      //cout << "arrPaths[count].getOutline()["<<k<<"].getBoundingBox(): " << arrPaths[count].getOutline()[k].getBoundingBox() << endl;

      line.begin();
      
      if( k!= 0) { 
        ofNextContour(true); 
      }

      for(int i = 0; i < (int)arrPaths[count].getOutline()[k].size(); i++){
        line.addVertex(arrPaths[count].getOutline()[k].getVertices()[i].x, arrPaths[count].getOutline()[k].getVertices()[i].y+(fontSize),0);
        line.end();
        line.close();
      }
    }
      
    ofRectangle rec = line.getBoundingBox();
    //line.draw();


    //Dibuja la letra
    ofBeginShape();

      //calcula el centro de la casilla del grid y el centro de la letra
      float rectCenterX = arrGridCoords[count].x + fontSize/2 - rec.width/2;
      //Traslada el eje de coordenadas
      //ofTranslate(rectCenterX,arrGridCoords[count].y);

      //Dibuja un circulo en el punto 0,0 del cuadro del grid
      ofFill();
      ofSetColor(0,0,255);
      ofDrawCircle(0,0,5);        

      //La variable filled debe ser FALSE para que getOutline().size() devuelva > 0
      for(int k = 0; k <(int)arrPaths[count].getOutline().size(); k++){
        
        if( k!= 0) { 
          ofNextContour(true); 
        }

        for(int i = 0; i < (int)arrPaths[count].getOutline()[k].size(); i++){
          ofVertex(arrPaths[count].getOutline()[k].getVertices()[i].x, arrPaths[count].getOutline()[k].getVertices()[i].y+(fontSize));
        }

      }

      cout << "line.getCentroid2D().x: " << line.getCentroid2D().x << " - line.getCentroid2D().y: " << line.getCentroid2D().y << endl;
      ofNoFill();
      
      float clr = 0;
      clr = ofMap(deg,1,360,40,255);
      cout << "clr: " << clr << endl;
      
      ofSetColor(255,0,0);
      //ofSetRectMode(OF_RECTMODE_CENTER);
      //ofRotateDeg(deg,0,1,0);
      ofVec2f v1(0, 1);
      arrPaths[count].rotateDeg(1,v1);

      //cout << "line box.x: " << rec.x << endl;
      ofDrawRectangle(0,0,rec.width,rec.height);
      //lastPosX = lastPosX + rec.width + step;
      //cout << "lastPosX: " << lastPosX << " + " << rec.width << endl;

      //ofSetColor(0,255,255);
      ofDrawCircle(line.getCentroid2D().x,line.getCentroid2D().y,5);                  

    ofEndShape( true );        
    
    ofPopMatrix();

  }

}

cout << "ofGetCurrentViewport(): " << ofGetCurrentViewport() << endl;

/*
ofNoFill();
ofSetColor(255);
for(uint a = 0; a < arrGridCoords.size(); a++){
ofDrawRectangle(arrGridCoords[a].x,arrGridCoords[a].y,fontSize,fontSize);
}
*/

}