[comp.windows.ms.programmer] Problem with GetTextExtent

garyp@csg.uwaterloo.ca (Gary Pianosi) (06/21/91)

I am having a problem with the GetTextExtent() function where the
width it returns is one greater than the actual pixel width drawn by
the TextOut() function.  It appears to happen with most fonts
(though not all) when the 'bold' attribute is specified.

You can reproduce this behaviour in the SHOWFONT sample program that
comes with the SDK.  If you specify that the text is to be drawn
with an opaque, red background then click the mouse to draw the
text, a single character-height column of pixels after the word 
"bold" is not overwritten (it appears white, not red).  This is because 
SHOWFONT added the width returned from GetTextExtent("bold") to the 
current X position to compute the position of the following text.  
This text was then drawn one pixel farther to the right than the 
last pixel written by TextOut("bold").

Has anyone else experienced this strange behaviour?  Thanks in advance 
for any advice.

- Gary Pianosi.
-- 
E-mail:  garyp@csg.UWaterloo.CA                     Phone: (519) 888-4678
Computer Systems Group, University of Waterloo, Waterloo, Ontario, Canada