Traditional Chinese Solaris User's Guide

Chapter 6 Fonts

This chapter describes the PostScript fonts included in the Traditional Chinese Solaris operating environment, what you need to use them, and how to edit them.

This chapter also describes how to use the Font Editor for bitmap fonts.

Display PostScript System (DPS)

The Traditional Chinese Solaris operating environment provides PostScript fonts in the Display PostScript System (DPS). This section describes what you need to use DPS in Traditional Chinese Solaris software. For further details, see Programming the Display PostScript System with X, published by Adobe Systems.

Using Traditional Chinese PostScript Fonts and DPS Facilities

The Traditional Chinese Solaris operating environment DPS provides the fonts listed in the following table.

Table 6-1

Font Name 

Description 

Kai-Medium 

Alias of Kai-Medium-EUC-H. 

Kai-Medium-EUC-H 

Kai-Medium font, EUC encoding, horizontal display; can be used like a Roman font. 

Kai-Medium-EUC-V 

Kai-Medium font, EUC encoding, vertical display; can be used like a Roman font. 

Kai-Medium-H 

Kai-Medium font, horizontal display, for making a composite with a Roman font. 

Kai-Medium-V 

Kai-Medium font, vertical display; for making a composite with a Roman font. 

Ming-Light 

Alias of Ming-Light-EUC-H. 

Ming-Light-EUC-H 

Ming-Light font, EUC encoding, horizontal display; can be used like a Roman font. 

Ming-Light-EUC-V 

Ming-Light font, EUC encoding, vertical display; can be used like a Roman font. 

Ming-Light-H 

Ming-Light font, horizontal display, for making a composite with a Roman font. 

Ming-Light-V 

Ming-Light font, vertical display; for making a composite with a Roman font. 

You can use the following Traditional Chinese fonts just as you would use Roman fonts:

The following figure shows a sample of Kai-Medium and Ming-Light.

Graphic

Creating Composite Roman and Traditional Chinese Fonts

You can create composite fonts using one Roman font and one of the following Traditional Chinese fonts:

For example, the following PostScript code defines a sample composite font, Times-Italic+Kai-Medium, which uses Times-Italic for ASCII characters and Kai-Medium horizontal font for Traditional Chinese characters:


/Times-Italic+Kai-Medium
13 dict begin
				/FontName 1 index def
				/FMapType 4 def
				/Encoding [ 0 1 ] def
				/WMode 0 def
				/FontType 0 def
				/FontMatrix [1.0 0.0 0.0 1.0 0.0 0.0] def
				/FDepVector [
								/Times-Italic findfont
								/Kai-Medium-H findfont
				] def
currentdict
end
definefont pop

Using Traditional Chinese Fonts in DPS Programming

You can use Traditional Chinese fonts just as you use Roman fonts in DPS wrap definitions. The following sample code creates the above display:


defineps PSWDisplayText(char *text)
			/pointSize 50 def
			/Helvetica pointSize selectfont
			(Hello World) stringwidth pop 2 div neg 0 moveto
			(Hello World) show

			/cpSize 40 def
			/Kai-Medium cpSize selectfont
			(text) stringwidth pop 2 div neg pointSize neg moveto
			(text) show
endps

You can tell PSWDisplayText(Chinese text) in a C program to display the designated Chinese text; for example, as shown below:

Graphic

Traditional Chinese Solaris software provides TrueType support in DPS.

Using Font Editor

This section describes how to edit, create, and install Portable Compiled Format (PCF) fonts used by the Traditional Chinese Solaris operating environment. You can save your changes and use the edited font(s) on your local system. This process involves the following steps:

  1. Preparing a workspace for the font(s) you edit or create

  2. Editing Bitmap Distribution Format (BDF) font file(s) with Font Editor

  3. Converting BDF font file(s) to PCF format

  4. Making the font(s) usable on your system


Note -

zh_TW.BIG5 messages are not supported by Font Editor. If you run Font Editor under the zh_TW.BIG5 locale, the Font Editor interface will be in English.


Setting Up a Working Directory

  1. Create a new directory workspace for editing fonts, for example:


    system% mkdir /tmp/newfont 
    
  2. Change your working directory to that directory:


    system% cd /tmp/newfont 
    

Starting the Font Editor

