public Vector2 MeasureText(string text)
{
Vector2 textSize = Vector2.Zero;
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);
textSize.X = Math.Max(textSize.X, curOffset + glyphXAdv - this.spacing);
textSize.Y = Math.Max(textSize.Y, glyphData.height);
curOffset += glyphXAdv;
}
textSize.X = MathF.Round(textSize.X);
textSize.Y = MathF.Round(textSize.Y);
return textSize;
}