3    Using Asian Language Support Enhancements for Motif Applications

In Motif environments, such as CDE, you use versions of fonts, codesets, servers, and applications that support features discussed in earlier chapters. This chapter provides more detail on using features that help support Asian languages. Topics include the following:

For information on font rendering and on how to use font renderers for multibyte PostScript fonts, UDC fonts, and TrueType fonts, see the Writing Software for the International Market manual.

3.1    Tuning the X Server for Ideographic Languages

Asian languages have large ideographic character sets, so all characters needed for display are not loaded into memory at the same time. Instead, only as many characters as will fit in the memory cache are simultaneously loaded. When characters needed for display are not currently cached in memory, the least recently used font glyphs are removed from the cache to make room. The font-cache mechanism allows you to display ideographic text in multiple typefaces, font sizes, and font styles without increasing the amount of memory that systems must have to support ideographic languages.

The X server font-cache mechanism allows you to change the number of cache units and the size of these units to best accommodate the character sets used in displays. You will probably need to change the default values set for cache parameters to achieve the best performance from your system if it will display Asian language text. Consider the following criteria when deciding on the optimal values for font caching:

To change the cache size (which is the number of cache units) and the size of each cache unit, you must modify the X server configuration file /usr/lib/X11/xdm/Xservers. This file contains a line, similar to the following one, that starts the X server:

:0 local /usr/bin/X11/X

You can modify this line to add definitions for cache size and unit size. For example:

:0 local /usr/bin/X11/X -cs cache_size -cu unit_size

Table 3-1 describes the options that tune the font-cache mechanism.

Table 3-1:  X Server Options for Tuning the Font-Cache Mechanism

stty Option Description
-cs cache_size

Defines the number of cache units.

The minimum (and also default) value for this parameter is 1024. If you specify a cache size smaller than 1024, font caching is disabled. For one ideographic language, the recommended value is the lowest multiple of 1024 that accommodates the number of frequently used characters in that language.

If a workstation displays multiple ideographic languages simultaneously, you must add together the values required for each language to get the minimum cache size. Specify an even larger value if you intend to run applications, such as desktop publishing software, that require multiple font styles and sizes for each ideographic character.

-cu unit_size

Defines the size of each cache unit.

The minimum value for unit size is 31 bytes and the default value is 128 bytes. If you specify a value smaller than 31 bytes, the value has no effect. If a particular font requires more memory space than 128 bytes, the font-cache mechanism automatically allocates one or more additional units to store its glyphs.

Note

Font caching applies only to uncompressed fonts in pcf format. Font caching is not applied to any compressed fonts or to fonts in bdf format. Because font caching cannot be used with compressed fonts, the 2-byte fonts for Asian languages are not installed in compressed format.

You can calculate cache unit size with the following formula:

unit_size = ((floor(ceil((double)WIDTH / 8.0) /4.0)) + 1.0) * 4.0 * (double)HEIGHT
 

Consider the following calculation for a typical font size of 24x24:

unit_size in bytes = 
((floor(ceil((double) 24 / 8.0 / 4.0)) + 1.0) * 4.0 * (double) 24 = 96

For 34x34 fonts, the unit size calculation would yield 272 bytes.

Given that 96 bytes are needed to cache a 24x24 font glyph and 272 bytes are needed to cache a 34x34 font glyph, the default unit size of 128 has the following implications:

Small fonts (those whose characters require a single 128-byte unit) are used to display ideographic characters. Therefore, you usually have to change only the cache size to achieve acceptable performance in text displays of languages with ideographic characters.

3.2    Setting Fonts for Display of Local Languages

The system on which you install language variant subsets is automatically updated with the fonts required to display text in the supported languages.

In CDE, applications access local language fonts through a font alias mechanism. The /usr/dt/config/xfonts/i18n/{75,100}dpi/fonts.alias files rather than files installed in the /usr/dt/config/xfonts/locale-name/ areas are most critical for resolution of which fonts an application uses. This arrangement supports both a consistent session language and the ability to run an individual application in a language different from the session language.

X or Motif applications require non-ASCII fonts to display Chinese (and other, non-English) characters. Therefore, you must set the font path appropriately before starting an application that displays Chinese characters. An application can find Chinese fonts for codesets other than GBK or GB18030 in either of the following directories:

Chinese fonts for GBK and GB18030 are installed in /usr/i18n/lib/X11/fonts/SChineseTT (for TrueType font).

For CDE applications, the appropriate fonts are installed on the system or available through a font server. Thus, you do not need to enter manual commands to ensure that the appropriate fonts are found. You can use the xset command to check the font path or to add an appropriate font to the path as described in xset(1X).

3.2.1    Accessing Local Language Fonts for Remote Displays

The system where local language subsets are installed may function as a client in a client/server display environment. In this case, the local language fonts must also be available to the window managers for all the server systems where native language text is displayed.

To make local language fonts available for other server systems, you must do one of the following:

You can use the /usr/bin/X11/xlsfonts command to determine which fonts are currently installed on your system.

See Appendix A for tables on fonts that describe, for each font set, the language, typeface code, style, sizes, and support for 75 or 100 dots-per-inch resolution.

3.3    Customizing a Terminal Emulation Window for Asian Languages

The following features and restrictions apply to terminal windows that you create when an Asian language is specified for the language setting: