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(
  int                   iCP,
  BOOL                  fTrailing,
  int                   cChars,
  int                   cGlyphs,
  const WORD            *pwLogClust,
  const SCRIPT_VISATTR  *psva,
  const int             *piAdvance,
  const SCRIPT_ANALYSIS *psa,
  int                   *piX
);

Parameters

iCP

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

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.

cChars

Number of characters in the run.

cGlyphs

Number of glyphs in the run.

pwLogClust

Pointer to the logical clusters.

psva

Pointer to a SCRIPT_VISATTR array of visual attributes.

piAdvance

Pointer to an advance widths value.

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.

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

   
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