c# - Letters in distance field font rendering are too small -
i wrote distance field font rendering framework opengl es2.0 in c# (opentk). looks besides letters "l" , "i". small.
distance fields letters "i", "l" , "k"
maybe can me fix this.
this code creating triangles, send shaders:
var tx1 = (float)rectangle.x / texture.width; var ty1 = (float)rectangle.y / texture.height; var tx2 = (float)(rectangle.x + rectangle.width) / texture.width; var ty2 = (float)(rectangle.y + rectangle.height) / texture.height; var vx = 0; var vy = 0; float vwidth = metrics.width; float vheight = metrics.height; var tv1 = new vector2(tx1, ty1); var tv2 = new vector2(tx1, ty2); var tv3 = new vector2(tx2, ty2); var tv4 = new vector2(tx2, ty1); var v1 = new vector3(vx, vy, 0); var v2 = new vector3(vx, vy - vheight, 0); var v3 = new vector3(vx + vwidth, vy - vheight, 0); var v4 = new vector3(vx + vwidth, vy, 0); triangle1.send(new fontvertex { position = v1, texturecoord = tv1 }); triangle1.send(new fontvertex { position = v2, texturecoord = tv2 }); triangle1.send(new fontvertex { position = v3, texturecoord = tv3 }); triangle2.send(new fontvertex { position = v1, texturecoord = tv1 }); triangle2.send(new fontvertex { position = v3, texturecoord = tv3 }); triangle2.send(new fontvertex { position = v4, texturecoord = tv4 });
Comments
Post a Comment