windows_programming_notes.nbk: Home | Index | Next Page: FILETIME | Previous Page: ExtCreatePen


 ExtTextOut

The ExtTextOut function draws text using the currently selected font, background color, and text color. You can optionally provide dimensions to be used for clipping, opaquing, or both.

    BOOL ExtTextOut(
      HDC hdc,          // handle to DC
      int X,            // x-coordinate of reference point
      int Y,            // y-coordinate of reference point
      UINT fuOptions,   // text-output options
      CONST RECT* lprc, // optional dimensions
      LPCTSTR lpString, // string
      UINT cbCount,     // number of characters in string
      CONST INT* lpDx   // array of spacing values
    );

Parameters

Return Values

If the string is drawn, the return value is nonzero. However, if the ANSI version of ExtTextOut is called with ETO_GLYPH_INDEX, the function returns TRUE even though the function does nothing.

If the function fails, the return value is zero.

Windows NT/2000 or later: To get extended error information, call GetLastError.

Remarks

Although not true in general, Windows 95/98 supports the Unicode version of this function as well as the ANSI version.

The current text-alignment settings for the specified device context determine how the reference point is used to position the text. The text-alignment settings are retrieved by calling the GetTextAlign function. The text-alignment settings are altered by calling the SetTextAlign function.

If the lpDx parameter is NULL, the ExtTextOut function uses the default spacing between characters. The character-cell origins and the contents of the array pointed to by the lpDx parameter are specified in logical units. A character-cell origin is defined as the upper-left corner of the character cell.

By default, the current position is not used or updated by this function. However, an application can call the SetTextAlign function with the fMode parameter set to TA_UPDATECP to permit the system to use and update the current position each time the application calls ExtTextOut for a specified device context. When this flag is set, the system ignores the X and Y parameters on subsequent ExtTextOut calls.

For the ANSI version of ExtTextOut, the lpDx array has the same number of INT values as there are bytes in lpString. For DBCS characters, you can apportion the dx in the lpDx entries between the lead byte and the trail byte, as long as the sum of the two bytes adds up to the desired dx. For DBCS characters with the Unicode version of ExtTextOut, each Unicode glyph gets a single pdx entry.

Note, the alpDx values from GetTextExtentExPoint are not the same as the lpDx values for ExtTextOut. To use the alpDx values in lpDx, you must first process them.

Requirements

See Also


windows_programming_notes.nbk: Home | Index | Next Page: FILETIME | Previous Page: ExtCreatePen


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time