I have a C # application that does text rendering, something similar to a simple wysiwyg text editor.
I use TextRenderer.DrawText to display the text on the screen and GetTextExtentPoint32 to measure the text so that I can put different font styles / sizes on the same line.
Everything works fine in Vista. In Arial, however, Arial is different in different ways, some characters, such as "o" and "b", take up more space than in Vista. GetTextExtentPoint32 seems to measure the string, as in Vista, but with a smaller width. The end result is that from time to time a run of text overlaps the text that precedes it, because the previous text is measured as less than what it actually is on the screen.
Also, my text rendering code looks like the text is accurate (for easy formatting and only in English) and i.e. visualization of the text seems to be consistent between vista and xp - as I noticed the resizing of different characters.
Anyone have any ideas on what is going on?
In short, TextRenderer.DrawText and GetTextExtentPoint32 do not match xp for Arial. It seems that DrawText has drawn certain characters more and / or less than in Vista, but GetTextExtentPoint32 seems to measure the text in the same way as in Vista (which seems to correspond to the rendering of the text, i.e. on both xp and vista objects). Hope this makes sense.
Note. Unfortunately, TextRenderer.MeasureString is not fast or accurate to fit my requirements. I tried to use it and had to rip it out.
c # text windows-xp windows-vista
Michael
source share