tool:bg5ps 

Info 

High quality true type font ps printing tool.

Usage 

bg5ps -if file.sample.cc.big5 -of $tf.ps
bg5ps -en gb2312 -if file.sample.cc.gb2312 -of $tf.ps
mpage file.sample.cc.gb2312 | bg5ps -en gb2312 -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -nps y > $tf.ps
gv $tf.ps &
gv -swap $tf.ps &

Description 

Bg5ps uses the ttf2ps program to convert the Big5 Coding chinese text into a printable postscript file. Since it uses true type font, the quality is much better than using bitmap fonts.

Comments 

There is a footnote, "printed by bg5ps" or something, which can be annoying. This can be circumvented by using mpage. NB using pipe like the following won't help:

cat file.sample.cc.gb2312 | bg5ps > $tf.ps

Help 

Quick Help 

$ bg5ps -h
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

bg5ps -fp fontpath -fn fontname
      -o [1|0] -e [1|0]
      -s size -ls linespacing -cs charspacing
      -tm topMargin -bm bottomMargin -lm leftMargin -rm rightMargin
      -if inputfile -of outputfile
      -cf configFile
      -en encoding
      -nps y/n

Size, linespacing, charspacing, and margins are
numbers in unit of pt(1 pt=1/72 in).

encoding can be big5 or gb2312.

bg5ps -h: print this help
bg5ps -nps y: toggle netscape or mpage mode

Run as a filter:
cat big5text | bg5ps options > outputfile

Examples:

bg5ps -en big5 -fn ntu_kai -o 1 -e 0 -s 15 -ls 10 -cs 2 -tm 72 -bm 72 -if test -of test.ps

cat netscape.ps | bg5ps -en big5 -nps y -fn ntu_kai > test.ps

mpage -2 big5.txt | bg5ps -en big5 -nps y > test.ps

Detail Help 

Available at /usr/share/doc/bg5ps-1.3.0/html/bg5ps.html

Under Debian 

zcat /usr/share/doc/bg5ps/examples/netscape.ps.gz | bg5ps -en big5 -nps y > $tf.ps

1<<, >>

bg5ps -en gb2312 -if file.sample.cc.gb2312 -of $tf.ps

Note, RedHat has prepared etc/bg5ps.conf.zh_CN* files. So:

/etc/bg5ps.conf.zh_CN found. Use configuration file /etc/bg5ps.conf.zh_CN

While debian not, so have to specify '-en gb2312', otherwise:

$ LANG=zh_CN.gb2312 bg5ps -if file.sample.cc.gb2312 -of $tf.ps
No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf found. Use configuration file /etc/bg5ps.conf
running /usr/bin/ttf2psm -b /usr/share/fonts/truetype/arphic/bsmi00lp.ttf < /tmp/tmpK4p2yT

2<<, >>

sed 's/\(Encoding=\).*$/\1"gb2312"/' < /etc/bg5ps.conf > /etc/bg5ps.conf.zh_CN
diff /etc/bg5ps.conf /etc/bg5ps.conf.zh_CN
cd /etc
lns bg5ps.conf bg5ps.conf.zh_TW
lns bg5ps.conf bg5ps.conf.zh_TW.Big5
lns bg5ps.conf.zh_CN bg5ps.conf.zh_CN.GB2312

then,

LANG=zh_CN bg5ps -if file.sample.cc.gb2312 -of $tf.ps

Nope, it doesn't work.

 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf found. Use configuration file /etc/bg5ps.conf
running /usr/bin/ttf2psm -b /usr/share/fonts/truetype/arphic/bsmi00lp.ttf < /tmp/tmpTqLvKk

So, guys at RedHat has really did some nice works on bg5ps.

rm bg5ps.conf.zh_*

Under RedHat 

Usage 

