This section will teach you how to print Chinese documents, but without the demonstrations of how to set up your printer; that you have to make it all ready by yourself.
Tools introduced in this section are all for transformations to PostScript format; hence, you need to set your printer up in order to print PostScript files. If your printer doesn't support PostScript directly, you can install
ghostscript
instead.
Please refer to
Printing HOWTO.
cnprint
is a printing tool for the purpose of changing Chinese text files into PostScript format, of which commands are the same as the standard ones. It supports GB, HZ, and BIG5 codes simultaneously.
Download it from
ftp://ftp.ifcss.org/pub/software/unix/print
, of which name is cnprint280.tar.gz
.
cnprint280.tar.gz
contains only five files.
# ls
cnprint.1 cnprint.cmd cnprint280.README
cnprint.c cnprint.help
Compile it through this way below:
# gcc cnprint.c -o cnprint
# mv cnprint /usr/local/bin
# mv cnprint.1 /usr/local/man/man1
HBF fonts includes both description files and fonts files. A .hbf
is the header file describing fonts, with a texture of plain text, recording the file names of its fonts files.
Both of two files must be installed yourself. You can find them at
ftp://ftp.ifcss.org/pub/software/fonts/
.
If you want to use ccfs24.hbf
, for example, which is a sort of simplified Sung-imitated style font, you must obtain these three following files: ccfs24.hbf
, cclib.n24
and ccsym.24
.
In the ifcss fonts directory, 00index.txt
lists all HBF fonts' filenames.
Establish a specific directory to store HBF fonts, just like /usr/local/lib/chinese/HBF/
, for instance. Put all HBF description files and fonts files you've got together under this directory, then export the complete directory pathname for HBF out of environmental variables.
# export HBFPATH="/usr/local/lib/chinese/HBF/"
This file cnprint.cmd
contains some default values for cnprint
, that you have to fix them up to point to the HBF fonts you have installed, and then export it to $HBFPATH
.
# cp cnprint.cmd $HBFPATH
Now, you can use ``cnprint -w FILENAME
'' to change Chinese text files into PostScript files well. For more information in detail, take a look at man cnprint
yourself.
The cnprint 2.80
has been added a great deal of splendid abilities such as transformations amongst various code formats, for example, BIG5 <=> GB <=> HZ.
For BIG5 <=> GB, you need another tabulation for installing, though, which can be found from this following site:
ftp://ftp.ifcss.org/pub/software/unix/convert/hc.tabPut it under the fonts directory of HBF, and modify
cnprint.cmd
, adding this
DEFAULT_GBB5_TABLEFILE: /usr/local/lib/chinese/HBF/hc.tab
Not only, for BIG5 into GB codes, can the transformation of cnprint 2.80
against words to words be done, but also the work against phases to phases. However, cnprint
itself didn't offer the dictionary for transformations, that means that you have to create a dictionary yourself if you need one. Please refer to man cnprint
for more details.
The purpose of this small program is to make PostScript files, which could not pork Chinese out to output devices, available for Chinese output. For example, when Netscape is printing files, it will transport files into PostScript formats first; however, the outputs of PostScript won't load Chinese fonts so that the original parts of Chinese words will become disturbed codes to output. This program can read PostScript in, and replace the disturbed codes with corresponding words; afterwards pork the results out to the standard output devices, which the output data can send to the printer that can print PostScript documents.
Pick ps2cps up from this site:
ftp://linux.cis.nctu.edu.tw/packages/chinese/misc/ps2cps-0.1.tgz
Untar and unzip this file, and modify Makefile according to your demands:
BINPATH : Installing pathname for binary ps2cps
PS2CPSPATH : Resources files' pathname for PS2CPS
PS2CPSRC : Filename of resources files for PS2CPS
Next step is make all install
.
You have to install HBF Chinese fonts first according to the previous section, and then modify your ps2cpsrc
file:
HBF_PATH: Define the directory pathname of HBF fonts
HBF_NAME: Define filenames of HBF fonts(NOT including pathname)
CH_WORD_SHIFT: Define shift of Chinese fonts
The last item is used for adjustment of Chinese fonts' locations. Some Chinese fonts and the original English fonts may probably not locate on the same horizontal level line, so you can set this variable, of which numeric values ranging from -1.0 to +1.0, activated to adjust it up or down.
So, you can use that examples made from the founder to do some tests:
# ps2cps thhsieh.ps > c-thhsieh.ps
Use ghostview
to see whether you can see Chinese words or not.
However, this program is still under beta, there are so many problems waitting for resolving. If you have any questions or recommendations, you can send messages to the author directly: Tung-Han Hsieh < thhsieh@twclx.phys.ntu.edu.tw>.
This is another program which can transform BIG5-based Chinese files into PostScript available for printing(the same as cnprint). But because it uses the TrueType fonts, the output is more beautiful than others. In addition, it has a script which can transform PostScript out of Netscape into Chinese. The author is Chen-Shan Chin < cschin@u.washington.edu>.
Get this software from this web site:
http://weber.u.washington.edu/~cschin/bg2ps/
Decompress and compile it:
# mkdir bg2ps
# cd bg2ps
# tar xzvf bg5ps.tgz
# gcc -O2 ttf2psm.c -o ttf2psm
Install TrueType fonts next. You can install it under the same directory of bg2ps or can assign another directory for use. Refer to
Installing TTF fonts for more explanations.
Then create a .bg5ps.conf
under the directory, and you can pick directly up the sample file coming with this program to modify.
The most important is to assign the directory where you installed the TrueType fonts to chineseFontPath
, and rename the content of fontName
to the fonts name you used.
Test the sample coming with it, and view the output as ghostview
or gv
.
# ./bg5ps -if test.big5 -of test.ps
# ghostview test.ps
The nps2cps has no extra configuration files. You need to modify yourself chineseFontPath
and fontName
in nps2cps
script.
Test nps2cps:
# nps2cps < netscape.ps > test.ps
# ghostview test.ps
The gb2ps program is another tool for printing GB and HZ codes.
- Package:
gb2ps.2.02.tar.gz
ftp://ftp.ifcss.org/pub/software/unix/print
- Fonts:
csong24.ccf ckai24.ccf
cfang24.ccf chei24.ccf
ftp://ftp.ifcss.org/pub/software/fonts/gb/misc/
Put the fonts under certain self-established directory, just like /usr/local/lib/chinese/CFONT
.
Change the settings in Makefile
before compiling gb2ps.
CFONT=/usr/local/lib/chinese/CFONT/
COVERPAGE=/usr/local/lib/chinese/lib/cover.ps
Then type these commands and hit return key,
# make
# cp gb2ps /usr/local/bin