Asian Application Developer's Guide

Chapter 4 Asian Solaris Fonts

This chapter discusses Korean and Chinese font-related information for developers and programmers.

Korean Fonts

Six typefaces of Korean scalable and bitmap fonts are provided in the Korean Solaris software:

Kodig and Myeongjo contain Korean characters in accord with the KS C 5601 and KS C 5700 standards. Gothic is an alias of Kodig, and Myeongjo is an alias of Myeongjo.

Korean Solaris software includes bitmap and scalable Korean fonts under the /usr/openwin/lib/locale/ko/X11/fonts and /usr/openwin/lib/locale/ko.UTF-8/X11/font directories.

Korean bitmap fonts are in the subdirectories:

Korean F3 scalable fonts are in the subdirectories:

Korean character ID (CID) scalable fonts are in the subdirectories:

You can use X Font Displayer (xfd) to view a Korean font, for example:


system% xfd -fn kodig-medium14

The xfd(1) man page provides more information.

All Korean fonts have XLFD font names, and you can use the xlsfonts utility to display these names, as in the following example:


system% xlsfonts | grep kodig

Simplified Chinese Fonts

Simplified Chinese Solaris software provides Song-style fonts, with Simplified Chinese characters in accord with the GB2312-80 standard.

Bitmap Simplified Chinese fonts are provided, located under the /usr/openwin/lib/locale/zh/X11/fonts directory. The fontedit utility enables users to edit bitmap fonts.

Simplified Chinese Solaris provides TrueType scalable fonts in the following type faces:

You can use X Font Displayer (xfd) to view a Simplified Chinese font, for example:


system% xfd -fn song-medium14

The xfd(1) man page provides more information.

All Simplified Chinese fonts have XLFD font names, and you can use the xlsfonts utility to display these names as follows, for example:


system% xlsfonts | grep gb2312

Traditional Chinese Fonts

Bitmap, scalable, and PostScript composite Traditional Chinese fonts are provided, located in the /usr/openwin/lib/locale/zh_TW/X11/fonts directory.

These bitmap fonts are in:

The fontedit utility enables users to edit bitmap fonts.

Traditional Chinese Solaris provides TrueType scalable fonts in the following type faces:

These scalable fonts are in: OPENWINHOME/lib/locale/zh_TW/X11/fonts/TrueType

Chinese PostScript composite fonts are in: /usr/openwin/lib/locale/zh_TW/X11/fonts/composite

You can use X Font Displayer (xfd) to view a Traditional Chinese font, for example:


system% xfd -fn ming-light14

The xfd(1) man page provides more information.

All Traditional Chinese fonts have XLFD font names, and you can use the xlsfonts utility to display these names as in the following example:


system% xlsfonts | grep sung
......
system% xlsfonts | grep kai

Programmer's Font Set Functions

Asian Solaris software uses the font set mechanisms defined in X11R6. Programmers can access the font set using X11R6 calls such as:

Refer to the X11R6 document for a list of text drawing functions also available in the Korean or Chinese Solaris software.

Editing Fonts with fontedit

Asian Solaris software provides support for editing bitmap fonts. The Font Editor is in /usr/openwin/bin/fontedit.

The Font Editor handles English or Asian characters in Bitmap Distribution Format (BDF), a portable format defined by the MIT X Consortium. BDF font files have the file extension .bdf.

However, the Asian Solaris operating environment uses Portable Compiled Format (PCF) for bitmap fonts, and Solaris software provides tools to convert between BDF and PCF.

The process of modifying a font involves the following steps.

  1. Locate an Asian font file in BDF.

    The encoding should start at 8481(0X2121), as shown in the following example of myfont16.bdf.

    STARTFONT 2.1
    COMMENT Sample Font
    FONT Myfont-Medium
    SIZE 16 75 75
     ...
    STARTCHAR C101
    ENCODING  8481
     ...

  2. Start fontedit to modify the BDF file and choose either single-byte encoding for ASCII/English characters or multibyte encoding for Korean or Chinese characters.

  3. Edit your chosen font characters using the left mouse button to turn pixels on and the middle button to turn pixels off.

    For information on using Font Editor, see the chapter on using Font Editor with your locale in the Asian Solaris user's guide appropriate to your localization.

  4. Save the edited font.

  5. Make the edited Asian BDF font(s) usable by the Asian Solaris operating environment by converting to PCF format, as in the following example:


    system% bdftopcf Myfont16.bdf > Myfont-Medium16.pcf
    system% compress Myfont-Medium16.pcf
    

