Asian Application Developer's Guide

Appendix A OpenWindows Information

This appendix contains information on developing applications for the OpenWindows environment.

System Environment

Asian OpenWindows locale Environment

Korean or Chinese locale-specific files are in the directory:

Window Message Files

Refer to Solaris Internationalization Guide for Developers for information on how the window system does messaging, how these messages are generated, and how to create message files for applications.

Korean Messages

Files in the /usr/openwin/lib/locale/ko/LC_MESSAGES directory with .mo filename extensions contain messages used in the Korean OpenWindows environment. They are created from portable message files (xxx.po).

Simplified Chinese Messages

Files in the /usr/openwin/lib/locale/zh/LC_MESSAGES directory with .mo filename extensions contain messages used in DeskSet tool windows. They are created from portable message files (xxx.po).

Traditional Chinese Messages

Files in the /usr/openwin/lib/locale/zh_TW/LC_MESSAGES directory with .mo filename extensions contain messages used in the Chinese OpenWindows environment.

fonts Directory

The /usr/openwin/lib/locale/locale/X11/fonts directory holds the Korean or Chinese fonts. (locale is ko, zh, or zh_TW). This directory must be in your font path before you can access Korean or Chinese fonts. The openwin script that comes with the Asian Solaris operating environment includes this directory in the font path. To add a different font directory path dynamically, type:


% xset +fp font_directory_path

libs Directory

The /usr/openwin/lib/locale/locale/libs directory is for locale-specific libraries (locale is ko, zh, or zh_TW). It contains only the wdkind.so library, which provides Korean- or Chinese-specific word selection capabilities.

xview Directory

The /usr/openwin/lib/locale/locale/xview directory currently contains two resource files for XView; .text_extras_menu, which defines the extra menu under text subwindow, and defaults, which defines some default values used by the XView library (locale is ko, zh, or zh_TW).

print Directory

The /usr/openwin/lib/locale/locale/print directory contains ko, zh, or zh_TW locale-specific printing files (locale is ko, zh, or zh_TW). Most notable is the prolog.ps file, which is used by the Korean or Chinese OpenWindows DeskSet tools that come with the Korean or Chinese Solaris operating environment. For information on using prolog.ps, see the printing facilities chapters in the Asian Solaris user's guide appropriate to your Solaris operating environment.

Font Information

Using Bitmap Fonts with XView Applications

To use your new Korean bitmap font with XView applications, you must add a font set definition in /usr/openwin/lib/locale/ko/OW_FONT_SETS/OpenWindows.fs. For example:

myfont:definition,\
 -sun-gothic-medium-r-normal--18-160-75-75-c-80-ksc5636-0,\
 -new-myfont-medium-r-normal--18-160-75-75-c-160-ksc5601.1987-0

To use your new Simplified Chinese bitmap font with XView applications, you must add a font set definition in /usr/openwin/lib/locale/zh/OW_FONT_SETS/OpenWindows.fs. For example:

myfont:definition,\
 -sun-song-medium-r-normal--18-160-75-75-c-80-iso8859-1,\
 -new-myfont-medium-r-normal--18-160-75-75-c-160-gb2312.1980-0

To use your new Traditional Chinese bitmap font with XView applications, you must add a font set definition in /usr/openwin/lib/locale/zh_TW/OW_FONT_SETS/OpenWindows.fs. For example:

myfont:definition,\
 -sun-sung-medium-r-normal--18-160-75-75-c-80-cns11643-0,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-1,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-2,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-3,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-4,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-5,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-6,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-7,\
 -sun-sung-medium-r-normal--18-160-75-75-c-160-cns11643-15,\
 -new-myfont-medium-r-normal--18-160-75-75-c-160-cns11643-16

Make sure you use the correct English font size with the Asian fonts. Then type:


system% shelltool -font myfont

See "Font Sets" for a description of font sets.

Font Sets

A font set is a collection of one or more fonts needed to display characters in a language with multiple character sets. The Asian Solaris font sets are described in the following subsections. The concept of font sets is described more fully in XView Developer's Notes.

The /usr/openwin/lib/locale/locale/OW_FONT_SETS/OpenWindows.fs (locale = ko, zh, zh_TW) file defines the full Korean or Chinese OpenWindows font set and also sets the following font point size definitions:

Korean Font Sets

In the Asian OpenWindows environment, a Korean font set is composed of one Roman font (presenting codeset 0 or ASCII characters in ISO8859 standard) and one Korean font (presenting codeset 1 characters in KS C 5601).

The Asian OpenWindows environment provides some default font sets defined in a Korean font set definition file:

/usr/openwin/lib/locale/ko/OW_FONT_SETS/OpenWindows.fs

The following is part of this file:

