ScriptPlaceOpenType function (usp10.h)

Generates glyphs and visual attributes for a Unicode run with OpenType information from the output of ScriptShapeOpenType.

Syntax

HRESULT ScriptPlaceOpenType(
  [in, optional]  HDC                    hdc,
  [in, out]       SCRIPT_CACHE           *psc,
  [in, out]       SCRIPT_ANALYSIS        *psa,
  [in]            OPENTYPE_TAG           tagScript,
  [in]            OPENTYPE_TAG           tagLangSys,
  [in, optional]  int                    *rcRangeChars,
  [in, optional]  TEXTRANGE_PROPERTIES   **rpRangeProperties,
  [in]            int                    cRanges,
  [in]            const WCHAR            *pwcChars,
  [in]            WORD                   *pwLogClust,
  [in]            SCRIPT_CHARPROP        *pCharProps,
  [in]            int                    cChars,
  [in]            const WORD             *pwGlyphs,
  [in]            const SCRIPT_GLYPHPROP *pGlyphProps,
  [in]            int                    cGlyphs,
  [out]           int                    *piAdvance,
  [out]           GOFFSET                *pGoffset,
  [out, optional] ABC                    *pABC
);

Parameters

[in, optional] hdc

Handle to the device context. For more information, see Caching.

[in, out] psc

Pointer to a SCRIPT_CACHE structure identifying the script cache.

[in, out] psa

Pointer to a SCRIPT_ANALYSIS structure obtained from a previous call to ScriptItemizeOpenType. This structures identifies the shaping engine that governs the generated list of glyphs and their associated widths, and x and y placement offsets.

Alternatively, the application can set this parameter to NULL to receive unfiltered results.

[in] tagScript

An OPENTYPE_TAG structure containing the OpenType script tag for the writing system to use.

[in] tagLangSys

An OPENTYPE_TAG structure containing the OpenType language tag for the writing system.

[in, optional] rcRangeChars

Array of the number of characters in each range. The number of members is indicated in the cRanges parameter. The total of values should equal the value of cChars.

[in, optional] rpRangeProperties

Array of TEXTRANGE_PROPERTIES structures defining properties for each range. The number of elements is defined by the cRanges parameter.

[in] cRanges

The number of OpenType feature ranges.

[in] pwcChars

Pointer to an array of Unicode characters containing the run. The number of elements is defined by the cRanges parameter.

[in] pwLogClust

Pointer to an array of logical cluster information. Each element in the array corresponds to a character in the array defined by pwcChars. The value of each element is the offset from the first glyph in the run to the first glyph in the cluster containing the corresponding character. Note that, when the fRTL member of the SCRIPT_ANALYSIS structure is set to TRUE, the elements in pwLogClust decrease as the array is read.

[in] pCharProps

Pointer to an array of character property values in the Unicode run.

[in] cChars

Number of characters in the Unicode run.

[in] pwGlyphs

Pointer to a glyph buffer obtained from an earlier call to the ScriptShapeOpenType function.

[in] pGlyphProps

Pointer to an array of attributes for each of the glyphs to retrieve. The number of values equals the value of cGlyphs. Since there is one glyph property per glyph, this parameter has the number of elements indicated by cGlyphs.

[in] cGlyphs

Count of glyphs in a glyph array buffer.

[out] piAdvance

Pointer to an array, of length indicated by cGlyphs, in which this function retrieves advance width information.

[out] pGoffset

Pointer to an array of GOFFSET structures in which this structure retrieves the x and y offsets of combining glyphs. This array must be of length indicated by cGlyphs.

[out, optional] pABC

Pointer to an ABC structure in which this function retrieves the ABC width for the entire run.

Return value

Returns 0 if successful. The function returns a nonzero HRESULT value if it does not succeed. In all error cases, the output values are undefined. The application can test the return value with the SUCCEEDED and FAILED macros.

The function returns E_OUTOFMEMORY if the output buffer length indicated by cGlyphs is too small. The application can try calling again with larger buffers.

The function returns E_PENDING if the script cache specified by the psc parameter does not contain enough information to place the glyphs, and the hdc parameter is passed as NULL so that the function is unable to complete the placement process. The application should set up a correct device context for the run, and call this function again with the appropriate value in hdc and with all other parameters the same.

Remarks

This function is preferred over the older ScriptPlace function. Some advantages of ScriptPlaceOpenType include the following:

  • Parameters directly correspond to OpenType tags in font layout tables.
  • Parameters define features applied to each character. Input is divided into ranges, and each range has OpenType properties associated with it.
The composite ABC width for the whole item identifies how much the glyphs overhang to the left of the start position and to the right of the length implied by the sum of the advance widths. The total advance width of the line is exactly abcA+abcB+abcC. The abcA and abcC values are maintained as proportions of the cell height represented in 8 bits and are thus roughly +/-1 percent. The total width retrieved, which is the sum of the abcA+abcB+abcC values indicated by piAdvance, is accurate to the resolution of the TrueType shaping engine.

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

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 Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header usp10.h
Library Usp10.lib
DLL Usp10.dll
Redistributable Usp10.dll version 1.600 or greater on Windows XP

See also

Displaying Text with Uniscribe

GOFFSET

OPENTYPE_TAG

SCRIPT_ANALYSIS

SCRIPT_CACHE

SCRIPT_CHARPROP

SCRIPT_GLYPHPROP

ScriptItemizeOpenType

ScriptPlace

ScriptShapeOpenType

TEXTRANGE_PROPERTIES

Uniscribe Functions