ScriptTextOut function (usp10.h)

Displays text for the specified script shape and place information.

Syntax

HRESULT ScriptTextOut(
  [in]           const HDC             hdc,
  [in, out]      SCRIPT_CACHE          *psc,
  [in]           int                   x,
  [in]           int                   y,
  [in]           UINT                  fuOptions,
  [in, optional] const RECT            *lprc,
  [in]           const SCRIPT_ANALYSIS *psa,
  [in]           const WCHAR           *pwcReserved,
  [in]           int                   iReserved,
  [in]           const WORD            *pwGlyphs,
  [in]           int                   cGlyphs,
  [in]           const int             *piAdvance,
  [in, optional] const int             *piJustify,
  [in]           const GOFFSET         *pGoffset
);

Parameters

[in] hdc

Handle to the device context. For more information, see Caching. Note that, unlike some other related Uniscribe functions, this function defines the handle as mandatory.

[in, out] psc

Pointer to a SCRIPT_CACHE structure identifying the script cache.

[in] x

Value of the x coordinate of the first glyph.

[in] y

Value of the y coordinate of the first glyph.

[in] fuOptions

Options equivalent to the fuOptions parameter of ExtTextOut. This parameter can be set to either ETO_CLIPPED or ETO_OPAQUE, to both values, or to neither value.

[in, optional] lprc

Pointer to a RECT structure containing the rectangle used to clip the display. The application can set this parameter to NULL.

[in] psa

Pointer to a SCRIPT_ANALYSIS structure obtained from a previous call to ScriptItemize.

[in] pwcReserved

Reserved; must be set to NULL.

[in] iReserved

Reserved; must be 0.

[in] pwGlyphs

Pointer to an array of glyphs obtained from a previous call to ScriptShape.

[in] cGlyphs

Count of the glyphs in the array indicated by pwGlyphs. The maximum number of glyphs is 65,536.

[in] piAdvance

Pointer to an array of advance widths obtained from a previous call to ScriptPlace.

[in, optional] piJustify

Pointer to an array of justified advance widths (cell widths). The application can set this parameter to NULL.

[in] pGoffset

Pointer to a GOFFSET structure containing the x and y offsets for the combining glyph.

Return value

Returns 0 if successful. The function returns a nonzero HRESULT value if it does not succeed. The application can test the return value with the SUCCEEDED and FAILED macros.

Remarks

This function calls the operating system ExtTextOut function for text display. For more information, see Displaying Text with Uniscribe.

All arrays are in display order unless the fLogicalOrder member is set in the SCRIPT_ANALYSIS structure indicated by psa.

For any run that is rendered right-to-left and was generated in logical order by forcing the fLogicalOrder member of SCRIPT_ANALYSIS, the application must call SetTextAlign (hdc, TA_RIGHT) and give the right-side coordinate before calling ScriptTextOut.

The array indicated by piJustify provides cell widths for each glyph. When the width of a glyph differs from the unjustified width, specified by piAdvance, space is added to or removed from the glyph cell at its trailing edge. The glyph is always aligned with the leading edge of its cell. This rule applies even in visual order.

When a glyph cell is extended, the extra space is usually made up by the addition of white space. However, for Arabic scripts, the extra space is made up by one or more kashida glyphs, unless the extra space is insufficient for the shortest kashida glyph in the font. The width of the shortest kashida is available by calling ScriptGetFontProperties.

The application should pass a value for piJustify only if the string must be justified by ScriptTextOut. Normally, the application should pass NULL.

The application should not use ScriptTextOut to write to a metafile unless the metafile will be played back without any font substitution, for example, immediately on the same system for scalable page preview. ScriptTextOut records glyph numbers in the metafile. Since glyph numbers vary considerably from one font to another, the file is unlikely to play back correctly when different fonts are substituted. For example, when a metafile is played back at a different scale, a CreateFont request recorded in the metafile can resolve to a bitmap instead of a TrueType font. Likewise, if the metafile is played back on a different computer, the requested fonts might not be installed. To write complex scripts in a metafile in a font-independent manner, the application should use ExtTextOut to write the logical characters directly, so that glyph generation and placement do not occur until the text is played back.

Important  Starting with Windows 8: To maintain the ability to run on Windows 7, a module that uses Uniscribe must specify Usp10.lib before gdi32.lib in its library list.
 

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header usp10.h
Library Usp10.lib
DLL Usp10.dll
Redistributable Internet Explorer 5 or later on Windows Me/98/95

See also

Displaying Text with Uniscribe

GOFFSET

SCRIPT_ANALYSIS

SCRIPT_CACHE

ScriptGetFontProperties

ScriptItemize

ScriptPlace

ScriptShape

Uniscribe

Uniscribe Functions