The Traditional Chinese Solaris operating environment provides Font Editor for editing fonts.

A Font Editor window is displayed.


system% fontedit 

Font Editor does not operate on PCF format font files (file extension .pcf), which are used by the Solaris operating environment. This tool handles only fonts in BDF, a portable format defined by the MIT X Consortium.

Preparing a Font File

The font's encoding should start at 8481 (0x2121). For an example, assume that you have a BDF file such as the following myfont14.bdf:


STARTFONT 2.1
COMMENT Sample Font
FONT Myfont-Medium14
SIZE 14 75 75
...
STARTCHAR C101
ENCODING 8481
...

Editing a BDF Font File

  1. In the Font Editor tool window, choose FileLoad and load the font template file for the character(s) you will create.

  2. For example, to edit or create myfont14 font characters, load myfont14.bdf:

    Graphic
  3. Click Select button to display the Fontedit: Select window.

    Graphic
  4. To edit a character, type the hexadecimal high and low bytes of the font encoding code assigned to the character.

    Click the right or left arrows to increase or decrease the numbers.

  5. Click Edit in the Fontedit: Select window.

    This clears the field or displays the character for editing in the Font Editor main window:

    Graphic
  6. Edit the glyph by turning on or off the pixels on the main canvas:

    • Click the SELECT mouse button to turn on a pixel.

    • Click the ADJUST mouse button to turn off a pixel.

    • Hold down the MENU mouse button for a menu of additional functions.


    Note -

    The character glyph in the upper left corner of the main window shows the actual appearance of the glyph as you turn its pixels on and off.


  7. In the Select window, type the TsangChieh, I-Tien, and Telecode input methods keystroke sequences for the character.

  8. Save the character, including its glyph and input strokes, by clicking Store in the Select window.

  9. Repeat the preceding steps as needed to create or modify font glyphs.

  10. After you have edited the character(s), select Save... from the File menu and type the name of the font file.

    In this example, you would save the font file in /tmp/newfont/myfont14.bdf.

  11. Select Save Dictionary from the File menu to save the input keystrokes in the dictionary.

    In this exercise, save the dictionary in /tmp/newfont/eucinput.usr.

  12. Click Continue in the message that appears to save the dictionary.

    The dictionary is saved when you click Continue. A message appears saying you must install the dictionary in the /usr/lib/mle/zh_TW/eucinput.usr file on your system before you can use the new input method keystrokes to type the new characters.

Converting From BDF to PCF Format

Before Solaris applications can use a modified BDF file, it must be converted to a file in PCF format. It must then be replaced in the $OPENWINHOME/lib/locale/zh_TW/fonts directory as follows:


system% bdftopcf -o myfont14.pcf myfont14.bdf 

The -o option enables the matrix encoding used for Asian PCF font files. For more information, see the bdftopcf(1) and mkfontdir(1) man pages.

Installing and Checking the Edited Font

  1. To add a new bitmap, move the .pcf font file into your font directory. You may compress the .pcf font file before moving it, as follows:


    system% compress myfont14.pcf 
    
  2. Run the following commands in your font directory.

    The .bdf file should not be in the font directory.


    system% cat >> fonts.alias 
    -new-myfont-medium-r-normal--16-140-75-75-c-140-cns11643-16 
    Myfont-Medium14
    ^D
    system% mkfontdir
    system% xset +fp `pwd`
    
  3. You can view your font by entering:


    system% xfd -fn Myfont-Medium14
    

Installing the User Dictionary

You must install the dictionary file created during the Font Editor session in /usr/lib/mle/zh_TW/eucinput.usr to make the new characters accessible by Chinese input methods.

Normally you must be superuser to install such a feature. If you do not have superuser privileges on your system, contact your system administrator for help.


system% su
# cp /tmp/newfont/eucinput.usr /usr/lib/mle/zh_TW 

Restarting the htt Input Method Server

Before you can use your input method keystrokes to access the new characters, you must start a new htt to find the dictionary and new characters.

For more information on this operation, see Chapter 3, "Using the htt Input Method Server."

Accessing Edited Fonts

The edited font characters are then accessible to all applications using htt. You can test this by starting a new application, such as a Terminal, turning on input conversion (Control-spacebar), and typing the keystrokes you assigned to the new character.