private float evaluateTextHeight(string text, Font font, float width, int flags, float scaleY, float scaleX)
{
Bitmap bmp = new Bitmap(1, 1);
Graphics graph = Graphics.FromImage(bmp);
SizeF stringSize = graph.MeasureString(text, font, Convert.ToInt32(width * scaleX));
graph.Dispose();
bmp.Dispose();
return stringSize.Height * scaleY;
}