ScriptCPtoX function (usp10.h)

Generates the x offset from the left end or leading edge of a run to either the leading or trailing edge of a logical character cluster.

Syntax

HRESULT ScriptCPtoX(
  [in]  int                   iCP,
  [in]  BOOL                  fTrailing,
  [in]  int                   cChars,
  [in]  int                   cGlyphs,
  [in]  const WORD            *pwLogClust,
  [in]  const SCRIPT_VISATTR  *psva,
  [in]  const int             *piAdvance,
  [in]  const SCRIPT_ANALYSIS *psa,
  [out] int                   *piX
);

Parameters

[in] iCP

Logical character position in the run. This parameter corresponds to the offset of any logical character in the cluster.

[in] fTrailing

TRUE to use the trailing edge of the logical character cluster to compute the offset. This parameter is set to FALSE to use the leading edge of the logical character cluster.

[in] cChars

Number of characters in the run.

[in] cGlyphs

Number of glyphs in the run.

[in] pwLogClust

Pointer to the logical clusters.

[in] psva

Pointer to a SCRIPT_VISATTR array of visual attributes.

[in] piAdvance

Pointer to an advance widths value.

[in] psa

Pointer to a SCRIPT_ANALYSIS structure. The fLogicalOrder member specifies the end of the run from which to measure the offset. If the flag is set, the leading edge of the run is used. If the flag is not set, the left end of the run is used.

[out] piX

Pointer to the buffer in which the function retrieves the x position of the caret.

Return value

Returns 0 if successful. This 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

The leading or trailing edge of the character and the leading edge of a run depend on the direction of text in the run.

For scripts in which the caret is conventionally placed in the middle of clusters (for example, Arabic and Hebrew), the retrieved x position of the carat can be an interpolated position for any code point in the line.

For scripts in which the caret is conventionally snapped to the boundaries of clusters (for example, Thai and Indian), the x position is snapped to the requested edge of the cluster containing the logical character position indicated by iCP.

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

SCRIPT_ANALYSIS

SCRIPT_VISATTR

ScriptXtoCP

Uniscribe

Uniscribe Functions