bg5ps -if file.sample.cc.big5 -of $tf.ps
LANG=zh_CN bg5ps -if file.sample.cc.gb2312 -of $tf.ps
mpage file.sample.cc.gb2312 | bg5ps -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -nps y > $tf.ps
gv $tf.ps &
gv -swap $tf.ps &

Version 1.3.0 (1.1b2) 

bg5ps-1.3.0-12.i386.rpm

Test Run 

tf=…

gb text printing 

Summary, to use bg5ps to print GB, LANG should be set to zh_CN.

Under GB Environment

$ bg5ps -if file.sample.cc.gb2312 -of $tf.gb.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf.zh_CN found. Use configuration file /etc/bg5ps.conf.zh_CN
running /usr/bin/ttf2psm -g /usr/share/fonts/zh_CN/TrueType//gbsn00lp.ttf < /tmp/@4000.0

Totally 233 different Chinese characters have been processed.

2 of 2 pages postscript file has been generated.

gv $tf.gb.ps &

OK!

Not Under GB Environment

bg5ps -en gb2312 -if file.sample.cc.gb2312 -of $tf.gb.ps
Error: Font file /usr/share/fonts/zh_TW/TrueType//gbsn00lp.ttf not found.
LANG=zh_CN bg5ps -if file.sample.cc.gb2312 -of $tf.gb.ps
big5 text printing 

Summary, to use bg5ps to print big5, LANG can either by C or zh_TW, just not zh_CN.

$ bg5ps -en big5 -if file.sample.cc.big5 -of $tf.bg5.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf.zh_CN found. Use configuration file /etc/bg5ps.conf.zh_CN
Error: Font file /usr/share/fonts/zh_CN/TrueType//bsmi00lp.ttf not found.

Changed to LANG=zh_TW environment and run again:

$ bg5ps -en big5 -if file.sample.cc.big5 -of $tf.bg5.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf.zh_TW found. Use configuration file /etc/bg5ps.conf.zh_TW
running /usr/bin/ttf2psm -b /usr/share/fonts/zh_TW/TrueType//bsmi00lp.ttf < /tmp/@4020.0

Totally 233 different Chinese characters have been processed.

2 of 2 pages postscript file has been generated.

gv $tf.bg5.ps &

NB, it is also ok when LANG=C:

$ bg5ps -if file.sample.cc.big5 -en big5 -of $tf.bg5.ps
bg5ps version:1.1b2
Copyright (C) 1998  Chen-Shan Chin
bg5ps comes with ABSOULETY NO WARRANTY, see GNU General Public License for detail.

No configuration file option is given.
 Trying ~/.bg5ps.conf
~/.bg5ps.conf not found.
 Trying /etc/bg5ps.conf.
 /etc/bg5ps.conf found. Use configuration file /etc/bg5ps.conf
running /usr/bin/ttf2psm -b /usr/share/fonts/zh_TW/TrueType//bsmi00lp.ttf < /tmp/@4231.0

Totally 233 different Chinese characters have been processed.

2 of 2 pages postscript file has been generated.

mpage file.sample.cc.big5 | bg5ps -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -s 8 -nps y > $tf.ps
mpage file.sample.cc.big5 | bg5ps -s 15 -nps y > $tf.ps

char size are the same. They are controlled by mpage!

to pdf 
ps2pdf  $tf.gb.ps  $tf.gb.pdf
xpdf $tf.gb.pdf &

The outcome is much worse than the .ps version, viewed at 400% level at both side.

documented on: 2004.03.10

Print man pages 

whereis rsync
cp /usr/share/man/man1/rsync.1.bz2 .
bzip2 -d rsync.1.bz2
man2html rsync.1
cp /usr/share/man/man5/rsyncd.conf.5.bz2 .
bunzip2 rsyncd.conf.5.bz2
man2html rsyncd.conf.5
bunzip2 *.bz2
tong@sunny:~/s/tmp/tpr/e$ ls -1 | perl -S doeach.pl man2html @_ @g ../@_.html

Test History 

