Traditional Chinese Solaris User's Guide

Part III System Administrator Information

This part includes system administrator information.

Chapter 7 Configuring a Traditional Chinese Solaris System

You can use the procedures this chapter to set a system-wide default locale or to add a new locale from the Solaris DVD and CD media. You also change the font path set by the Xsession script included in the Traditional Chinese Solaris operating system. This chapter includes the following sections.

Setting the Default Locale

This section describes methods to set the default locale.

How to Set a System-Wide Default Locale

  1. Become superuser.

  2. In the /etc/default/init file, add or update the LANG variable with the appropriate locale.


    LANG=locale
    

    You can set the LANG variable with one of the following locales: C, zh_TW, zh_TW.BIG5, zh_TW.UTF-8, zh_HK.BIG5HK, zh_HK.UTF-8

  3. Instruct all users to exit CDE.

  4. Kill the dtconfig process.


    # /usr/dt/bin/dtconfig -kill
    
  5. Reboot the system.


    # reboot
    

Using Aliases to Set the Locale

You can use aliases to change locales in a terminal window without typing long commands or editing your .dtlogin file and running source every time.

How to Set Up Locale Aliases for the Korn Shell

    Put aliases such as the following in your .profile file.


    alias twn_EUC "export LANG=zh_TW; /bin/stty cs8 -istrip defeucw"
    alias twn_BIG5 "export LANG=zh_TW.BIG5; /bin/stty cs8 -istrip \defeucw"
    alias asc "export LANG=C; /bin/stty cs7 istrip defeucw"
    alias twn_UTF-8 "export LANG=zh_TW.UTF-8; /bin/stty cs8 -istrip defeucw"

How to Set Up Locale Aliases for the C Shell

    Put aliases like the following in your .cshrc file.


    alias twn_EUC "setenv LANG zh_TW; /bin/stty cs8 -istrip defeucw"
    alias twn_BIG5 "setenv LANG zh_TW.BIG5; /bin/stty cs8 -istrip \defeucw"
    alias asc "setenv LANG C; /bin/stty cs7 istrip defeucw"
    alias twn_UTF-8 "setenv LANG=zh_TW.UTF-8; /bin/stty cs8 -istrip defeucw"

Chapter 8 Managing the Input Method Server

This chapter describes the basic display features of the input method server. The input method server (IM server) handles Traditional Chinese input for Traditional Chinese Solaris software. The IM server receives keyboard input and makes the input available as Traditional Chinese characters to Traditional Chinese Solaris applications. The IM server can serve any internationalized X Window application that uses X Window Input Method (XIM) application program interfaces (API) to receive language input.

This chapter discusses the following topics:

Input Method Server Basic Properties

The Traditional Chinese Solaris operating system starts the IM server automatically when you start the Solaris operating system in a locale that requires an input method. The IM server continues to run and service applications that are started and connected to it.

Traditional Chinese Solaris applications that use the IM server for Traditional Chinese character input typically find the IM server running when they start. To user the IM server's service for language input, the IM server should be running before an application is started. If the IM server is not running when an application is started, the application might not be able to get the input service even if IM server is started later.

htt Processes

The input method server comprises three related processes running together. The processes are htt, htt_xbe, and htt_server. One process controls the input method server properties, another controls the population of the input method server (that is, a “watchdog” process), and the third handles input methods of clients.

Usually, you don't need to know the details of these three processes. When htt is started, htt_xbe and htt_server are started automatically.

How and When htt Is Started

The htt process must be running before an application starts in order for the application to use the htt input method server to receive Traditional Chinese input. The C locale does not require htt. If you change the default locale from C to another locale that requires htt, you must start htt in the same terminal window. You can start htt with a command such as the one shown in the following example.


system% /usr/openwin/bin/htt -if twle -xim htt_xbe &

When the locale is set to zh_TW or zh_TW.BIG5, htt is started automatically when the Traditional Chinese windowing environment starts. In CDE, htt is started from the /usr/dt/config/Xsession.d/0020.dtims script. This script is executed by Xsession, which runs at every initialization stage upon a user's login from dtlogin. This script ensures that htt is started before other applications in CDE.

Using the iiim Server in zh_TW.UTF-8 Locale

The Internet Intranet Input Method Server (iiim) supports both European local input methods using Compose key and Asian remote input methods using the IIIM Protocol. The default language engine is English/European, which supports ASCII and some European Languages such as German and French.

