Text Display with Uniscribe (Windows Embedded CE 6.0)
1/6/2010
An application that uses complex scripts must consider the following issues when approaching formatting and display.
- The width of a complex script character depends on its context. It is not possible to save the widths in simple tables.
- Breaking between words in scripts like Thai requires dictionary support since there is no separator character between Thai words.
- Arabic, Hebrew, Farsi, Urdu and other bidirectional text requires reordering before display.
- Some form of font association is often required to easily use complex scripts.
To deal adequately with these issues, Uniscribe uses the paragraph as the unit for display. Therefore, Uniscribe must be used for an entire paragraph, even if sections of the paragraph are not complex scripts.
Before calling the Uniscribe programming elements, an application divides the paragraph into runs, that is, a string of characters with the same style. The style depends on what the application has implemented, but typically includes such attributes as font, size, and color.
Uniscribe divides the paragraph into items — strings that have the same script and direction. The application applies the item information to produce runs that are unique in script and direction.
Uniscribe identifies the clusters in each run and determines the size of each cluster. A cluster is a script–defined, indivisible character grouping. For European languages, a cluster is a single character, but, in languages such as Thai, it is a grouping of glyphs.
Uniscribe sums the clusters to determine the size of a run. Then the application sums the lengths of the runs until they overflow a line (or reach the margin), and divides the run that overflows the line between the current line and the next line. For each line, a map is built from visual position to a run. For each run, the code points are shaped into glyphs, which are then positioned and rendered.
An application performs text formatting and layout one time. Then it either saves the glyphs and positions for display purposes or it generates them each time it displays the text. The trade–off is speed versus memory. Typically, an application will generate the glyphs and positions each time for display, so the process is presented as a layout procedure and a display procedure.
For more information on text layout with Uniscribe, see Laying Out Text with Uniscribe.
For more information on text display with Uniscribe, see Displaying Text with Uniscribe.