Hi I am using TextRenderer.MeasureText() method to measure the text width for a given font. I use Arial Unicode MS font for measuring the width, which is a Unicode font containing characters for all languages. The method returns different widths on different servers. Both machines have Windows 2003, and .net 3.5 SP1 installed.
Here is the code we used
using (Graphics g = Graphics.FromImage(new Bitmap(1, 1)))
{
width = TextRenderer.MeasureText(g, word, textFont, new Size(5, 5), TextFormatFlags.NoPadding).Width;
}
Any idea why this happens?
I use C# 2.0
MeasureText is not known to be accurate.
Heres a better way :
We had a similar problem several years back. In our case, for some reason we had different versions of the same font installed on two different machines. The OS version was the same, but the font was different.
Since you normally don't deploy a system font with your application setup, measuring and output results may vary from one machine to another, based on the font version.
Since you say ...
...this is something I'd check for.