Microsoft KB Archive/262614

= BUG: The SetTextCharacterExtra Function Is Sometimes Ignored When Printing =

Article ID: 262614

Article Last Modified on 2/28/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows NT Server 4.0 Standard Edition
 * Microsoft Windows NT Workstation 4.0 Developer Edition
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional

-



This article was previously published under Q262614



SYMPTOMS
The SetTextCharacterExtra function in the Win32 API apparently is ignored when it is used on some printer device contexts in Windows 2000 and Windows NT 4.0.



RESOLUTION
To work around the problem, avoid using the SetTextCharacterExtra function on a printer device context. Instead, use the ExtTextOut function to control the advance width between each character, by using the lpDX parameter.



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



MORE INFORMATION
The problem occurs only when the device context is a printer device context and the print job is spooled with the enhanced metafile (EMF) data type. The function always works when it is used on a screen display device context.

The default action of local printer queues in Windows is to spool print jobs by using the EMF data type. This can be changed in the Print Processor dialog box of the printer's properties dialog box. If the spool data type is &quot;RAW&quot;, as is the default for most network printers, the problem does not occur. Note that for Windows 2000 printers, if the Enable Advanced Printing Features check box in the printer properties dialog is selected, the spooler may override the default data type setting and spool the print job by using the EMF data type.

The workaround is to specify character advance width by using the ExtTextOut function or to ensure that the spool data type is &quot;RAW&quot;.

To implement the workaround, the &quot;extra&quot; character spacing should be added to each element of the lpDX array that is used for the last parameter to the ExtTextOut function. Note that any other advance width modifiers, such as justification, should also be applied to this array.

The character spacing used by Windows during a TextOut function call can be obtained by using the following functions:
 * GetCharABCWidths
 * GetCharABCWidthsI
 * GetCharWidth32
 * GetCharWidthI
 * GetCharacterPlacement

Additional query words: SetTextJustification Spooling TextOut DrawText kbGDIText

Keywords: kbbug kbdraw kbgdi kbprint KB262614

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.