To switch to other language engines, press Control-spacebar, as with other Asian locales.

To switch to Chinese input methods, click the left mouse button in the status aea. The following list of language engines appears:

The following language engines appear if their corresponding locales are installed:

After the Traditional Chinese language engine is selected, you can use function keys to switch between different input methods:

For more detailed information about each input method, see Chapter 4, Entering Traditional Chinese Text.

Chapter 9 Fonts

This chapter describes the PostScript, TrueType and bitmap fonts supported for use in the Traditional Chinese Solaris operating system. The topics in this chapter discuss how to use and to edit the fonts:

Display PostScript System (DPS)

The Traditional 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 Traditional Chinese PostScript Fonts and DPS Facilities

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

Table 9–1 Traditional Chinese DPS Fonts

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 

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

 Kai-Medium and Ming-Light fonts

Creating Composite Roman and Traditional Chinese Fonts

You can create composite fonts with a 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. The Times-Italic font is used for the ASCII characters and the Kai-Medium horizontal font is used for the 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 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
			/Kai-Medium cpSize selectfont
			(text) stringwidth pop 2 div neg pointSize neg moveto
			(text) show
endps

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

Hello World displayed with Chinese text equivalent

The Traditional Chinese Solaris software provides TrueType support in DPS.

How to Convert from BDF to PCF Format

Before Solaris applications can use a modified BDF file, the file must be converted to a PCF format file.

  1. Use a command line such as the one in the following exa,ple to convert the BDF file to PCF format.


    system% bdftopcf -o myfont14.pcf myfont14.bdf
    

    The -o option enables the matrix encoding used for Asian PCF font files.

  2. Replace the BDF file in the following directory with the converted PCF file: $OPENWINHOME/lib/locale/zh_TW/fonts

How to Install and Check the Edited Font

  1. To add a new bitmap, move the .pcf font file into your font directory.


    Tip –

    You can use a command such as the following to compress the .pcf font file before you move it:


    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 use a command such as the following example to view your font.


    system% xfd -fn Myfont-Medium14
    

Changing Font Directories

The Xsession script in the /usr/dt/bin directory includes the font path /usr/openwin/lib/locale/locale/X11/fonts, where locale is either zh_ZW, zh_ZW.BIG5, or zh_ZW.UTF-8. To dynamically add a different font directory path, type the following commands:


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

TrueType and Bitmap Fonts

The tables in this section list the TrueType and bitmap fonts that are available for the zh_TW and the zh_HK.BIG5HK locales.

The following table shows the Traditional Chinese TrueType Fonts for the zh_TW locales.

Table 9–2 Traditional Chinese TrueType Fonts for the zh_TW Locales

Full Family Name 

Subfamily 

Format 

Vendor 

Encoding 

 Hei R TrueType Hanyi CNS11643.1992
 Kai R TrueType Hanyi CNS11643.1992
 Ming R TrueType Hanyi CNS11643.1992

The following table shows the Traditional Chinese bitmap fonts for the zh_TW locales.

Table 9–3 Traditional Chinese Bitmap Fonts for the zh_TW Locales

Full Family Name 

Subfamily 

Format 

Encoding 

 Ming R PCF (12,14,16,20,24) CNS11643.1992

The following table shows the TrueType fonts for the zh_HK.BIG5HK locale.

Table 9–4 TrueType Fonts for the zh_HK.BIG5HK Locale

Family Name 

Subfamily 

Format 

Vendor 

Encoding 

Ming 

TrueType 

FangZheng 

BIG5–HKSCS 

Hei 

TrueType 

FangZheng 

BIG5–HKSCS 

Kai 

TrueType 

FangZheng 

BIG5–HKSCS 

The following table shows the bitmap fonts for the zh_HK.BIG5HK locale.

Table 9–5 Bitmap Fonts for the zh_HK.BIG5HK Locale

Family Name 

Subfamily 

Vendor 

Format 

Ming 

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

BIG5–HKSCS 

Chapter 10 Traditional Chinese Printing Facilities

This chapter describes how to print to a line printer. The chapter also provides information on how to use the mp utilities to print to a PostScript printer or to a line printer.

Printing From th Command Line

From the command line, you can print one of two ways:

Printing With a Line Printer