! (14 points, proportional)
-sun-kodig-medium-r-normal--16-140-75-75-p-140-korean-
0:definition,\
    -b&h-lucida-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1,\
    -sun-gothic-medium-r-normal--16-140-75-75-c-140-ksc5601.1987-0

The following line in the file defines a font set as follows:

"-sun-kodig-medium-r-normal--16-140-75-75-p-140-korean-0"

The following line describes the Roman font for codeset 0 (ASCII) character font display:

"-b&h-lucida-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1"

The following line describes the codeset 1 character display, along with the following:

"-sun-gothic-medium-r-normal--16-140-75-75-c-140-ksc5601.1987-0"

Note the following default font sets defined in the Korean OpenWindows environment:

-sun-kodig-medium-r-normal--14-120-75-75-c-120-korean-0
-sun-kodig-medium-r-normal--16-140-75-75-p-140-korean-0
-sun-kodig-medium-r-normal--16-140-75-75-c-140-korean-0
-sun-kodig-medium-r-normal--18-160-75-75-c-160-korean-0
-sun-kodig-bold-r-normal--16-140-75-75-p-140-korean-0
-sun-kodig-bold-r-normal--16-140-75-75-c-140-korean-0
-sun-kodig-bold-r-normal--18-160-75-75-c-160-korean-0
-sun-myeongjo-medium-r-normal--16-140-75-75-p-140-korean-0
-sun-myeongjo-medium-r-normal--16-140-75-75-c-140-korean-0
-sun-myeongjo-medium-r-normal--22-200-75-75-c-200-korean-0
-sun-myeongjo-medium-r-normal--26-240-75-75-c-240-korean-0
-sun-myeongjo-bold-r-normal--16-140-75-75-p-140-korean-0
-sun-myeongjo-bold-r-normal--16-140-75-75-c-140-korean-0

The font set name alias definitions are also provided in /usr/openwin/lib/locale/ko/OW_FONT_SETS/OpenWindows.fs.

An alias definition line in the file appears as follows:

kodig14: alias, -sun-kodig-medium-r-normal--16-140-75-75-c-140-korean-0

You can use kodig14 instead of -sun-kodig-medium-r-normal--16-140-75-75-c-140-korean-0 to access the font set.

Font Set  

Alias 

kodig12 

-sun-kodig-medium-r-normal--14-120-75-75-c-120-korean-0

kodig14 

-sun-kodig-medium-r-normal--16-140-75-75-c-140-korean-0

kodig16 

-sun-kodig-medium-r-normal--18-160-75-75-c-160-korean-0

myeongjo14 

-sun-myeongjo-medium-r-normal--16-140-75-75-c-140-korean-0

myeongjo16 

-daewoo-myeongjo-medium-r-normal--18-160-75-75-c-160-korean-0

myeongjo20  

-sun-myeongjo-medium-r-normal--22-200-75-75-c-200-korean-0

myeongjo24 

-sun-myeongjo-medium-r-normal--26-240-75-75-c-240-korean-0

For complete definitions of these and other font sets, see the /usr/openwin/lib/locale/kozh_TW/OW_FONT_SETS/OpenWindows.fs file and to XView Developer's Notes.

Korean Scalable Fonts

The Korean Solaris scalable fonts are Kodig-Medium (alias Gothic-Medium) and Myeongjo-Medium (alias Myoungjo-Medium).

The Korean scalable fonts corresponding to KS C 5601-1987 can be also be accessed from the X side by calling XCreateFontSet. For example, the following code creates a font set consisting of scalable Lucida fonts scaled to 33 pixels, and scalable Kodig-Medium font scaled to 33 points.

 fs = XCreateFontSet(display,
   "-b&h-lucida-medium-r-normal-sans-33-*-*-*-p-*-iso8859-1,\
    -hanyang-kodig-medium-r-normal--*-330-*-*-m-*-ksc5601.1987-0",
       &missing_ptr, &missing_count, &def_string);

Starting Windows with a Specific Korean Font Set

A command line that starts an Asian OpenWindows tool can also specify its font. There are several ways you can specify which font set an Asian OpenWindows application uses. When starting an application tool, Asian OpenWindows checks font specifiers in command line arguments (e.g., -Wt myeongjo14, or -font myeongjo14, or -fn myeongjo14). If the font is not specified in the command line, but the shell variable LANG or LC_CTYPE is set to ko, then Asian OpenWindows uses the kodig14 font specification.

The following is an example of a command line argument used to start a new Korean Solaris command tool with a specified font:


system% cmdtool -Wt myeongjo14 

The window display and UNIX processes might behave in a confusing manner if the font setting and locale are mismatched. However, when the current locale is U.S. (C, ASCII), the command uses a long XLED font name and cannot use a font set alias. Short and long font names are explained in the following section.


system% cmdtool -font -misc-fixed-medium-r-normal--9-80-100-100-c-
60-iso8859-1 