documented on: 2001.01.23

pkg:chpfb 

Info 

Chinese PostScript Fonts Utilities

newest version of chpfb 

ftp://ftp.ihep.ac.cn/pub/chinese/packages/chpfb-x.x.tar.gz

Description 

This package includes a set of Chinese PostScript fonts and some small utilities helping you generate Chinese PostScript files. It also includes some hints on establishing a printer queue that uses Ghostscript as the PostScript filter. After easy installation, you may get an Chinese-enabled Ghostscript through which you can view and print Chinese files.

Features 

/usr/bin/a2b5ps
/usr/bin/a2gbps
/usr/bin/b5pfb
/usr/bin/gbpfb
/usr/bin/jy2gbps
/usr/bin/mktlcpfb
/usr/bin/ns2b5ps
/usr/bin/ns2gbps
/usr/bin/t1asm
/usr/bin/ttf2pfb
/usr/bin/txt2b5ps
/usr/bin/txt2gbps

Examples 

Examples are under /usr/doc/chpfb-1.3.1/examples. They are actually .ps files. The .gps denote that it is a GB ps file; whereas .bps means that it is a big5 ps file.

All files are straight text files, i.e., if viewing using Ghostscript that does not yet support Chinese, the Chinese are just code. Viewing properly configured Ghostscript, they will be chinese.

gbk.gps a complete list of all characters in GB 13000-1993(GBK) character set, converted from a text file using 'txt2gbps'

big5.bps a complete list of all characters in BIG5 character set, converted from a text file using 'txt2b5ps'

demo.gps a demonstration of Chinese(GB) PostScript fonts

demo.bps a demonstration of Chinese(BIG5) PostScript fonts

Help 

to write PostScript files 

If you know something about PostScript language, you will find that using Chinese PostScript fonts is just like using ASCII PostScript fonts. Here is a small example:

      $ gs
      Aladdin Ghostscript 5.10 (1997-11-23)
      Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA.  All rights reserved
.
      This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>/GB-Song-Regular 24 selectfont
Loading GB-Courier-Oblique font from /usr/share/ghostscript/fonts/GB-Courier-Oblique.ps... Loading NimbusMonL-ReguObli font from /usr/share/fonts/default/Type1/n022023l.pfb... 3843008 2230411 2241968 618538 0 done.
Loading GB-FangSong font from /usr/share/ghostscript/fonts/GB-FangSong.ps... 3843008 2233875 2784560 920153 0 done.
3843008 2233875 2784560 919802 0 done.
GS>100 600 moveto
GS>put some Chinese in here ____ show
Loading GB-Songcf font from /usr/share/ghostscript/fonts/gbsongcf.pfb... 3263656 1735110 2241968 671186 0 done.
Loading GB-Songcd font from /usr/share/ghostscript/fonts/gbsongcd.pfb...
...
Loading GB-Songc9 font from /usr/share/ghostscript/fonts/gbsongc9.pfb...
GS>/GB-Courier-Oblique 16 selectfont
Loading GB-Courier-Oblique font from /usr/share/ghostscript/fonts/GB-Courier-Oblique.ps... Loading NimbusMonL-ReguObli font from /usr/share/fonts/default/Type1/n022023l.pfb... 3843008 2230411 2241968 618538 0 done.
Loading GB-FangSong font from /usr/share/ghostscript/fonts/GB-FangSong.ps... 3843008 2233875 2784560 920153 0 done.
3843008 2233875 2784560 919802 0 done.
GS>100 130 moveto
GS>put more Chinese in here ____ show
Loading GB-FangSongd2 font from /usr/share/ghostscript/fonts/gbfsd2.pfb... 3943488 2332334 2784560 927668 0 done.
Using GB-Songd2 font for GB-FangSongd2.
Loading GB-FangSongbc font from /usr/share/ghostscript/fonts/gbfsbc.pfb... 40439
...
Loading GB-FangSongd6 font from /usr/share/ghostscript/fonts/gbfsd6.pfb... 4566464 2941041 2804656 890421 0 done.
Using GB-Songd6 font for GB-FangSongd6.
GS>300 100 moveto
GS>(\320\273)show <b4f3bcd2>show

