Simplified Chinese Solaris User's Guide

Chapter 9 Fonts

This chapter describes the PostScript, TrueType and bitmap fonts supported for use in the Simplified Chinese Solaris Operating System. The following sections discuss how to use and to edit the fonts.

Display PostScript System (DPS)

The Simplified Chinese Solaris Operating System provides PostScript fonts in the Display PostScript System (DPS). This section describes the fonts and the DPS facilities. For further details, see Programming the Display PostScript System with X, published by Adobe® Systems.

Using Simplified Chinese PostScript Fonts and DPS Facilities

The Simplified Chinese Solaris Operating System includes the fonts listed in the following table.

Table 9–1 Simplified Chinese Solaris Operating System PostScript Fonts

Font Name 

Description 

Song-Medium 

Alias of Song-Medium-EUC; can be used like a Roman font. 

Song-Medium-EUC 

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

Kai-Medium 

Alias of Kai-Medium-EUC; can be used like a Roman font. 

Kai-Medium-EUC 

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

FangSong-Medium 

Alias of FangSong-Medium-EUC; can be used like a Roman font. 

FangSong-Medium-EUC 

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

Hei-Medium 

Alias of Hei-Medium-EUC; can be used like a Roman font. 

Hei-Medium-EUC 

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

The following figure shows a sample of the Song-Medium font.

The preceding context describes the graphic.

Creating Composite Roman and Simplified Chinese Fonts

You can create composite fonts using any a Roman font and any of the Simplified Chinese fonts. For example, the following PostScript code defines a composite font, Times-Italic+Kai-Medium. The Times-Italic is used for the ASCII characters and Kai-Medium font is used for the Simplified Chinese characters.

/makeEUCfont {
        /AsianFont exch def
        /WestFont  exch def
        /NewFont   exch def

        /CIDInit /ProcSet findresource 
        begin
          NewFont [ AsianFont WestFont ]
          beginrearrangedfont
            1 usefont
            1 beginbfrange
              <00> <7e>  <00>
            endbfrange
          endrearrangedfont
        end
  } bind def

  /LC_Times-Roman /Times-Roman /Kai-Medium makeEUCfont

Using Simplified Chinese Fonts in DPS Programming

You can use Simplified Chinese fonts just as you use Roman fonts in DPS wrap definitions. The following code sample creates the display in the Hello World figure.

	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
        	/Song-Medium cpSize selectfont
        	(text) stringwidth pop 2 div neg pointSize neg moveto
        	(text) show
	endps

You can call PSWDisplayText(Chinese text) in a C program to display the designated Chinese text.

Window shows the text Hello World in English and in Simplified Chinese characters.

The Simplified Chinese Solaris software provides TrueType support in DPS.

BDF to PCF Conversion

You must convert BDF fonts to PCF format to make the fonts usable in Simplified Chinese Solaris applications.

How to Convert BDF Fonts to PCF Format

  1. Use the bdftopcf command to convert a BDF font to PCF format.


    system% bdftopcf -o myfont14.pcf myfont14.bdf
    
  2. Replace the BDF file in the following directory with the converted PCF file: $OPENWINHOME/lib/locale/locale-name/fonts

How to Install and Check the Edited Font

  1. Compress the .pcf font file and move it to your font directory.


    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-gb2312.1980-0
    Myfont-Medium14
    ^D
    system% mkfontdir
    system% xset +fp `pwd`
    
  3. Use a command line such as the following to view your font.


    system% xfd -fn Myfont-Medium14
    

All Simplified Chinese fonts have XLFD font names. You can use the xlsfonts utility to display the font names.


system% xlsfonts | grep gb2312

Creating Characters With sdtudctool

The sdtudctool utility supports bitmap, Type 1, and CID fonts. This section contains instructions for using the sdtudctool to create, input, and print new characters for the Simplified Chinese locales in the following code ranges.

Table 9–2 Code Points for Locales

Locale 

Code Ranges 

zh 

0xD7FA-0xD7FE 

zh.GBK 

0xA140-0xA7A0 

0xAAA1-0xAFFE 

0xF8A1-0xFEFE 

zh_CN.GB18030 

0xA140-0xA7A0 

0xAAA1-0xAFFE 

0xF8A1-0xFEFE 

How to Use the sdtudctool

You can use the following procedure to create characters in the zh locale.

  1. To start the utility, type the following command:


    system% sdtudctool
    

    The following window appears.

    The preceding context describes the graphic.
  2. Click the Character button.

    The following dialog box appears:

    The preceding context describes the graphic.
  3. Specify the code position of the new character.

  4. Create the outline or bitmap for the character using the drawing tools.

  5. Click save from the file menu to save the character.

    The new character(s) are saved in $HOME/.Xlocale/{locale}/fonts/UDC..