The Traditional Chinese Solaris operating environment uses EUC code sets. Its printing applications (such as desktop tools) generate PostScript code that uses EUC. If you use different PostScript printing, make sure it has the same capabilities.

Printing With the mp Utility

As a print filter, mp generates a properly formatted version of contents in PostScript format. The PostScript output file contains glyph images from Solaris-resident scalable or bitmap fonts, depending on each locale's system font configuration for mp. The mp filter is enhanced in the current Solaris release to print files with different encoding text in the corresponding Asian locales.

The following command line will print a file containing Traditional Chinese characters, with or without ASCII/English characters:


system% mp -L $LANG filename | lp -d printer

The file may contain ASCII/English characters as well as Traditional Chinese. Refer to the mp(1) man page for more detailed information.

You can use the mp utility as a filter because mp accepts the stdin stream.


system% cat filename | mp | lp

You can set the utility as a printing filter for a line printer. For example, the following command sequence tells the printer service LP that the printer lp1 accepts only mp format files. This command also installs the printer lp1 on port /dev/ttya. See the lpadmin(1M) man page for more details.


system% lpadmin -p lp1 -v /dev/ttya -I MP
system% accept lp1
system% enable lp1 

You can add the lpfilter utility for a filter by using the lpfilter(1M) command as follows:


system% lpfilter -f filtername -F pathname

The lpfilter command tells lp that a converter (in this case, xutops) is available through the filter description file named path name. The pathname can be determined as follows:


Input types: simple
Output types: MP
Command: /usr/bin/mp 

The filter converts the default type file input to PostScript output using/usr/bin/mp.

To print a UTF-8 text file, use the following command:


system% lp -T MP UTF-8-file

For more details on the mp command, refer to the mp(1) man page.

Using mp as an Xprt (X Print Server) Client

When used as an Xprt client, mp can print the output of any printer connected to a network supported by an Xprt print service. As an Xprt client, mp supports PostScript and many versions of PCL.

The Xprt client attempts a connection to an Xprt server based on the following rules:

Chapter 11 TTY Environment and Support

This chapter assumes you are familiar with the following concepts:

Refer to the termio(7I) man page for background information on STREAMS and TTY drivers.

This chapter discusses the following tops:

TTY Streams

The data path between a user's shell and the terminal is called a stream. The data on a stream contain characters and control information that affect data handling, such as the control sequences that precede a change in code set or communication protocols. Data entering the stream from the terminal is raw or unprocessed. Data is sequentially processed by STREAMS modules for appropriate use by the shell or an application.

STREAMS provides a way to modularize the processing on a line, allowing processing instructions to be grouped in functional modules. These modules can be added or removed from the line so that different environments can be provided to a terminal according to the user's needs.

Traditional STREAMS

The traditional STREAMS TTY environment contains a raw device driver, a line discipline module, and a stream head. The raw device driver provides an I/O interface between the kernel and the hardware. Because the driver is closest to the physical hardware, it provides basic communication protocols, baud rate switching, and other low level services. The line discipline module is a set of instructions or disciplines that transforms the raw data to processed data. This module includes handling the delete character, line kill character, and others. The stream head provides an interface between the user's process and the stream.

Traditional Chinese Solaris STREAMS

The Traditional Chinese Solaris Operating System uses the modular nature of STREAMS to support Traditional Chinese. In addition to the traditional TTY modules, this product implements code conversion in STREAMS. Chinese input is typically supplied by many existing Traditional Chinese TTYs and is not available in the Traditional Chinese Solaris TTY environment.

The Traditional Chinese Solaris Operating System enhances the traditional modules. Its line discipline handles proper cursor movement for wide characters as well as normal protocols. The Traditional Chinese Solaris software code conversion modules convert between two different character code formats, such as between BIG5 and EUC.

Code conversion depends on the appropriate flags or parameters being set. For example, if a BIG5 code terminal is being used, the input from the terminal is converted to EUC and the output to the terminal is converted to BIG5 code.

The major modules that can be pushed onto the stream are ldterm and big5euc.

TTY Utilities

ioctl (input/output control) calls are low-level routines for handling device input and output.

The termcap and terminfo databases are used by applications to configure their terminal display appropriately.

EUC ioctl Features

The Traditional Chinese Solaris Operating System uses ioctl STREAMS commands for general EUC handling. The following is a summary of these ioctl calls and their effects:

EUC_WGET

Get cswidth values from TTY stream

EUC_WSET

Set cswidth values for TTY stream

EUC_OXLOFF

Set code conversion to OFF

EUC_OXLON

Set code conversion to ON

Character code conversion to and from the terminal is controlled by EUC_OXLON and EUC_OXLOFF.

termcap and terminfo Databases

termcap and terminfo are the databases used to tailor the terminal characteristics for an application.

The following table lists extensions to the termcap database:

Table 11–1 ioctl Requests and Descriptions

Variable 

Description 

dv

Device type: language and code set 

ci

Init sequence for multiple code sets  

s0

Shift into code set 0 

s1

Shift into code set 1 

s2

Shift into code set 2 

s3

Shift into code set 3 

The following table lists extensions to terminfo. The s0-s3 string values are used as data announcement mechanisms for the respective code sets during terminal I/O.

Table 11–2 terminfo Variables and Descriptions

Variable 

Capname 

Tc 

Description 

device_type

devt

dv

Device type: language and code set  

code_set_init

csin

ci

Init sequence for multiple code sets  

set0_des_set

s0ds

s0

Shift into code set 0  

set1_des_set

s1ds

s1

Shift into code set 1  

set2_des_set

s2ds

s2

Shift into code set 2  

set3_des_set

s3ds

s3

Shift into code set 3  

TTY Commands

The two commands for configuring and using the TTY environment are setterm and /bin/stty. setterm is used primarily to build the TTY stream for a particular terminal type, pushing the necessary modules onto the stream. stty changes the behavior of the modules in the stream.

setterm Command

The setterm command is used to configure the TTY STREAMS environment. This command can inquire about and manipulate STREAMS modules for a particular TTY port. The setterm command enables users to tailor their TTY STREAMS environment using system-provided or user-provided STREAMS modules.

The setterm command uses a terminal device name that reflects the devt (device type) field in the terminfo database for configuring STREAMS modules for a TTY port. The device name is matched with an entry of the same name in the setterm configuration file, /usr/share/lib/setterm/zh_TW/conf.file. This entry contains detailed instructions on which modules to pop and push in order to properly configure the STREAMS environment.

The setterm command can also take the device type as a direct argument. The device type is similarly matched with an entry in /usr/share/lib/setterm/zh_TW/conf.file.

The setterm configuration file uses a special language for instructions on what actions to take. This language enables users to determine the names of modules on the STREAMS stack, to push or pop modules on the stack, and to do other operations. manipulates the STREAMS stack by making ioctl calls.

The Traditional Chinese Solaris Operating System provides special modules to enable or disable code conversion and to properly handle multibyte and wide characters. Pushing a module onto the stack enables the corresponding conversion. The default state for conversion is enabled.

For more information, see the setterm(3CURSES) man page.

/bin/stty Command

The -defeucw option to the /bin/stty command is used to modify STREAMS modules to reflect changes in the user's environment. The option does not work with a /usr/ucb version of stty, which has not been internationalized.

The following command queries the user's environment for information on EUC code set width and sets that information in the line discipline:


system% /bin/stty defeucw

For example, if the user has the environment variable LC_CTYPE set to locale, this option gets information on the number of bytes per character and the screen width per character for the code sets in the zh_TW environments. The option then sends this information to relevant modules in the stream.

TTY Setup Examples

The system administrator can add setterm in the startup script in /etc/rcn.d directory (where n is the run level) to run at the system boot time. Also, users can run the setterm command at login to configure the stream for their terminal, including the appropriate modules for Traditional Chinese input code conversion. The following examples using setterm can be run as commands typed at a system prompt or included in system files such as .cshrc, .login, and the startup script. Such commands can either explicitly set the device type or use the terminfo database.

Configuring STREAMS for Traditional Chinese Solaris Software

Use the following command to explicitly configure the STREAMS module for a BIG5 terminal use.


setterm -x big5

This usage is independent of terminfo.

You can use a VT-100 terminal, which is BIG5 compatible, on a system with an entry such as the following example in the terminfo database:


