Is it possible to make ofDrawBitmapString Utf8 aware.?
I am looking at ofBitmapFont.cpp to figure out how exactly ofDrawBitmapString works…
I am curious if it is possible to make it utf8 aware…
float posTexW = (float)(character % 16)/16.0f;
float posTexH = ((int)(character / 16.0f))/16.0f;
float texY1 = posTexH;
float texY2 = posTexH+heightTex;
//TODO: look into a better fix.
//old ofDrawBitmapString was 3 pixels higher, so this version renders text in a different position.
//3 pixel adjustment corrects that when y is flpped 5 when it's not.
int yOffset = 14;
if(!vFlipped){
y += 5;
y += yOffset;
yOffset *= -1;
}else{
y -= 3;
}
int vC = vertexCount;
charMesh.getTexCoords()[vC].set(posTexW,texY1);
charMesh.getTexCoords()[vC+1].set(posTexW + widthTex,texY1);
charMesh.getTexCoords()[vC+2].set(posTexW+widthTex,texY2);
charMesh.getTexCoords()[vC+3].set(posTexW + widthTex,texY2);
charMesh.getTexCoords()[vC+4].set(posTexW,texY2);
charMesh.getTexCoords()[vC+5].set(posTexW,texY1);
charMesh.getVertices()[vC].set(x,y);
charMesh.getVertices()[vC+1].set(x+8,y);
charMesh.getVertices()[vC+2].set(x+8,y+yOffset);
charMesh.getVertices()[vC+3].set(x+8,y+yOffset);
charMesh.getVertices()[vC+4].set(x,y+yOffset);
charMesh.getVertices()[vC+5].set(x,y);
vertexCount += 6;
}