Adding Bitmap Fonts

This section describes how to add a new bitmap font to your environment. The steps assume the working directory is your font directory.


Note -

Solaris 2.6 includes the Font Admin tool, which you may prefer to use for configuring fonts. However, the tools is available only if you install the entire cluster. For information about the Font Admin tool, see System Administration Guide.


  1. Move the .pcf file for the new font into your font directory.

  2. Run the mkfontdir command:


    system% mkfontdir
    

  3. If you have an XLFD name for the font, put the definition of this font into fonts.alias, as in the following example:

    For a Korean font:


    system% cat >> fonts.alias
    -new-myfont-medium-r-normal--18-160-75-75-c-160-ksc5601.1987-0 
    Myfont-Medium16
    ^D
    

    For a Simplified Chinese font:


    system% cat >> fonts.alias
    -new-myfont-medium-r-normal--18-160-75-75-c-160-gb2312.1980-0 
    Myfont-Medium16
    ^D
    

    For a Traditional Chinese font:


    system% cat >> fonts.alias
    -new-myfont-medium-r-normal--18-160-75-75-c-160-cns11643-16 
    Myfont-Medium16
    ^D
    

  4. Set the user preference options of the display, as follows:


    system% xset +fp `pwd`
    system% xset fp rehash [[[optional]]]

Viewing Bitmap Fonts

You can view a font by typing:


system% xfd -fn Myfont-Medium16

With the Korean locale:


system% xfd -fn "-new-myfont-medium--r-normal--18-160-75-75-c-
160-ksc5601.1987-0"

With the Simplified Chinese locale:


system% xfd -fn "-new-myfont-medium--r-normal--18-160-75-75-c-
160-gb2312.1980-0"

With the Traditional Chinese locale:


system% xfd -fn "-new-myfont-medium--r-normal--18-160-75-75-c-
160-cns11643-16"

More on Font Encoding and Editing Fonts

The X11 encoding of Asian characters follows a 7-bit multibyte scheme with the leading bit of each byte set to zero. This differs from EUC use of 8-bit multibyte encoding with the leading bit set to one. BDF defines the encoding to be a positive decimal integer.

For convenience, fontedit lets you specify the 7-bit values of the high and low bytes, which are automatically combined into the decimal value used in the BDF file. For example, to locate EUC character 0xA1A2, you would find the following:

Table 4-1 Font Encoding

8-bit Encoding 

7-bit Encoding 

BDF Value  

0xA1A2 

0x2122 

8482  

The character appears in its actual size just above the bitmap editing area as you edit it, and immediately shows the effects of turning pixels on and off.

Font Lists

