Asian Application Developer's Guide

Using Simplified Chinese PostScript Fonts and DPS Facilities

Simplified Chinese Solaris operating environment DPS provides the Simplified Chinese fonts listed in Table 6-2.

Table 6-2 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 

Song-Medium-H 

Song-Medium font, horizontal display, to make a composite font with a Roman font 

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

Figure 6-3 Sample Simplified Chinese Text Display PostScript Output

Graphic

Creating Composite Roman and Simplified Chinese Fonts

You can create composite fonts using any one Roman font and the Simplified Chinese Song-Medium-H font. For example, the following PostScript code defines a composite font, Times-Italic+Song-Medium, which uses Times-Italic for ASCII characters and Song-Medium horizontal font for Simplified Chinese characters:

/Times-Italic+Song-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
                	/Song-Medium-H findfont
        	] def
	currentdict
	end
	definefont pop

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 sample code creates the display in Figure 6-4:

	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 Figure 6-4.

Figure 6-4 Using Simplified Chinese Solaris Operating Environment DPS

Graphic

Simplified Chinese Solaris software provides TrueType support in DPS.