Simplified Chinese Font Sets

In the Asian OpenWindows environment, a font set is composed of one Roman font (presenting codeset 0 or ASCII characters in ISO8859 standard) and one Chinese font (presenting codeset 1 characters in GB2312).

The Asian OpenWindows environment provides some default font sets defined in a Chinese font set definition file:

/usr/openwin/lib/locale/zh/OW_FONT_SETS/OpenWindows.fs

The following is part of this file:

! (14 points, proportional)
-sun-song-medium-r-normal--16-140-75-75-p-140-chinese-
0:definition,\
    -b&h-lucida-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1,\
    -sun-song-medium-r-normal--16-140-75-75-c-140-gb2312.1980-0

The following line in the file defines a font set as follows:

"-sun-song-medium-r-normal--16-140-75-75-p-140-Chinese-0"

The following line describes the Roman font:

"-b&h-lucida-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1"

The following line describes the codeset 0 (ASCII) character display, along with the following:

"-sun-song-medium-r-normal--16-140-75-75-c-140-gb2312.1980-0"

Note the following default font sets defined in the Chinese OpenWindows environment:

-sun-song-medium-r-normal--14-120-75-75-c-120-chinese-0
-sun-song-medium-r-normal--16-140-75-75-p-140-chinese-0
-sun-song-medium-r-normal--16-140-75-75-c-140-chinese-0
-sun-song-medium-r-normal--18-160-75-75-c-160-chinese-0
-sun-song-medium-r-normal--22-200-75-75-c-200-chinese-0
-sun-song-medium-r-normal--26-240-75-75-c-240-chinese-0
-sun-song-bold-r-normal--16-140-75-75-p-140-chinese-0
-sun-song-bold-r-normal--16-140-75-75-c-140-chinese-0

The font set name alias definitions are also provided in /usr/openwin/lib/locale/zh/OW_FONT_SETS/OpenWindows.fs.

An alias definition line in the file appears as follows:

song14: alias, -sun-song-medium-r-normal--16-140-75-75-c-140-chinese-0

You can use song14 instead of -sun-song-medium-r-normal--16-140-75-75-c-140-chinese-0 to access the font set.

Font Set 

Aliases 

song12

-sun-song-medium-r-normal--14-120-75-75-c-120-chinese-0

song14

-sun-song-medium-r-normal--16-140-75-75-c-140-chinese-0

song16

-sun-song-medium-r-normal--18-160-75-75-c-160-chinese-0

song20

-sun-song-medium-r-normal--22-200-75-75-c-200-chinese-0

song24

-sun-song-medium-r-normal--26-240-75-75-c-240-chinese-0

songb14

-sun-song-bold-r-normal--16-140-75-75-c-140-chinese-0

songb16

-sun-song-bold-r-normal--18-140-75-75-c-160-chinese-0

For complete definitions of these and other font sets, see the /usr/openwin/lib/locale/zh/OW_FONT_SETS/OpenWindows.fs file and to XView Developer's Notes.

Using a Simplified Chinese Font on the Command Line

A command line that starts a Chinese OpenWindows tool can also specify its font.

When the current locale is zh, the command should refer to a font-set name (explained in the following section), for example:


system% cmdtool -font song24 

The flags -font, -Wt, and -fn all work the same in this kind of command. However, when the current locale is C (ASCII), the font name should refer only to the long XLFD name:


system% cmdtool -font -misc-fixed-medium-r-normal--9-80-100-100-c-60-iso8859-1 

Traditional Chinese Font Sets

In the Traditional Chinese OpenWindows environment, a font set is composed of one Roman font (presenting codeset 0 or ASCII characters in ISO8859 standard) and nine Chinese fonts (presenting plane 1, 2, 3, 4, 5, 6, 7, 15, and 16 characters in CNS 11643).


Note -

Asian Solaris software provides only plane 1, 2, and 3 characters.


The Asian OpenWindows environment provides some default font sets defined in a Chinese font set definition file:

/usr/openwin/lib/locale/zh_TW/OW_FONT_SETS/OpenWindows.fs

The following is part of this file:

! (14 points, proportional)
-sun-sung-medium-r-normal--16-140-75-75-p-140-tchinese-0:definition,\
    -b&h-lucida-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-1,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-2,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-3,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-4,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-5,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-6,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-7,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-15,\
    -sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-16

The following line describes the Roman font:

"-sun-sung-medium-r-normal--16-140-75-75-p-140-tchinese-0"

The following line describes the codeset 0 (ASCII) character display:

"-b&h-lucida-medium-r-normal-sans-0-0-0-0-p-0-iso8859-1"

The following line describes the plane 1 (codeset 1) Chinese character display:

"-sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-1"

The following line describes the plane 2 (codeset 2) Chinese character display:

"-sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-2"

