Platform SDK: International Features

ScriptCPtoX

The ScriptCPtoX function returns the x offset from the left end (!fLogical) or leading edge (fLogical) of a run to either the leading or trailing edge of a logical character cluster.

HRESULT WINAPI 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
[in] Logical character position in the run.
fTrailing
[in] Indicates the edge from which to compute the offset.
cChars
[in] Number of characters in the run.
cGlyphs
[in] Number of glyphs in the run.
pwLogClust
[in] Logical clusters.
psva
[in] Pointer to a SCRIPT_VISATTR array.
piAdvance
[in] Pointer to advance widths value.
psa
[in] Pointer to a SCRIPT_ANALYSIS structure.
piX
[out] Pointer to a variable that receives the resulting x position of the caret.

Return Values

If the function succeeds, the return value is zero.

If the function fails, it returns a nonzero value. And if any other unrecoverable error is encountered, it is also returned as HRESULT. For example, error returns from Win32 API functions are converted to HRESULT using the HRESULT_FROM_WIN32 macro and returned to the client in the HRESULT.

Remarks

The iCP parameter is the offset of any logical character in the cluster.

For scripts in which the caret may conventionally be placed in the middle of clusters (for example, Arabic and Hebrew), the returned x may 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 resulting x position will be snapped to the requested edge of the cluster containing iCP.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Usp10.h.
  Library: Use Usp10.lib.

See Also

Uniscribe Overview, Uniscribe Functions, ScriptXtoCP, SCRIPT_ANALYSIS, SCRIPT_VISATTR