How to Specify sdtudctool Options

  1. Choose options from the file menu.

    The options dialog box appears.

    The preceding context describes the graphic.
  2. Turn on the append font path option to append the UDC font aliases to your font path.

  3. Turn on save font path option to add the font files to the system font path.

    The new font files located in $HOME/.Xlocale/{locale}/fonts/UDC) will be listed in the $HOME/.OWfontpath file and made available to the X server the next time you log in.

    If Save Font Path is off, the font files will still be saved in $HOME/.Xlocale/{locale}/fonts/UDC, but will not be added to the system fontpath the next time you log in.

  4. Choose one or more of the following point sizes for the bitmap fonts: 12, 14, 16, 20, 24.

How to View a Character Reference

  1. To view the character reference, click the icon below the help menu.

    The following window appears.

    The preceding context describes the graphic.
  2. To close the window, click the icon again.

How to Register the UDC to the NewPinYin Input Method

  1. Choose save from the file menu or choose the open dictionary tool option from the file menu. The sdtudc_register tool panel appears.

    The preceding context describes the graphic.
  2. Input the PinYin in the reading column.

    The preceding context describes the graphic.
    Note –

    The only the valid PinYin can be registered to NewPinyin input method.


  3. Click Confirm button

    The following dialog box appears.

    The preceding context describes the graphic.
  4. The UDC and its PinYin will be registered in /var/tmp/newpyudc.txt. Click OK in the dialog to confirm

How to Type the New Characters

Use the NewPinyin or NeiMa input method to type the UDC's PinYin spelling for the characters you create.

  1. Type shan in NewPinyin mode.

    The preceding context describes the graphic.
  2. Type D7FA in GB NeiMa mode.

    The preceding context describes the graphic.

How to Print the New Characters

  1. Set the fontpath for mp utility.


    system% setenv UDC_BASE $HOME/.Xlocale/zh
    
  2. Print a text file which contains UDCs by specifying the configuration file for UDC.


    system% /usr/openwin/bin/mp -u/usr/lib/lp/locale/zh/mp/mp.conf.U\
     udc.txt > udc.ps
    

Changing Font Directories

The Xsession script in the /usr/dt/bin directory includes the following font path: /usr/openwin/lib/locale/locale/X11/fonts, where locale is either zh, zh.GBK, or zh_CN.GB18030. To dynamically add a different font directory path, type the following commands.


system% xset +fp font_directory-path
system% xset fp rehash

How to Add a Font Directory Path

    Before using the xset command, ensure that the fonts.dir file exists in the specified font directory. If fonts.dir does not exist, use mkfontdir to create the fonts.dir for the Bitmap font.

    Type the following commands to dynamically add a different font directory path.


    system% xset +fp font_directory-path
    system% xset fp rehash
    

Bitmap and TrueType Fonts

The tables in this section list the TrueType and bitmap fonts that are available for the zh_CN.EUC, the zh_CN.GBK, and the zh_CN.GB18030 locales.

The following table shows the TrueType fonts for the zhlocale.

Table 9–3 TrueType Fonts for the zh_CN.EUC Locale

Full Family Name 

Subfamily 

Format 

Vendor 

Encoding 

 Fangsong R TrueType Hanyi GB2312.1980
 Hei R TrueType Monotype GB2312.1980
 Kai R TrueType Monotype GB2312.1980
 Song R TrueType Monotype GB2312.1980

The following table shows the bitmap fonts for the zh locale.

Table 9–4 Bitmap Fonts for the zh_CN.EUC Locale

Full Family Name 

Subfamily 

Format 

Encoding 

 Song B PCF (14,16) GB2312.1980
 Song R PCF (12,14,16,20,24) GB2312.1980

Table 9–5 TrueType Fonts for the zh_CN.GBK Locale

Full Family Name 

Subfamily 

Format 

Vendor 

Encoding 

 Fangsong R TrueType Zhongyi GBK
 Hei R TrueType Zhongyi GBK
 Kai R TrueType Zhongyi GBK
 Song R TrueType Zhongyi GBK

The following table shows the bitmap fonts for the zh_CN.GBK locale.

Table 9–6 Bitmap Fonts for the zh_CN.GBK Locale

Full Family Name 

Subfamily 

Format 

Encoding 

 Song R PCF (12,14,16,20,24) GBK

The following table shows the TrueType fonts for the zh_CN.GB18030 locale.

Table 9–7 TrueType Fonts for the zh_CN.GB18030 Locale

Family Name 

Subfamily 

Format 

Vendor 

Encoding 

FangSong 

TrueType 

FangZheng 

GB18030–2000 

Song 

TrueType 

FangZheng 

GB18030–2000 

Hei 

TrueType 

FangZheng 

GB18030–2000 

Kai 

TrueType 

FangZheng 

GB18030–2000 

The following table shows bitmap fonts for the zh_CN.GB18030 locale.

Table 9–8 Bitmap Fonts for the zh_CN.GB18030 Locale

Family Name 

Subfamily 

Format 

Encoding 

Song 

PCF(12,14,16,20,24) 

GB18030–2000