Asian Solaris 2.6 uses font lists to display text. A font defines a set of glyphs that represent the characters in a given character set. A "font set" is a collection of fonts needed to display text for a specific locale or language. A "font list" is a list of fonts, font sets, or a combination of the two. This section describes the Asian Solaris font lists and how to select them when starting an Asian Solaris application. The files in /usr/dt/app-defaults/locale/* define the system default font lists, where locale is ko, ko.UTF-8, zh, zh_TW, or zh_TW.BIG5.

Korean Font Lists

In the Asian Solaris 2.6 environment, a Korean font list is composed of one English font representing codeset 0 (ASCII) characters in KS C 5636 or ISO8859-1, and one Korean font representing codeset 1 characters in KS C 5601-1987-0.

The KS C 5636 and ISO8859-1 character sets are nearly identical. The differences are that KS C 5636 uses only the code values from 0 to 127, and the backslash character (whose ISO8859-1 code value is 92) is replaced by the Korean currency symbol. Asian Solaris 2.6 provides some default font lists defined in the application defaults files in /usr/dt/app-defaults/ko/*. The following is an excerpt from one of the files, Dtwm:

Dtwm*icon*fontList: \ 	    -dt-interface system-medium-r-normal-s*ksc*:
This portion of the file refers to a font list that contains two fonts previously mentioned that are included in the ko locale:
English font, for codeset 0 (ASCII) character font display: 
-dt-interface system-medium-r-normal-s sans-14-120-75-75-p-60-ksc5636-0
Korean font, for codeset 1 (KS C 5601-1987-0) character font display: 
-dt-interface system-medium-r-normal-s sans-14-120-75-75-p-120-ksc5601.1987-0
Note that these fonts are defined in the file /usr/openwin/lib/locale/ko/X11/fonts/75dpi/fonts.alias.

Starting Applications with a Specific Korean Font List

When you start an Asian Solaris tool at the command line, you can also specify its fonts. Below is an example of a command line argument used to start a new Korean Solaris terminal with a specified font list:


system% dtterm  -fn "-dt-interface system-medium-r-normal-s 
sans-14-120-75-75-p-60-ksc5636-0;\ 	-dt-interface 
system-medium-r-normal-s sans-14-120-75-75-p-120-ksc5601.1987-0:"
Note the two delimiters used in the font list. The ";" delimiter is used to separate the font names except for the last font name, which ends with the ":" delimiter. (In the example above, ";" follows the English font name, and the ":" delimiter follows the Korean font name.) Since there are spaces in the long font names, the font list is enclosed in quotation marks.

Korean UTF-8 Font Lists

In the Asian Solaris 2.6 environment, a Korean UTF-8 font list is composed of one English font representing codeset 0 (ASCII) characters in KS C 5636 or ISO8859-1, and one Korean Johap font representing codeset 1 characters in KS C 5601-1992-3. Asian Solaris 2.6 provides some default font lists defined in the application defaults files in /usr/dt/app-defaults/ko.UTF-8/*. The following is an excerpt from one of the files, Dtwm:

Dtwm*icon*fontList: \ 	-dt-interface system-medium-r-normal-s*ksc*:
This portion of the file refers to a font list that contains two fonts previously mentioned that are included in the ko locale:
English font, for codeset 0 (ASCII) character font display: 
-dt-interface system-medium-r-normal-s sans-14-120-75-75-p-60-ksc5636-0 
Korean Johap font, for codeset 1 (KS C 5601-1992-3) character font display:
-dt-interface system-medium-r-normal-s sans-14-120-75-75-p-120-ksc5601.1992-3
Note that these fonts are defined in the file /usr/openwin/lib/locale/ko.UTF-8/X11/fonts/75dpi/fonts.alias

Starting Applications with a Specific Korean UTF-8 Font List

When you start an Asian Solaris tool at the command line, you can also specify its fonts. Below is an example of a command line argument used to start a new Korean Solaris terminal with a specified font list in the Korean UTF-8 locale environment:


system% dtterm  -fn "-dt-interface system-medium-r-normal-s 
sans-14-120-75-75-p-60-ksc5636-0;\ 	-dt-interface 
system-medium-r-normal-s sans-14-120-75-75-p-120-ksc5601.1992-3:"
Note the two delimiters used in the font list. The ";" delimiter is used to separate the font names except for the last font name, which ends with the ":" delimiter. (In the example above, ";" follows the English font name, and the ":" delimiter follows the Korean UTF-8 font name.) Since there are spaces in the long font names, the font list is enclosed in quotation marks.

Simplified Chinese Font Lists

In the Asian Solaris 2.6 environment, a Simplified Chinese font list is composed of one English font representing codeset 0 (ASCII) characters in gb1988.1989-0 or ISO8859-1, and one Simplified Chinese font representing gb2312.1980-0 characters.

Simplified Chinese Solaris 2.6 provides some default font lists defined in application defaults files in /usr/dt/app-defaults/zh/*. The following is an excerpt from one of the files, Dtwm:

Dtwm*icon*fontList: \ 	-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:

This portion of the file refers to a font list that contains two fonts previously mentioned that are included in the zh locale.

"-dt-interface system-medium-r-normal-s serif-14-120-75-75-p-60
-gb1988.1989-0""-dt-interface system-medium-r-normal-s serif-14-120-75-75-p-120
-gb2312.1980-0"

The first is an English font for codeset 0 (ASCII) character font display. The second is a Simplified Chinese font for codeset 1 (GB2312.1980) character font display.

Note that these fonts are defined in the file /usr/openwin/lib/locale/zh/X11/fonts/75dpi/fonts.alias.

Starting Applications with a Specific Simplified Chinese Font List

When you start an Asian Solaris tool at the command line, you can also specify its fonts. Below is an example of a command line argument used to start a Simplified Chinese Windows terminal with a specified font list:


system% dtterm -fn "-dt-interface system-medium-r-normal-s \  	
serif-14-120-75-75-p-60-gb1988.1989-0; \  	
-dt-interface system-medium-r-normal-s \  	
serif-14-120-75-75-p-120-gb2312.1980-0:"
Note the two delimiters used in the font list. The ";" delimiter is used to separate the font names except for the last font name, which ends with the ":" delimiter. (In the example above, ";" follows the English font name, and the ":" delimiter follows the Simplified Chinese font name.) Since there are spaces in the long font names, the font list is enclosed in quotation marks.

Traditional Chinese (zh_TW) Font Lists

In the Asian Solaris 2.6 environment, a Traditional Chinese (zh_TW) font list is composed of one English font, representing ASCII characters in CNS11643-0 or ISO8859-1, and a number of Traditional Chinese fonts representing characters such as CNS11643-1, CNS1643-1, CNS11643-2, and CNS11643-3.

Traditional Chinese Solaris provides some default font lists defined in application defaults files in /usr/dt/app-defaults/zh_TW/*. The following is an excerpt from one of these files, Dtwm:

Dtwm*icon*fontList: \ 	-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*:
This portion of the file refers to a font list that contains the following fonts, which are defined in /usr/openwin/lib/locale/zh_TW/X11/fonts/75dpi/fonts.alias:
"-dt-interface system-medium-r-normal-s serif-16-140-75-75-p-70-cns11643-0"
"-dt-interface system-medium-r-normal-s serif-16-140-75-75-p-140-cns11643-1" 	
"-dt-interface system-medium-r-normal-s serif-16-140-75-75-p-140-cns11643-2" 	
"-dt-interface system-medium-r-normal-s serif-16-140-75-75-p-140-cns11643-3"
The first is the English font for codeset 0 (ASCII) character font display. The rest are Traditional Chinese fonts for codeset 1 (CNS11643) plane 1 character font display, and codeset 2 (CNS11643) plane 2 and plane 3 character font display.

Starting Applications with a Specific Traditional Chinese Font List

When you start an Asian Solaris tool at the command line, you can also specify its fonts. Below is an example of a command line argument used to start a new Traditional Chinese Windows terminal with a specified font list:


system% dtterm -fn  "-dt-interface system-medium-r-normal-s \  	
serif-16-140-75-75-p-70-cns11643-0; \  	-dt-interface 
system-medium-r-normal-s \  	serif-16-140-75-75-p-140-cns11643-1:"
Note the two delimiters used in the font list. The ";" delimiter is used to separate the font names except for the last font name, which ends with the ":" delimiter. (In the example above, ";" follows the English font name, and the ":" delimiter follows the Traditional Chinese font name.) Since there are spaces in the long font names, the font list is enclosed in quotation marks.

Traditional Chinese (zh_TW.BIG5) Font Lists

In the Asian Solaris 2.6 environment, a Traditional Chinese zh_TW.BIG5 font list is composed of one English font, representing ASCII characters, and one Traditional Chinese font representing Chinese characters in Big 5.

Traditional Chinese Solaris provides some default font lists defined in an application defaults file in /usr/dt/app-defaults/zh_TW.BIG5/*. Below is a part of one of the files, Dtwm:

Dtwm*icon*fontList: \ 	-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-*-*
This font list contains the following fonts, defined in /usr/openwin/lib/locale/zh_TW.BIG5/X11/fonts/75dpi/fonts.alias:
"-dt-interface system-medium-r-normal-s serif-16-140-75-75-p-70-big5-0" 	
"-dt-interface system-medium-r-normal-s serif-16-140-75-75-p-140-big5-1"
The first is an English font for ASCII character font display. The second is a Traditional Chinese Big 5 font.

Starting Applications with a Specific Traditional Chinese Font List

When you start an Asian Solaris tool at the command line, you can also specify its fonts. The following is an example of using a command line argument to start a new Traditional Chinese Windows terminal with a specified font list.


system% dtterm -fn "-dt-interface system-medium-r-normal-s \  	
serif-16-140-75-75-p-70-big5-0; \  	
-dt-interface system-medium-r-normal-s \  	
serif-16-140-75-75-p-140-big5-1:"
Note the two delimiters used in the font list. The ";" delimiter is used to separate the font names except for the last font name, which ends with the ":" delimiter. (In the example above, ";" follows the English font name, and the ":" delimiter follows the Traditional Chinese font name.) Since there are spaces in the long font names, the font list is enclosed in quotation marks.

Displaying PostScript Fonts

For screen displays, Asian Solaris software provides PostScript fonts through the Display PostScript System (DPS), as explained in Chapter 6, Display PostScript System (DPS) .