vt100-b|VT-100-compatible with Big-5 chars,
lines#40, .csin=E(BE)IE[?1h, csin=E(BE)I, devt=PACKBig5,
s0ds=E(H, s1ds=E$@, s2ds=E(H, use=cit600,

Use the following configuration command to reference the VT-100 entry:


setterm -t vt100-b

For setterm to work properly in this application, /usr/share/lib/setterm/zh_TW/conf.file must contain an entry that corresponds to the device type. An entry such as the following example instructs setterm to place the appropriate conversion modules in the TTY stream.


#
big5throw \
			popto zs|mcp|mti|ptem \
			push big5euc \
			push ldterm \
			push ttcompat \
			run {stty defeucw} \
			catch
#
GenericEUC|EUCthrow \
			popto zs|mcp|mti|ptem \
			push ldterm \
			push ttcompat \
			run {stty defeucw} \
			catch
#
ASCIIthrow \
			popto zs|mcp|mti|ptem \
			push ldterm \
			push ttcompat \
			catch
#

Once configured, conversion is enabled by default. Applications can also set features through ioctl() function calls.

Terminal Support

The Traditional Chinese Solaris Operating System supports BIG5 terminals. The terminals should have built-in Traditional Chinese fonts and input methods.

Installing a Terminal

If you have not added a terminal to your system, install the terminal in ASCII mode only.

How to Add Terminals Through the Serial Port Interface

You can use the serial ports option from the Admintool menu to configure the serial ports for terminals. Serial ports provide the easiest means to install a terminal.


Note –

A Chinese terminal that supports CNS 11643 is installed as you would install an ASCII terminal.


  1. Become superuser.


    system% su
    
  2. Type admintool.

    The admintool menu will appear.


    system# admintool
    
  3. Select the Serial Ports icon.

  4. Select Edit on the Serial Ports menu.

    Modify Service submenu appears.

  5. On the Modify Service submenu, select Enabled, Baud Rate 9600, and provide the terminal type.

    setting the terminal type and baud rate
  6. Under Expert Options, select Create utemp entry and enter the appropriate module in the Streams Modules field.


    Note –

    To install a terminal that supports BIG5 code for the Traditional Chinese Solaris Operating System, add big5euc to the Streams Modules field.


    create utemp entry and specify streams module

How to Add Terminals Through the Command Line

The following procedure is required to set up a terminal on ttya port through the command line.

  1. Determine the port monitor version number by typing the following command:


    # ttyadm -V
    

    The port monitor version number displays.

  2. Type the following commands, substituting the port monitor version number for ver.


    # pmadm -r -p zsmon -s ttya
    # sacadm -a -p zsmon -t ttymon -c /usr/lib/saf/ttymon -v ver
    

    For more information, see the pmadm(1M) and sacadm(1M) man pages.

  3. To add a login service, use the pmadm command that matches your terminal type.

    • For EUC terminals, use the following command.


      #pmadm -a -p zsmon -s ttya -i root -fu -v ver -m “ `ttyadm -S y \
        -T terminal_type -d /dev/ttya -l 9600 -m ldterm,ttcompat -s \
        /usr/bin/login`”
      
    • For BIG5 code terminals, use the STREAMS module big5euc in the ttyadm command.


      # pmadm -a -p zsmon -s ttya -i root -fu -v ver -m “`ttyadm -S y \ 
        -T terminal_type -d /dev/ttya -l 9600 -m big5euc,ldterm,ttcompat -s \
        /usr/bin/login`”
      

  4. Turn on the terminal.

    Familiarize yourself with the documentation that accompanies the terminal.

  5. Log in to the terminal.

  6. Check to see that the installation is correct.


    # setenv LANG locale
    # /bin/stty cs8 -istrip  defeucw
    

    Note –

    These values show that the operating system is set to communicate with the terminal in 8-bit no-parity mode. Make sure the terminal is set up in 8-bit no-parity mode. Refer to the terminal's setup manual for the proper way to set terminal options.


Setting a User's TTY

Do the following to verify that your TTY is set up properly.

  1. Type the /bin/stty command with the -a option.


    system% /bin/stty -a
    
  2. If the cs8, -istrip values are not listed, use the following command to set them.


    system% /bin/stty cs8 -istrip defeucw
    

    This is the last step in setting up a terminal.

How to Use a BIG5 TTY With an EUC Locale

  1. If you are using a BIG5 type terminal, you must run the following command as superuser to load the STREAMS module into the kernel.


    # modload /kernel/strmod/big5euc
    
  2. Type the following command.


    system% setterm -x big5