SetTextCharacterExtra() Adds Extra Spacing for the Text that Is Displayed with DrawString() (305320)



The information in this article applies to:

  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional

This article was previously published under Q305320

SYMPTOMS

If a programmer or an Independent Software Vendor (ISV) tries to use the Microsoft C or Microsoft C++ SetTechCharacterExtra API to calculate or add spacing (to set the intersection between words), double the amount of intercharacter spacing may occur, and DrawText may set twice as many intercharacter spaces as usual on Windows XP.

Example

The original may appear like this:

ABCDEFG
					

In Microsoft Windows 95, Microsoft Windows 98, Microsoft Windows Millennium Edition (Me), and Microsoft Windows 2000, it may appear like this:

A B C D E F G
					

However, in Windows XP, it may appear like this:

A  B  C  D  E  F  G
					

CAUSE

This problem can occur because Windows XP should not use SetTextCharacterExtra on handle-to-device context that will later pass to graphics constant. DrawText sets intercharacter spacing by the number of bytes, not by the number of characters.

RESOLUTION

To work around this problem, use TextOut.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Handle-to-device context is the parameter that is common to all Graphics Device Interface (GDI) APIs that tells GDI which surface to draw on. GDI contains APIs like LineTo, FillRect, and TextOut.

Modification Type:MajorLast Reviewed:10/18/2001
Keywords:kbbug kbdisplay kbui KB305320