Using Shaping Engines

Uniscribe uses multiple shaping engines that contain the layout knowledge for particular scripts. It also takes advantage of the OpenType layout shaping engine for handling font-specific script features, such as glyph generation, extent measurement, and word-breaking support. Uniscribe manages bidirectional character reordering using the Unicode bidirectional algorithm, and understands non-OpenType layout font formats for Arabic, Hebrew, and Thai shaping.

Since the exact code point ranges assigned to each shaping engine might vary, script numbers are not published, with the exception of SCRIPT_UNDEFINED. However, your application can test the attributes of scripts by calling the ScriptGetProperties function, which accesses the global script properties table. The application can use the global script properties to help combine its own layout rules with the required shaping engine divisions.

The application accesses a shaping engine with a call to the ScriptShape function. All the complex script shaping engines, the digit shaping engines, and the ASCII shaping engines validate the font indicated in the device context handle before shaping. Complex scripts must be shaped using the script returned by the ScriptItemize function in order to be legible. Other runs remain legible if shaped with SCRIPT_UNDEFINED specified in the eScript member of the SCRIPT_ANALYSIS structure, although they might lose typographic quality.

ScriptShape returns 0 if successful, or USP_E_SCRIPT_NOT_IN_FONT if the font supplied by the application does not contain sufficient glyphs or shaping tables. If the application specifies SCRIPT_UNDEFINED and some characters are not supported by the font, the function still succeeds. In this case, the application should scan the glyph output buffer for the presence of missing glyphs. For strategies to deal with missing glyphs, see Using Font Fallback.

Using Uniscribe