BUG: The SetTextCharacterExtra() Function Is Sometimes Ignored When Printing (262614)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows NT Server 4.0
  • Microsoft Windows NT Workstation 4.0
  • 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 "RAW", 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 "RAW".

To implement the workaround, the "extra" 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

Modification Type:MajorLast Reviewed:5/14/2003
Keywords:kbbug kbdraw kbGDI kbprint KB262614