public int EmitTextVertices(string text, ref VertexC1P3T2[] vertices)
{
int len = text.Length * 4;
if (vertices == null || vertices.Length < len) vertices = new VertexC1P3T2[len];
float curOffset = 0.0f;
GlyphData glyphData;
Rect uvRect;
float glyphXOff;
float glyphXAdv;
for (int i = 0; i < text.Length; i++)
{
this.ProcessTextAdv(text, i, out glyphData, out uvRect, out glyphXAdv, out glyphXOff);
Vector2 glyphPos;
glyphPos.X = MathF.Round(curOffset + glyphXOff);
glyphPos.Y = MathF.Round(0.0f);
vertices[i * 4 + 0].Pos.X = glyphPos.X;
vertices[i * 4 + 0].Pos.Y = glyphPos.Y;
vertices[i * 4 + 0].Pos.Z = 0.0f;
vertices[i * 4 + 0].TexCoord = uvRect.TopLeft;
vertices[i * 4 + 0].Color = ColorRgba.White;
vertices[i * 4 + 1].Pos.X = glyphPos.X + glyphData.width;
vertices[i * 4 + 1].Pos.Y = glyphPos.Y;
vertices[i * 4 + 1].Pos.Z = 0.0f;
vertices[i * 4 + 1].TexCoord = uvRect.TopRight;
vertices[i * 4 + 1].Color = ColorRgba.White;
vertices[i * 4 + 2].Pos.X = glyphPos.X + glyphData.width;
vertices[i * 4 + 2].Pos.Y = glyphPos.Y + glyphData.height;
vertices[i * 4 + 2].Pos.Z = 0.0f;
vertices[i * 4 + 2].TexCoord = uvRect.BottomRight;
vertices[i * 4 + 2].Color = ColorRgba.White;
vertices[i * 4 + 3].Pos.X = glyphPos.X;
vertices[i * 4 + 3].Pos.Y = glyphPos.Y + glyphData.height;
vertices[i * 4 + 3].Pos.Z = 0.0f;
vertices[i * 4 + 3].TexCoord = uvRect.BottomLeft;
vertices[i * 4 + 3].Color = ColorRgba.White;
curOffset += glyphXAdv;
}
return len;
}