Related Processing for Complex Scripts (Windows Embedded CE 6.0)

1/6/2010

To provide text justification, an application can use one of two methods:

  • For a simple implementation of multilingual justification, call ScriptJustify. The call to ScriptJustify generates the delta dx array by considering kashida, then interword spacing, and then inter-character spacing.
  • For more sophisticated justification, call ScriptShape. The call to ScriptShape generates an updated delta dx array by using its own language knowledge and the information returned by ScriptShape in the SCRIPT_VISATTR array.

Justification space or kashida should be inserted where identified by the uJustificaion member of the SCRIPT_VISATTR. When performing intercharacter justification, insert extra space only after glyphs marked with SCRIPT_JUSTIFY_CHARACTER.

The application does caret placement and hit testing by using ScriptXtoCP and ScriptCPtoX.

To obtain widths in a font–independent manner, call ScriptGetLogicalWidths. By passing the logical widths to ScriptApplyLogicalWidth, a block of text can be redisplayed in the same boundaries with acceptable loss of quality even when the original font is not available. Passing the logical widths to ScriptApplyLogicalWidth generates an array of glyph widths suitable for passing to ScriptTextOut.

To retrieve the specific glyphs that are used for the default, blanks, kashida, and so forth, for the current font, call ScriptGetFontProperties. To determine which characters in a run are supported by the selected font, call ScriptGetCMap. Characters that are not available have the default glyph in the glyph buffer.

Note that this method fails if a font renders a character using a combination of glyphs instead of a single glyph — for example, 00C9; LATIN CAPITAL LETTER E WITH ACUTE could be rendered using a capital E glyph and an acute glyph. To determine the font support for a string that contains these kinds of code points, call ScriptShape. If it returns S_OK, check the output for missing glyphs.

The ScriptCacheGetHeight function returns the height of the font from the font cache. ScriptGetProperties provides information on the special processing required for all the scripts, indexed by script. For example, it includes the primary language associated with the script, whether the script is numeric, and whether the script is a complex script.

ScriptGetGlyphABCWidth returns the ABC width of a given glyph, which may be useful for drawing glyph charts. However, it should not be used for normal complex script text formatting.

See Also

Other Resources

Uniscribe Application Development