This chapter describes the PostScript fonts included in the Simplified Chinese Solaris operating environment, what you need to use them, and how to edit them.
The Simplified Chinese Solaris operating environment provides PostScript fonts in the Display PostScript System (DPS). This section describes what you need to use DPS in Simplified Chinese Solaris software. For further details, see Programming the Display PostScript System with X, published by Adobe® Systems.
The Simplified Chinese Solaris operating environment includes the fonts listed in the following table. You can use any of the Simplified Chinese fonts just as you would use Roman fonts.
Table 7-1 Simplified Chinese Solaris Operating Environment 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 Song-Medium.
You can create composite fonts using any one Roman font and the Simplified Chinese fonts. For example, the following PostScript code defines a composite font, Times-Italic+Kai-Medium, which uses Times-Italic for ASCII characters and Kai-Medium font for 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
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 next 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. For an example see the following figure.
Simplified Chinese Solaris software provides TrueType support in DPS.
This section shows you how to edit or create and install new characters in Portable Compiled Format (PCF) format fonts used by the Simplified Chinese Solaris operating environment. You can then save your changes and use the edited font(s) on your local system. This process involves the following steps:
Preparing a workspace for the font(s) you edit or create.
Editing Bitmap Distribution Format (BDF) font file(s) with Font Editor.
Converting BDF font file(s) to PCF format.
Making the font(s) usable on your system.
Create a new directory workspace for editing fonts, for example:
system% mkdir /tmp/newfont |
Change your working directory to that directory:
system% cd /tmp/newfont |
The Simplified Chinese Solaris operating environment provides the Font Editor for editing bitmap fonts.
Start the Font Editor.
A Font Editor window is displayed.
system% fontedit |
Font Editor does not operate on PCF format font files (.pcf file extension), which are used by Solaris software. This tool handles only fonts in BDF, a portable format defined by the MIT X Consortium.
Locate the Simplified Chinese font file you want to edit in BDF format.
Its encoding should start at 8481 (0x2121). For example, say you have a BDF file such as myfont14.bdf:
STARTFONT 2.1 COMMENT Sample Font FONT Myfont-Medium14 SIZE 14 75 75... STARTCHAR C101 ENCODING 8481 ... |
Hold down the MENU mouse button on the Font Editor window's File button and select Load... on the pull down menu.
Type the name of the BDF file you want to edit, for example myfont14.bdf, in the Font Name field of the Load pop-up window.
Click SELECT on the Load button in the pop-up.
This loads the file.
Click SELECT on the Font Editor main window Select button.
This displays the Select window, where you do the following steps.
Type the high and low bytes of the font encoding code for the character you want to edit, for example 0x3302.
You can use the Next (right arrow) button or Previous (left arrow) button to increase or decrease the high or low byte.
Set Code Length to MultiByte for this Simplified Chinese font.
You would set Code Length to SingleByte for an ASCII/English font.
Click on the Edit button (in the Fontedit: Select window) to display the glyph on the main canvas.
The specified glyph appears in the Font Editor window.
Edit the glyph on the main canvas by turning pixels on/off:
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.
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.
When you finish editing the glyph, click SELECT on the Store button.
Repeat the preceding steps Step 5 through Step 9 to edit other glyphs in this font.
After you finish editing, hold down MENU on the File button and select Save... to save the edited glyph(s) in the font file.
Before applications can use the modified BDF file, it must be converted to a PCF format file.
Make the edited font usable by the Simplified Chinese Solaris operating environment by converting to X11 PCF format as follows:
system% bdftopcf -o myfont14.pcf myfont.bdf |
For more information, see the bdftopcf(1) man page.
To add a new bitmap, move the .pcf font file into your font directory. You may compress the .pcf font file before moving it to your font directory:
system% compress myfont14.pcf |
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` |
You can view your font using the X Font Displayer (xfd) by typing:
system% xfd -fn Myfont-Medium14 |
All Simplified Chinese fonts have XLFD font names, and you can use the xlsfonts utility to display these names as follows:
system% xlsfonts | grep gb2312 |
You can create new characters using the drawing tools in the sdtudctool utility. (For information on modifying a font, see "Editing Fonts With fontedit".) The new characters you create with sdtudctool can be saved in the five empty code positions between level-1 and level-2 Chinese characters (from 0xD7FA to 0xD7FE). The sdtudctool utility supports bitmap, Type 1, and CID fonts. You can also specify a font size for the new characters. This section contains procedures for using sdtudctool.
Currently sdtudctool supports only EUC locales, such as zh. This utility is therefore not available in the zh_GBK locale.
This section contains instructions for creating new characters with the sdtudctool utility.
To start the utility, type the following command:
system% sdtudctool |
The following window appears.
Click Character.
The following dialog box appears:
Specify the code position of the new character.
Create the outline or bitmap for the character using the drawing tools.
Click Save to save the character.
Continue creating new characters.
When you are finished, choose Save from the File menu to save the changes to your environment.
The new character(s) are saved in $HOME/.Xlocale/zh/fonts/UDC.
Choose Options from the File menu.
The Options dialog box appears.
Turn on Append Font Path to append the UDC font aliases to your font path.
Turn on Save Font Path to add the font files to the system font path.
The new font files (located in $HOME/.Xlocale/zh/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/zh/fonts/UDC, but will not be added to the system fontpath the next time you log in.
Choose one or more of the following font sizes (in points) for the bitmap fonts: 12, 14, 16, 20, 24.
To view the character reference, click the icon below the Help menu.
The following window appears.
To close the window, click the icon again.
To type the characters you created, use the Location code input mode (for more information, see "Location Code Mode ").