The following line describes the plane 3 (codeset 2) Chinese character display:

"-sun-sung-medium-r-normal--16-140-75-75-c-140-cns11643-3"

Note the default font sets defined in the Asian OpenWindows environment:

-sun-sung-medium-r-normal--14-120-75-75-c-120-tchinese-0
-sun-sung-medium-r-normal--16-140-75-75-p-140-tchinese-0
-sun-sung-medium-r-normal--16-140-75-75-c-140-tchinese-0
-sun-sung-medium-r-normal--18-160-75-75-c-160-tchinese-0
-sun-sung-medium-r-normal--22-200-75-75-c-200-tchinese-0
-sun-sung-medium-r-normal--26-240-75-75-c-240-tchinese-0
-sun-sung-bold-r-normal--16-140-75-75-p-140-tchinese-0
-sun-sung-bold-r-normal--16-140-75-75-c-140-tchinese-0

The font set name alias definitions are also provided in /usr/openwin/lib/locale/zh_TW/OW_FONT_SETS/OpenWindows.fs.

The following is an alias definition line in the file:

sung14: alias, -sun-sung-medium-r-normal--16-140-75-75-c-140-tchinese-0

You can use sung14 instead of -sun-sung-medium-r-normal--16-140-75-75-c-140-tchinese-0 to access the font set.

Table A-1 Predefined Font Set Aliases

Font Set 

Aliases 

sung12 

-sun-sung-medium-r-normal--14-120-75-75-c-120-tchinese-0

sung14 

-sun-sung-medium-r-normal--16-140-75-75-c-140-tchinese-0

sung16 

-sun-sung-medium-r-normal--18-160-75-75-c-160-tchinese-0

sung20 

-sun-sung-medium-r-normal--22-200-75-75-c-200-tchinese-0

sung24 

-sun-sung-medium-r-normal--26-240-75-75-c-240-tchinese-0

For the complete definitions of these and other font sets, see the /usr/openwin/lib/locale/zh_TW/OW_FONT_SETS/OpenWindows.fs file and XView Developer's Notes.

Traditional Chinese Scalable Fonts

The scalable fonts corresponding to CNS 11643 can be also be accessed from the X side by calling XCreateFontSet. For example, the following code creates a font set consisting of scalable Lucida fonts scaled to 33 pixels, and scalable Ming-Light Chinese fonts for planes 1, 2, and 3 scaled to 33 points.

fs = XCreateFontSet(display,
       "-b&h-lucida-medium-r-normal-sans-33-*-*-*-p-*-iso8859-1,\
       -dynalab-ming-light-r-normal--*-330-*-*-m-*-cns11643-1,\
       -dynalab-ming-light-r-normal--*-330-*-*-m-*-cns11643-2,\
       -dynalab-ming-light-r-normal--*-330-*-*-m-*-cns11643-3",
       &missing_ptr,
       &missing_count,
       &def_string);

Using a Traditional Chinese Font on the Command Line

A command line that starts an Asian OpenWindows tool can also specify its font.

When the current locale is zh_TW, the command should refer to a font-set name (explained in the following section), for example:


system% cmdtool -font sung24 

The flags -font, -Wt, and -fn all work the same in this kind of command. However, when the current locale is C (ASCII), the font name should refer only to the long XLFD name:


system% cmdtool -font -misc-fixed-medium-r-normal--9-80-100-100-c-
60-iso8859-1 

XIM

Setting Status and Preedit Styles

OpenWindows resource entries in the .OWdefaults resource file set the status area style and preedit area style as described in the following sections.

Default OpenWindows settings are onTheSpot and imDisplaysInClient.

Status Styles

The Status Area displays which input mode is in effect in the IM server window. You can specify the mode by adding one of the following lines to your .OWdefaults resource file:

OpenWindows.StatusStyle.locale: clientDisplays
OpenWindows.StatusStyle.locale: imDisplaysInClient
OpenWindows.StatusStyle.locale: imDisplaysInRoot
OpenWindows.StatusStyle.locale: none

Preedit Styles

Many languages require multiple key strokes to form a single display character, syllable, symbol, ideogram, or other item. The status area needs to display input keystrokes for these languages. For the Asian OpenWindows environment, this intermediate display area is called the preedit area. The preedit area displays intermediate formations of input keystrokes while they are held in a buffer before being committed, that is, before being sent to the insertion point in the text stream to the next program operation or the application.

The four available styles of preedit area positioning are discussed in the following sections. You can set the style by placing one of the following lines in the .OWdefaults resource file:

OpenWindows.PreeditStyle.locale: onTheSpot
OpenWindows.PreeditStyle.locale: overTheSpot
OpenWindows.PreeditStyle.locale: rootWindow
OpenWindows.PreeditStyle.locale: none

The preedit areas work the same internally; only their relation to the rest of the display differs.