In the string before "show" operator, you may use character codes (octal) or hexadecimal encoding of a Chinese character, as well as the character itself.

Chinese PostScript fonts support unconditionally mixed use of ASCII and Chinese characters. If you used Times-Roman before, you may now simply use GB-Times-Roman or BIG5-Times-Roman, just so so.

Fixed fonts are designed as such that the width of Chinese characters are exactly two times of the width of ASCII characters. So you may use them to keep regularity of ASCII and Chinese characters.

to view and print PostScript files containing Chinese saved by netscape 

The small shell scripts scripts/{ns2gbps, ns2b5ps} can be used to modify PostScript files containing Chinese characters saved by netscape and generate new Chinese PostScript files that can be viewed by Chinese-enabled Ghostscript. If you save a WWW page that contains Chinese GB characters to a file page.ps, you may use scripts/ns2gbps as this:

lark% ns2gbps page.ps > page.gps

The Chinese PostScript file page.gps can be viewed by Chinese-enabled Ghostscript.

If you use Ghostscript as input PostScript file filter of your printer, you can directly send the modified Chinese PostScript file to your printer:

lark% lpr page.gps
Tip !!
mpage file.sample.cc.gb2312 | bg5ps -nps y > $tf.ps
gv -swap $tf.ps -scale 2

ok!

mpage file.sample.cc.gb2312 > $tf-1.ps
ns2gbps $tf-1.ps > $tf-2.ps
gv -swap $tf-2.ps -scale 2

to print plain Chinese text files 

The small shell scripts scripts/{txt2gbps,txt2b5ps} can be used to convert a plain Chinese text file to a Chinese PostScript file. By default, txt2gbps uses a fixed font GB-Song-Fixed, txt2b5ps uses a fixed font BIG5-Ming-Fixed, you may specify other font using "-fn" option, e.g.

lark% txt2gbps -fn GB-Kai-Fixed report.txt > report.gps

Note*: txt2gbps and txt2b5ps don't wrap long lines of texts. So if you have a text file whose paragraphs don't break into lines, you may have to wrap them yourself before you apply txt2gbps and txt2b5ps.

The small shell scripts scripts/{a2gbps, a2b5ps} uses the program 'a2ps' to convert plain text files to Chinese PostScript files. They accept all parameters of a2ps but redirects output to stdout, e.g.

lark% a2gbps -4 report.txt > report.gps

If you use Ghostscript as input PostScript file filter of your printer, you can directly send the Chinese PostScript file report.gps to your printer.

with CJK enhancement to LaTeX2e 

All 126 x 4 = 504 TFM files generated by 'gbpfb' are to be used as 'pmC' font encoding in your Chinese LaTeX files, e.g.,

\documentclass[12pt,a4paper]{article}
\usepackage{CJK}
\begin{document}
\begin{CJK*}[pmC]{GB}{song}
your Chinese document here......
\end{CJK*}
\end{document}

and use 'gbklatex' to process them, e.g.,

% gbklatex doc.tex                 # do not omit the extension .tex
% dvips doc

dvips will use 'gsftopk' to generate PK font files from Ghostscript's Chinese PFB files and produce a self-contained PostScript file. If you don't want to build Chinese fonts into the resulting PostScript files, you may use

% dvips -P CJK doc

which will produce a quite small Chinese PostScript file, but it requires every one who wants to read it to have Chinese-enabled Ghostscript.

Version 1.3 

Dependencies 

0a. Make sure Ghostscript has been installed on your system. You should also know the location of Ghostscript-related files. You may get this by using the command 'gs -help', the output should contain some lines like this:

