Article View: comp.windows.ms.programmer
Article #3320Problem with GetTextExtent()
From: Gary Pianosi
Date: Thu, 20 Jun 1991 18:29
Date: Thu, 20 Jun 1991 18:29
23 lines
1526 bytes
1526 bytes
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
Technical Details
Message-ID:
<1991Jun20.182946.24391@maytag.waterloo.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!csg.uwaterloo.ca!garypShow Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!csg.uwaterloo.ca!garyp From: garyp@csg.uwaterloo.ca (Gary Pianosi) Subject: Problem with GetTextExtent() Message-ID: <1991Jun20.182946.24391@maytag.waterloo.edu> Originator: garyp@csg.uwaterloo.ca Sender: news@maytag.waterloo.edu (News Owner) Organization: University of Waterloo Date: Thu, 20 Jun 1991 18:29:46 GMT Lines: 23