Platform SDK: International Features

Related Processing for Complex Scripts

To provide text justification, an application can use one of two methods. For a simple implementation of multilingual justification, call ScriptJustify. It generates the delta dx array by considering kashida, then interword spacing, and then intercharacter spacing. For more sophisticated justification, an application would generate an updated delta dx array 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 inter-character 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. For more information, see Caret Placement and Hit Testing.

To get 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. It generates an array of glyph widths suitable for passing to ScriptTextOut. Such recording and reapplying of advance width information in a font independent manner can be useful in situations such as metafiling in an application defined format. Note that metafiles do not support glyph indices. To write to a Microsoft® Windows® enhanced metafile, use ExtTextOut to write the logical characters directly, so that glyph generation and placement does not occur until the text is played back.

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. 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.