Search path:
   . : /usr/local/share/ghostscript/5.10 :
   /usr/local/share/ghostscript/fonts
in this case, Ghostscript files are in /usr/local/share/ghostscript/ and
its sub-directories.

0b. The program ttf2pfb.c, which uses the freetype-1.1 library. Note*: Please do NOT use freetype-1.0 with this packages! ttf2pfb.c in this package is not compatible with freetype-1.0.

Installation 

rpmih chpfb-1.3.1-4.i386.rpm chpfb-fonts-1.0-1BP.noarch.rpm

Configuration & Twisting 

As shown below:

ln -s /usr/lib/chpfb/Fontmap.zh /usr/share/ghostscript/7.05/lib
echo '(Fontmap.zh) .runlibfile' >> /usr/share/ghostscript/7.05/lib/Fontmap

documented on: 2004.03.23

Chinese printing 

Yidao Cai's print/ps convertor for Japanese/Chinese text (dos version) ftp://ftp.crc.ca/pub/packages/nihongo/cnprint321.zip

This is a Dos version: 12983 Defl:N 3543 73% 07-25-00 10:58 52e42d3e cnp321/cnprint.cmd 307807 Defl:N 128147 58% 07-25-00 10:10 1524aece cnp321/cnprint321.exe 64564 Defl:N 25222 61% 07-25-00 23:05 c0fa113c cnp321/cnprint321.hlp

157384 Feb 19 00:00 cnprint321.zip
 87142 Feb 19 00:00 cnprint320.tar.gz

cnprint320.tar.gz (87142 bytes) The Unix/Linux files cnprint320.zip (96945 bytes) The VMS files

Chinese printing 

This archive has mirrors at several sites, including ftp.crc.ca.

documented on: 2002.01.23

CNPRINT 

Description 

CNPRINT is a utility to print Chinese/Japanese/Korean (CJK) text (or convert to PostScript) under DOS, VMS and UNIX systems. It works just as a print command on your system. Currently GB, Hz, zW, BIG5, CNS, JIS, EUC, Shift-JIS, KSC, UTF8, UTF7 and UTF16 formats are supported.

Related Urls 

http://lelandsystems.stanford.edu/services/pubsw/package/text/cnprint.html

Versions 3.20/3.21 * 

ftp://ftp.crc.ca/pub/packages/nihongo/cnprint320.readme

Features 

CNPRINT also has many other features, among them:

  1. print all CJK codes using a single Unicode CJK font

  2. print GB using Big5 fonts or print Big5 using GB fonts

  3. multiple column, vertical printing, change font or character size within document

  4. intellegent treatment of punctuations

  5. phrase-based GB<->BIG5 conversions and built-in HZ<->GB conversion

  6. repair/re-format functions for CJK text

  7. envelope or address label printing

  8. decode MIME quoted printable (=20=3C=5E like text)

  9. true type fonts (TTF) support (since version 3.00/3.01)

The main new features of the current version (released on June 14, 2000):

  1. Add format 4 true type font (TTF) support

  2. Refined unicode handling, add UTF-16 (BE or LE) support. Now support UTF-7, UTF-8 and UTF-16, from 0x0000 to 0xFFFF.

  3. Map GB/Big5/JIS/KSC codes to unicode in order to use unicode TTF font (use -f=unicode_ttf_font_file option).

  4. unicode <-> CJK code conversions -uni2gb, -uni2b5, -uni2ksc, -uni2jis -gb2uni, -b52uni, -ksc2uni, -jis2uni use -utf(utf8)(utf16) to specify input/output unicode type

  5. add convert_and_print option (-print), e.g. convert GB to Big5 and use Big5 font to print

  6. -label mode optionally ignore the EOL right after @[LBxx] (see file cnprint.cmd for detail)

  7. MIME quoted printable auto detection

  8. DOS version (V3.21) created with a 32-bit compiler.

documented on: 2002.01.23