Platform SDK: International Features

ScriptLayout

The ScriptLayout function converts an array of run-embedding levels to a map of visual-to-logical position and/or logical-to-visual position.

HRESULT WINAPI ScriptLayout(
  int cRuns, 
  const BYTE *pbLevel, 
  int *piVisualToLogical, 
  int *piLogicalToVisual 
);

Parameters

cRuns
[in] Number of runs to process.
pbLevel
[in] Pointer to an array of run-embedding levels.
piVisualToLogical
[out] Pointer to an array that receives the run levels reordered to visual order.
piLogicalToVisual
[out] Pointer to an array that receives the visual run positions.

Return Values

If the function succeeds, the return value is zero.

If the function fails, it returns a nonzero value. 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 run-embedding levels, defined in the Unicode bidirectional algorithm, describe the direction of a run, the direction of any runs it is embedded in, and the direction of the paragraph.

Level Meaning
0 A left-to-right run in a left-to-right paragraph.
1 A right-to-left run embedded in a left-to-right run in a left-to-right paragraph, or

a right-to-left run (not embedded in another run) in a right-to-left paragraph.

2 A left-to-right run embedded in a right-to-left run of type 1.
3 A right-to-left run embedded in a left-to-right run of type 2.
etc. The embedding levels can continue as far as necessary.

The logical position refers to the placement of a run relative to other runs. It is the position in backing store, and corresponds to the order in which you would read the text aloud. The visual position of a run is the way the run is visually displayed on the line, taking into account the possible directions of each run.

The pbLevel parameter must contain the embedding levels for all runs on the line, ordered logically.

On output, piVisualToLogical[0] is the logical index of the run to display at the far left. Subsequent entries should be displayed progressing from left-to-right.

The piLogicalToVisual[0] parameter is the relative visual position where the first logical run should be displayed, the leftmost display position being zero.

The caller may request either piLogicalToVisual or piVisualToLogicalI, or both.

Note that no other input is required because the embedding levels give all necessary information for layout.

Requirements

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

See Also

Uniscribe Overview, Uniscribe Functions