*********************************************** * CNPRINT.HELP For CNPRINT Versions 3.30/3.31 * *********************************************** Copyright YIDAO CAI (~{2LR@5@~}), 1992-2001 All Rights Reserved. Free for non-commercial and personal use only. The source code, or part of it, original or modified, may not be included in any other software, without permission from the author. See "Author" section of this file for details. Disclaimer: Posting CNPRINT on any FTP site does not imply the author's endorsement of the beliefs of the organization who owns the FTP site. This is suuposed to be a rewite of everything, especially the usage section Last revised on May 11, 2001 ----------------------------------------------------------------------------- PLEASE *** READ parts 0 (What's New), 2 (what do you need), 4 (First thing to do) and 6 (Font) before compile, EVEN if you have used CNPRINT before. *** Users of previous versions: make sure the new version works before deleting the old version. *** Test with a small file the first time, or view the PS file on screen first, if possible. *** If you encounter problem using CNPRINT, read part 7. *** For quick on-line help, type "cnprint -h". *** You do NOT need to get the HBF files and bitmap font files, TTF font files or conversion tables if you already have them. *** To print this file with CNPRINT, you must use "-s3" option. *** Main distribution site is now www.neurophys.wisc.edu/~cai/software/, the "ftp.ifcss.org" is unreachable from time to time. ----------------------------------------------------------------------------- CONTENTS ----------------------------------------- 0. What Is CNPRINT and What's New 1. Functions and Features 2. What Do You Need to Use CNPRINT 3. Where to Get CNPRINT 4. Installation 5. Usage 6. Font Files 7. Known Problems 8. Author 9. Acknowledgements 10. Revision History Appendix A, B ----------------------------------------- 0. What Is CNPRINT and What's New CNPRINT is a utility to print Chinese/Japanese/Korean text (or convert to PostScript) under DOS, VMS and UNIX systems. It works just as a print command on your system. Currently GB, GBK, Hz, zW, BIG5, Big5 Plus, CNS, JIS, EUC, Shift-JIS, KSC, UTF-8, UTF-7 and UTF-16 formats are supported. It also does code conversions and much more. These versions are updated from V3.20/V3.21. Thanks to users for your valuable support and suggestions. Main changes: V3.30b/3.31b (May 11, 2001) 01. Add functional sequences (line/box drawing) @[LINEWIDTH#], specify linewidth, 0-100 (you usually don't need anything that's greater than 10. 0 selects default value, which is 1. @[LINEDRAWxxxyyyaaabbb], draw a line from (xxx, yyy) to (aaa, bbb). The coordinates are in points (1 pts = 1/72 inch), and the origin is at the upper-left corner. @[BOXDRAWxxxyyywwwhhh] (in pts), draw a box of size (www, hhh) at (xxx, yyy). @[BOXFILLxxxyyywwwhhh], fill the box note: position (x, y) is the lower left corner of the box relative to the upper left corner of the printed area 02. Add functional sequences (color/gray level) @[RGBrrggbb], RGB color rrggbb in Hex form (e.g. ff0000 is red) @[GRAY0.34], set gray level. @[G#] still works but @[GRAY] is much more flexible, allowing you type any number between 0.0 and 1.0. note: gray level and RGB color are locked, one overwrites the other. 03. Add/modified functional sequences (font) @[FCourier] specify ASC font by name @[h###], expand h to take ASCfont number 1-999 (including bold/italic), H q Q to 1-99 (h regular, q italic, H bold, Q bolditalic) 04. Add functional sequences (page formatting) fix @[MV] offset problem. @[INDL23], @[INDR-20], or @[INDE], adjust column width through INDent. note: 1. INDL/INDR start indent with any positive or negative value in points, and INDE ends the indent 2. the indent is relative to column margins 2. a positive indent on right/left side (INDR/INDL) decreases column width, while a negative indent on the right/left side increases it. 05. @[X#] and @[Y#] now accepts number directly, e.g. @[X1.23]. To be compatible with old usage, @[X1] or @[Y1] will set Cx or Cy to 1.1, not 1.0! Use @[X1.0] or @[Y1.0] to set to 1.0. 06. @[EPSfilname], allow filename (limit 45 chars) to be specified directly. 07. Fixed a bug in HBFopen() comment line handling 08. Introduce an optional ASCII font list file "cnprint.afl" to allow user define ASCII (ISO-5899-1) fonts and store font metric data in seperate files (previously all font metric data are in "cnprint.cmd"). 09. Added -epsheader=EPSheaderfile option to specify EPS header. 10. Cleaned codes so that it works with C++ compilers. 11. Enhanced -label option so that when it is followed by a number (e.g. -label30), it will produce 30 labels automatically. 1. Functions and Features ========================= 1.1. Print Chinese/Japanese/Korean (CJK) or ASCII (ISO-5589-1) documents on DOS/VMS/UNIX machines, or convert them to PostScript files. 1.2. Support a wide variety of input code types: GB, Hz, zW, Big5, CNS, JIS, Shift-JIS, EUC, KSC, UTF7, UTF8, UTF16. Able to print European characters and decode MIME quoted printable (=20=3C=5E like text). 1.3. Generate small PS files by using dynamically generated PS fonts, thus printing very fast. 1.4. Conversion tools: Unicode<->CJK, character- or phrase-based (HZ)GB<->Big5. 1.5. Support HBF, work with almost all bitmap font files with any sizes. Support TTF fonts, and you can use Unicode TTF fonts to print any type of CJK documents. 1.6. A rich set of command-line and in-document control options for page and text formating, including: number of columns, paper margin, orientation, page numbering; horizontal or vertical printing; character size, width/height ratio, line spacing; font, color, underlined text, line and box drawing. Most of these controls can be applied to whole document as well as part of the text, even one character. 1.7. "Intelligent" treatment of punctuation marks and ASCII text. For example, a period (.) or a comma (,) will not appear at start of a line, and an ASCII word or a floating pointing number (e.g. 35.768) will not be broken into two parts at the end of a line. 1.8. Generate EPS file to be included in other documents. Import EPS files (picture/graph/text) any where in the text, or as page header/footer, which appears at the same place on every page. 1.9. Other useful utillities: repair/reformat functions for CJK text; envelope and address label printing; booklet printing; extracting page(s) from an existing PS file; character or word statistics. 1.10. Friendly designed, error tolorent. 2. What Do You Need to Use CNPRINT ================================== A computer runing UNIX (V3.30), VMS (V3.30) or DOS (V3.31) A PostScript printer OR (for non-PostScript printer) install GhostScript and print from there CNPRINT software HBF/TTF font file(s) (see part 6) 3. Where to Get CNPRINT ======================= 3.1. The primary site for CNPRINT is at (since V3.20/3.21) http://www.neurophys.wisc.edu/~cai/software/index.html or by ftp ftp.neurophys.wisc.edu:/pub/cn/ (V2.90 or earlier only, use "anonymous" as user name), This site only carres a small number of fonts, so you may need to go to one of the ifcss or monash mirrors to get fonts. 3.2. IFCSS site and mirrors of the /software directory at ftp.ifcss.org: ftp.ifcss.org (this site was unreachable for a long time, but as of January 24, 2001, it is online again) directory: /pub/software/unix/print (cnprint###.readme, cnprint###.tar.gz) /pub/software/vms/print (cnprint###.readme, cnprint###.zip) /pub/software/dos/print (cnprint.doc, cnprint.zip) Mirrors: (Beijing) info.bta.net.cn:/pub/software (partial); (Shanghai) info.sta.net.cn:/pub/software (partial); (Singapore) ftp.technet.sg:/pub/chinese (full) (Taiwan) ftp.edu.tw:/Chinese/ifcss/software (full); (Taiwan) nctuccca.edu.tw (IP: 140.111.3.21); 3.3. Australia Monash site: ftp.monash.edu.au/pub/nihongo mirrors: ftp.cdrom.com:pub/japanese/monash US - California kuso.shef.ac.uk:pub/japanese/monu6 UK enterprise.ic.gc.ca:pub/nihongo Canada ftp.u-aizu.ac.jp/pub/misc/nihongo/ftp.cc.monash.edu.au/ Japan 3.4. These sites also carry CNPRINT (not a complete list): 3.4.1. pcluo.unibw-hamburg.de (139.11.212.103): /software. From: m_luo@unibw-hamburg.DE 2-APR-1995 15:05:47.45 3.4.2. ftp.uwtc.washington.edu:/pub/Japanese 3.4.3. ftp.cdrom.com:/.13/japanese/kuso/KENLUNDE/ujip/dos(unix) 3.5. After gunzip or unzip the file "cnprint3x0.tar.gz" (or cnprint3x0.zip, cnprint.zip), you will get the first 3-4 files depending on your system. You need to get font files and HBF files seperately (or you can use font and HBF files from other softwares). Please read part VI before you get any font or HBF file. UNIX: cnprint3x0.help, cnprint3x0.c, (cns2b5.c), ttfb320.c, cnprint.cmd, fonts, HBF files, conversion tables VMS: cnprint.help, cnprint3x0.exe, cnprint.cmd, fonts, HBF files, conversion tables DOS: cnprint.hlp, cnprint.exe, cnprint.cmd, fonts, HBF files, conversion tables 3.6. Optional GB(HZ)<->BIG5 or Unicode<->CJK conversion tables, ASCII font list file ("cnprint.afl") I did not include these files in the package because they will not change with versions, not everybody needs them, and/or they are large in size. Please go to my web site (http://www.neurophys.wisc.edu/~cai/software/) to get them if you don't already have. 4. Installation =============== 4.1. Edit file "cnprint.cmd" to add/change some default settings. Update information: V3.20/3.21 (users of previous version please update) CNPRINT can work without "cnprint.cmd", but some functions will be lost. There are many settings in "cnprint.cmd", but you most likely need to a. Specify the PS print command (device port) on your system. (DOS only: the device port for printing PostScript files is most likely to be one of LPT1, LPT2, LPT3, COM2, COM1. Put "LPT2:" if it is LPT2. Ask a local expert for help) WARNING: The print command (port) MUST be the command for printing PostScript files. If you are NOT sure, please ask your system manager, otherwise it could cause BIG problems. If you do not specify the print command (port), CNPRINT would still generate PostScript file(s) but would not print it, you can then print it by sending it to a PS printer or view it with a PS viewer. b. Specify the default GB/Big5/JIS/KSC/unicode font (HBF) file name. c. (Users outside US) Change the paper size if needed. The default is A or letter (8.5x11 inch). (see Appendix A for paper sizes). 4.2. (Beginners only) Put all files in one directory and run CNPRINT under that directory. 4.3. (NOT required, recommended for advanced users only) Specify the full path (directory) for the font files (HBF files and bitmap files) and the file "cnprint.cmd". DOS: add a line in the "autoexec.bat" file: set HBFPATH=C:\FONT (if font is kept under dircetory C:\FONT) UNIX: set an environment variable HBFPATH (put it in your .cshrc or .profile file, depending on the shell you use) setenv HBFPATH "your_subdir_for_fonts" (.cshrc) export HBFPATH=your_subdir_for_fonts (.profile) VMS: follow steps in 5. Note: HBFPATH may point to several paths, you may seperate the paths by ; in DOS, : in unix, and , in VMS: DOS: set HBFPATH=path1;path2;path3 unix: setenv HBFPATH "path1:path2:path3" VMS: $HBFPATH :=="path1,path2,path3" (in login.com) 4.4. (UNIX and VMS only) Compile the source program (there is no need to re-compile after making changes in "cnprint.cmd"). UNIX: cc cnprint.c ttfb.c -o cnprint if you see a lot of error messages, you may try "gcc", "acc", or ask a local expert or system manager for help. VMS: get "cnprint.exe" directly. If that did not work, you can get the source codes (cnprint.c, ttfb.c) in the unix package and compile: cc cnprint.c cc ttfb.c link cnprint ttfb del cnprint.obj;* del ttfb.obj;* For DEC alpha stations, ignore the thousand lines of warnings. If this did not work, ask your system manager for help on how to compile a C program. CNPRINT may not work on old versions of VMS. If you are using old versions of VMS, ask your system manager to update it. 4.5. (VMS only) You need to create a login file under your main directory (or modify it if already exists). The file name is "login.com". Put two lines similar to the following in it: $cnprint :=="$mvsd:[cai.gb]cnprint.exe" $HBFPATH :=="mvsd:[cai.gb.font]" here "mvsd" is my disk name; "[cai.gb]" and "[cai.gb.font]" are my directories containing "cnprint.exe" and fonts respectively. You should change them accordingly. If this did not work, ask your system manager for help on how to setup these things. 4.6. (DOS only, recommended for advanced users only) If you want to run CNPRINT under any directory, you can do either a) or b): a. put the directory containing cnprint.exe in the PATH in autoexec.bat (but it may make PATH too long); b. create a file "cnprint.bat" containing a line similar to the following only, c:\your_subdirectory\cnprint %1 %2 %3 %4 %5 %6 %7 %8 %9 put this file under a directory which is included in the PATH (but it doesn't like those options with '=', so you should use '/' instead, e.g. -f=j24 --> -f/j24). 4.7. (UNIX only) If you install CNPRINT for group use, or have specified the temporary file in a directory other than your home directory, compile with MUSER defined. A good place to put all files (including font files) may be /usr/local/src/cnprint (this is the default HBFPATH). 4.8. Follow the instructions in part 6 to get HBF files and bitmap font files at the ftp site listed there. 4.9. Test with pure English text or a short GB/BIG5/JIS/KSC file (one or two lines). If there is any problem, go to part 7. 5. USAGE ======== The usage is organized as follows: command-line option, in-document functional sequence, file "cnprint.cmd" and some special topics. The command-line options will overwrite any program default values or those set in file "cnprint.cmd", and in-document functional sequences have highest priority. CNPRINT usually will display a menu and let you make selections, you can use -m option to disable menu. 5.1. Command-line options For normal usage: cnprint filename For help: cnprint [-h], or (UNIX) man cnprint For extended usage: cnprint [-h] ... [options] [file1 [file2]...] ... [-o=Outfile] Note: a. Most of the options can be combined. b. The order is not important in most cases. c. Allow several input files at one time (same format, i.e. GB, Hz, Big5, JIS, KSC). d. In unix and DOS, pipeline input is supported (for irregular files, don't use pipeline). e. Input filename can include wildcats (DOS and VMS, and in UNIX too, which is expanded by shell), e,g, test*.gb. cnprint -w -x2be10 filename cnprint -x2b5e10 filename -o=PSname -hz cnprint -x2be10 filename -c2 -o=PSname -q=laserps cnprint -x2be10 file1 file2 file3 -w -o=PSname f. some single character option is depreciated (but still available). Available command-line options: 5.1.1. Help -h: display multiple pages of help messages on screen. 5.1.2. Code selection -big5, -cns, -gb, -hz, -zw, ibig5p, -gbk: specify input code type for Chinese text -jis, -euc, -jis8: specify input code type for Japanese text -ksc: specify input code type for Korean text -utf, -utf8, -utf7, -utf16, -utf16le: specify input code type for unicode text -55: input code type is Big5, adjust horizontal/vertical punctuations. -mimeqp: input contains MIME quoted printables (=A8=D3=C5 like text), decode or decode and print. -euro: Disable/enable ability to print European characters. Default is defined in file "cnprint.cmd". Note: CNPRINT will try to auto-detect code type if there is no definite selection, using the default or selected language type. For example, -jis or -utf options only imply that the input is Japanese or Unicode text. The default language/code type is specified in file "cnprint.cmd". When you print document of another language/code, you will need to supply the language/code type, because auto-detection only works within one language type. For Unicode text, if there is no signature in the input file, it will be assumed that the input is UTF16BE (big endian), thus, utf7, utf8 and utf16le need to be explicitly specified if there is no signature. The auto-detection for Big5 code can theoretically fail under extreme cases, although the chance is be very small. In that case, the program assume input code is the default code type (GB or Big5). 5.1.3. Code conversion -gb2b5, -hz2b5, -b52gb, -b52hz, -hz2gb, -gb2hz: Conversion between different Chinese code types. -uni2gb, -uni2b5, -uni2ksc, -uni2jis: -gb2uni, -b52uni, -ksc2uni, -jis2uni: Unicode <-> CJK code conversions. Use -utf, -utf8 and -utf16 to specify input/output Unicode type. -n74: Characters per line N = 74 for Hz<->GB conversions and JIS/KSC pre-processing. When the number of characters >= N, the newline character on that line is discarded, thus join lines together. -print: convert and print, use with -gb2b5, -hz2b5 or b52gb, e.g. convert GB to Big5 and use Big5 fonts to print. Note: -z and -zz options are replaced by -gb2hz and -hz2gb respectively. 5.1.4. Font selection -f=fontname: Select default Hanzi font. The font name can be a full HBF name (e.g. cn5k48.hbf) or HTF/TTF name (e.g. mssong.htf, mssong.ttf) or in case of HBF, a short name (e.g. k48). -h#: set default ASCII font by font number (e.g. -h23: Helvetica-Bold). The default is Courier. The correspondence between font number and actual font can be overwrriten by definitions in file "cnprint.afl". Note: Unicode fonts can be used to print other CJK code types if conversion tables are installed. 5.1.5. Input/output -i, -out, -io: Use standard input (output) (both). -w: Generate a PS file without printing it. -o=filename: Specify a name for the output file -q=laserps (DOS, -q=lpt2:): specify the PS print command as "laserps", or in DOS, specify the PS print port name as "lpt2:" -r=600: set print/display device resolution 600 dpi (default 300) -eps: Output is an EPS file -epsms: MS format EPS output (add a CTRL-D at the beginning of the EPS file) -epsheader=EPSheaderfile: Specify EPS header file. -level1, -level2: set PS language level to 1 or 2 (def: level 2, use compression). -m: Disable/enable Menu (when use standard input and output, menu is automatically disabled) Note: -e is repaced by -eps, -ems is replaced by -epsms. -g option will discontinue in the future (generate PS files of the format used in V2.30/2.31) standard input/output may not work on VMS. If -i is selected, the menu and conformations to questions will be skipped and the default values will be used. 5.1.6. Character formatting control -e56: Set the width of an ASCII char 0.56 of that of a Hanzi char -x2: Set character width/height 1.2 -y3: Set character height/width 1.3 -tab: TAB mode CLK<->ASCII (default: 4 CJK chars or 8 ASCIIs if -aa) -size=15.4: Set character size to 15.4 points. -a: Print double-byte Hanzi letters and numbers as ASCII ones (thus occupy half the space and looks better). -aa: Special mode for pure ASCII text file: the width of an ASCII character is 60% of that of a Hanzi character (-e6) and smaller line spacing. -d: NO special treatment of punctuation marks (default: use intellegent treatment, for example, a comma or a period will not appear at the start of a line). Also do -e5. 5.1.7. Document and page formatting control -lm=10.5 (-rm, -tm, -bm): set left (right, -top, -bottom) margin to be 10.5 mm. -c3(-c320): Divide one page into 3 columns (-c320, optionally specify space between columns as 20 points, 1 point = 1/72 inch) -cgap=#: specify space between columns (in pts, def: 2.5 char width). -vgap=#: specify vertical space at place of column number change (in pts, def: 1.5 of document line spacing). -l: Set paper orientation Landscape -l3: Special landscape modes. -j: (in multiple column mode) adjust bottom margin, so that all columns will have the same number of rows and the printout does NOT go to the bottom of the page. By default, one column must reach the end of the page before the next column can be started. -s: Suppress the effects of the functional sequences @[**] (-s3: print the sequences are they are) -t: Do not print time and CNPRINT logo on lower-left corner -tt: print time and input file name -nopage: do not print page number and date. -v(-vv): Vertical printing mode (i.e. from top to bottom) -fpg, -fpg5: when multiple input files, start a new page for each new input file (-fpg5: if within 5 lines to bottom). -f: format pages with duplex printing taken into consideration (but does not actually print two-sided or duplex, which depends on your printer!) Note: By default -l changes paper orientation to landscape and divides the page, into 2 columns. To make it one column, use -lc1 or -c1l. 5.1.8. Printing control -mfeed: set manualfeed option on printer to allow you feed paper (this is the only command that directly control printer). -odd, -even: print only odd- or even-numbered pages. -b18: set the starting page number (pape number on the first page) to 18 (by default it is 1). -b20e34: print pages 20-34 (-be23: from begin to page 23) (-b12e: from page 12 to end). This option can be combined with -odd and -even. -m3: Print 3 copies of the document (-m: do NOT display menu) (use -m3m or -mm3 for both) -letter, -legal, -a3, -a4: select paper sizes Letter, Legel, A3 or A4. Note that it does not actually select the proper paper tray on printer, but only use the paper size to generate image. -k: When multiple inputs, produce multiple outputs. -p4: Print/convert 4 pages at a time. Note: -o and -oo are replaced by -odd and -even respectively. 5.1.9. Repair functions -zzz: Filter out functional sequence like @[**]. -r1: -zzz + ignore EOL when # of char per line > N and < M. -r2: -zzz + ignore EOL when # of char per line <= N. -n68, -m120: set N=68 or M=120 (default: N auto-select, M 100). -r6: -r1 + ignore one of two consecutive EOLs (newline char). -r7(-r8): -zzz + add (delete) space before Chinese char (for CStar). -r3: -zzz + make # of spaces at beginning of a line to be 4. -r4: -r3, even there was no space there. -s: (when r1, r2, r6) also ignore Space -p: (when r1, r2, r6) match quotation marks. -m: (when r1, r2, r6) map .,:;?! etc to CJK ones. -a: Map double-byte letters, digits to English ones. -t(-tx): (when r1, r2, r6) ignore 'x' (default: '>') in news reply. -e: (when r1, r2, r6) do NOT ignore EOL. -k(-k90): (when -zzz or -r#) break big file into ~64K (90K) ones. 5.1.10. Other special functions and options -n=256: set the number of chars in CNdict (default 2048) -env: Envelope mode (-envs: small size envelope), use with @[AR] and @[AS] to print addresses on an envelope. -label: Print address label, also set manual feed. Need to setup defaults in file "cnprint.cmd". See @[LBAS] and @[LB##] on how to specify addresses of sender and receiver. if -label is followed by a number (e.g. -label30), it will produce 30 labels automatically, using the whole file as the label or whatever is before the first @[LB. -bk: Booklet format with 2 columns (-bk4: 4 columns) (only even number of columns allowed) -ttt: Word freq statistics excluding (-tttt: including) symbols. -short: Convert long lines in PS file to short lines (<= 80 character per line). -extr: Extract/print selected pages from a PS file. Use -b#e# option to specify page range. -bmps4 0xa1a2 (0xa1a5) -r/l/t/b: font manipulation: shift bitmap to right/left/top/bottom by 4 pixels for char 0xa1a2 (to 0xa1a5). 5.2. Usage of in-document functional sequences The functional sequences (@[***]) are special commands inserted within a document to control certain features of printout. They may appear anywhere in the document and will not appear in the final printout. It must start with "@[" and end with "]". While most of the functional sequences have command strings of two characters (e.g. @[F0] ), a command string must be at least two characters and no more than about 45 characters in length. The characters in the command string are case-sensitive. In most cases, 0 or 00 selects the default value. The default setting means the values in "cnprint.cmd", command-line, or selected through menu. Each of the above sequence would take effect immediately and stop only after a selection of the same/similar nature is chosen, except noted otherwise. For example, if you select a character size 12 by @[12], it would remain 12 points until you select another size, say 15 by @[15]. In the following, we organize the functional sequences according to their functions. 5.2.0. General @[DF] Use default settings for font, char size, line and char spaces, it also sets char width/height ratio (Cx, Cy) to default. Note The default setting means the setting in "cnprint.cmd", command-line, or selections made by menu. 5.2.1. Font selection @[f*] or @[F*] select Hanzi font, 16, 24, 48, * is the font style code, see note. @[v*] or @[V*] select Hanzi font, 40, 56, 64, * is the font style code, see note. @[F0] change back to default Hanzi font @[h1] or @[H2] select ASCII font, normal (upright) @[q3] or @[Q4] select ASCII font, italic/oblique (Xieti) capital H/Q: Bold; number 0-9 for different font. see menu at run time for a list. @[FCourier] specify ASCII font by name @[h###], expand h to take ASCII font number 1-999 (including bold/italic), H q Q to 1-99 (h regular, q italic, H bold, Q bold-italic) @[F***] specify a font, *** is an HBF/HTF/TTF filename (3 to 20 chars) The original usage of @[Fx] is still valid. @[T**] specify an HTF filename Note: To select a font, you must specify font style by j, f, n, k, h, ... or J, N, K, H, ... in the place of * in @[f*]. The meaning of j, f... is j/J for Jianti, f/F for Fanti, etc. This is actually define by yourself, see the FONT sections. The font size are small (16x16), middle (24x24) and large (48x48). To specify a small size font, both 'f' and '*' in @[f*] must be in lower case; to specify a middle size font, one and only one of them should be in lower case, the other in upper case. For example, @[fH] or @[Fh] both select 24x24 Heiti font, and @[ff] select 16x16 Fanti font. Similar rules apply to 40x40 (small), 56x56 (middle) and 64x64 (large) fonts. But for these three sizes, you should use @[v*] or @[V*] instead of @[f*] or @[F*]. From V3.00/3.01, you may use the full HBF/HTF/TTF file name with the @[F***] sequence. At the same time, @[F*] is still valid. 5.2.2. Character size, width/height ratio @[18] Set character size in points. 1 point = 1/72 inch = 0.355 mm The number can be 0-999 (0 selects default size). @[+3], @[-4] increase character size by 3 pts (decrease by 4 pts) @[00] Set character size to document default. @[E7] Set width of ASCII characters 0.7 of that of Hanzi characters @[X#] or @[Y#] Set character width/height Cx or height/width Cy. If # is single digit, set it to 1.# (e.g. X2 becomes 1.2), otherwise use the number directly (e.g. X1.235 becomes 1.235). A value of 0 or 0.0 selects default. @[X1] or @[Y1] is special. Since the number is single digit, it will be translated to 1.1. To specify a value of 1.0, use @[X1.0] or @[Y1.0]. @[X#] and @[Y#] are locked, change one will automatically reset the other. Furthermore, the line space, Ci, will be recalculated each time (Ci = Cy + (Cx-1)/2 - 1). If @[X0] (@[Y0]), Ci is set to default. @[XY] Use default character width/height setting. @[Ix] Set line space, x must be 0-9, a-f. 1-9 set the line space 0.1-0.9 of the standard value and a-f set it 1-6 times of the standard value (standard value = 50% of char size). If x is 0, default value is used (as displayed in menu) @[Ax] Set character space, x must be 0-9, a-f. 1-f set the char space 1-15 times of the standard value (standard value = 8% of char size). If x is 0, default value is used. 5.2.3. Color and gray @[G2] Set gray level 0.2, 9=white, 1=black, default: 0 (0.0) = full black (this is not flexible and will be phased out). @[GRAY0.34] set gray level. @[G#] still works but @[GRAY] is much more flexible, allowing you type any number between 0.0 and 1.0. @[RGBrrggbb] set RGB color rrggbb in Hex form (e.g. ff0000 is red) Note: gray level and RGB color are locked, one overwrites the other. 5.2.4. line/box drawing, underline, move to a point @[LINEWIDTH#] specify linewidth, 0-100 (you usually don't need anything that's greater than 10. 0 selects default value, which is 1. @[LINEDRAWxxxyyyaaabbb] draw a line from (xxx, yyy) to (aaa, bbb). The coordinates are in points (1 pts = 1/72 inch), and the origin is at the upper-left corner. @[BOXDRAWxxxyyywwwhhh] (in pts), draw a box of size (www, hhh) at (xxx, yyy). (xxx, yyy) is the lower left corner of the box relative to the upper left corner of the printed area. @[BOXFILLxxxyyywwwhhh] fill the box (xxx, yyy) is the lower left corner of the box relative to the upper left corner of the printed area. @[UB], @[UE] Begin/end underline. Draw a line under the text. If @[uB]/@[uE], dashed line (on:off ratio 10:7). @[MVxxxyyy] Move current point to (xxx, yyy), allow you put text anywhere on the page. xxx, yyy are in points (1 inch = 72pts) and are relative to the upper-left corner of the text. If (3, 25), put @[MV003025] instead of @[MV325] or @[MV 3 25]. If xxx (or yyy) equals 001, x (or y) position will not be changed. This function is not designed to work with multicolumn and it may affect column formatting. 5.2.4. Page formatting @[C2] Column formatting, i.e. divide the text into 2 columns begining at this point. @[C0] return to default column numbers. @[EP] Include EPS file, enter EPS filename when asked by program. @[P2] Start a new page if the current position is within 2 lines of the end of page. If @[P0], start a new page immediately. If used with multicolumn option, this command may produce effects some people don't like (while others may like). @[BR] Insert a line break (useful in Japanese document) @[CB] or @[CE] Begin/End central adjust. Make text line(s) (e.g. titles) in between appear at the center of a line, leaving equal spaces on both sides of the text. The text line(s) must not be part of a long line (i.e. they must be seperated by end of line characters at both ends by pressing return or enter key. Spaces before the text will not be used to determine the position of the text, but space AFTER the text will be. Extra spaces may make the line too long to be fit into one printed line and thus cause failure. If @[Cb] is used instead of @[CB], spaces before the text will also be counted in determining the position of the text. Note: as the width of an ASCII space may not be 1/2 of a Hanzi character, it is recommended that you use Hanzi space. @[INDL23], @[INDR-20], or @[INDE] adjust column width through INDent. Note: a. INDL/INDR start indent with any positive or negative value in points, and INDE ends the indent b. The indent is relative to column margins. A positive indent on right/left side (INDR/INDL) decreases column width, while a negative indent on the right/left side increases it. c. Column marker @[C*] must begin at the beginning of a paragraph and must end at the end of a paragraph right after the hard return (i.e. the beginning of next line, even if it is a blank line). d. The program will use whatever character size, width/height ratio right before the column maker @[C#] setting the parameters for the columns, so it is best to select the character size and width/height ratio for most of the multicolumn portion right before the column marker @[C#]. 5.2.7. Envelope mode @[AS] or @[AR] (In envelope mode) Mark the beginning of the Address of Sender or Receiver. If AR, CNPRINT moves the left margin 3.25 or 2 inches to the right so that the address of receiver be printed at the desired position. If the input file contains more than one receiver's address, add @[P0]@[AS] at the beginning of each subsequent sender's addresses and select manualfeed option. 5.2.8. Address label printing @[LBAS], @[LBxx], @[LB] (label model) Use with -label option on command-line to mark address of sender or receiver. Configuration of the label sheet (number of labels on a page, label size, etc.) is defined in "cnprint.cmd". An example looks like: @[LBAS] Address of sender limit to 511 chars this address appears on every label you may omit this if you don't need it @[LB02] Name and address of receiver 1 will be printed on label position 2 (count from top to bottom, left to right) @[LB] Name and address of receiver 2 If label position is not specified, use the next one, which is 3 here. If -label30, it uses whatever is before the first @[LB to produce additional labels so that the total number of labels is 30. If the file contains no @[LB, the whole file is treated as one label to produce the 30 labels. 5.2.9. Include EPS file @[EPS], @[EPSfilname] insert an EPS file. The former requires EPS filename to be entered while promoted, while the latter allows EPS filename (limit 45 chars) to be specified directly. 5.3. File "cnprint.cmd", "cnprint.afl" 5.3.1. "cnprint.cmd" This self explainary file contains the default settings and other information used to run CNPRINT. However, CNPRINT can run without it. In that case, default settings coded in the program are used. Things you need to set in this file include: print command used on your system, e.g. "lpr -Php4050"; default language/code type (GB, Big5, JIS, KSC or Unicode); default font for each language/encoding (code type), e.g. GB, JIS, ...; default paper size (letter, A4, ...); default paper margins; page number position; default character size, character and line spaces, width/height ratio; how to treat European characters (auto, on/off); address label setting; temporal file directory/name; GB<->Big5 conversion tables; ASCII font metric information (no can also be stored in other files). 5.3.2. "cnprint.afl" The ASCII font list file contains a list of ASCII or ISO-5589-1 fonts, identified by a font number, a PostScript name and a metric file name. This file is also self explainary. This file is optional --- you can put the font metric information inside file "cnprint.cmd", as it has been upto V3.20/3.21. However, if you need to define fonts that's not listed in "cnprint.cmd", you need to use this file. 5.3.3. Font metric files These files are only neccessary if you use file "cnprint.afl" to define fonts not listed in "cnprint.cmd". Even if you use "cnprint.afl", you don't need to created metric files for fonts the metric information of which already provided in file "cnprint.cmd". The metric file lists width of each character reletive to Courier (which is 10000). A sample metric file is provided (helvet.dat). 5.4. Generate/import EPS file and page header 5.4.1. Use -eps to generate an EPS file, which conforms to EPSF-3.0 standard. The EPS file can be included in other document such as TeX, Microsoft Word, or Adobe Illustrator in which you can edit the image. The best is Illustrator. You can always use Illustrator to transform EPS to other formats or simply copy and paste to other programs (Word, Power Point, etc). Microsoft does not seem to like EPS, so you will have to use and select a PostScript printer when include it in Word, and use -epsms instead of -eps to generate the EPS file. Besides, You can NOT preview it properly, although the final print-out is OK. 5.4.2. To import an EPS file, use @[EP] or @[EPSfilename]. For page header, enter the name of EPS file in the menu option, or use -epsheader on command line. 5.4.3. For all EPS files, either generated by CNPRINT or to be imported to CNPRINT, you need to adjust the BoundingBox at line 4 in the EPS file (except for Illustrator 9.0 or later), otherwise it may be placed outside the print/display range by CNPRINT or other programs. In BoundingBox, llx and lly are the x and y coordinates of the lower-left corner, urx and ury are the x and y coordinates of the upper-right corner (relative to lower-left corner of the paper). The unit is point (1 inch = 72 points) and the numbers must be integers. You may print the EPS out or use PostScript viewer to get the numbers. 5.4.4. To import an EPS file into CNPRINT, you also need to leave enough space for the imported image. CNPRINT will use the position of the @[EP] marker as the lower-left corner of the imported image. 5.5. Character/word frequency statistics The module is not distributed with regular release for UNIX, please contact author to get it. To activate this function, use -ttt or -tttt options (-ttt excludes symbols), then you will be asked to do either character or word statistics. To do word statistics, you need to prepare a GB (or BIG5, JIS, KSC) file, called Keyword File, containing the key words you want to know the frequencies in a document. The following guidelines must be followed in preparing the key word file: a. one word per line; b. each line must be terminated by a hard return (i.e., by pressing "return" or "enter" key); c. ASCII space is ignored but non-ASCII space is considered to be part of the key word. You can use -k=filename option to specify the key word file, or enter the filename when asked. The results can be printed, saved in PS file, or saved in a GB/BIG5/JIS/KSC file. The output for character frequency looks like: 32. ~{:sDGF1P!<:~}3 83 1.44/39.90% | | | | |__ total percentage adding to the CURRENT ones | | | |_______ actual percentage of THE CURRENT ONE(S) | | |___________ total usages adding to the CURRENT ones | |______________ actual useage of THE CURRENT ONE(S) |_________________________ the number of all previous characters - 1 I expect you give proper credit if you publish your results generated with this function. 5.6. GB(HZ)<->B5 conversion HZ<->B5 is actually HZ<->GB<->B5. There are two modes, "char mapping" and "phrase mapping". The "char mapping" mode is the same as used in most existing programs. Due to the "non one-to-one" nature of GB<->B5 mapping, the drawback of is obvious. The "phrase mapping" or "word mapping" mode allows you to map "phrase to phrase", which partially solves the problem of "non one-to-one". CNPRINT supports both modes, with "phrase mapping" having higher priority. All mapping data should be in one or two files, stored under a directory refered to by HBFPATH, or selected with "-k=tablefile" option. The file name(s) can be specified in "cnprint.cmd". For "char mapping" data, one may use the table in HC package by Young & Lee (also a supplemental table). For "phrase mapping", the table from "wordg2b" (pub/software/unix/convert) can be used. The tables are copyrighted (see the table file). You may construct a table yourself according to rules detailed in "cnprint.technotes". 5.7. Miscelleneous 5.7.1. Some popular Chinese editors treat TABs differently, but I think the way CNPRINT does is the correct way. Some editors store TAB as spaces, this would cause the text not line-up properly if you change the size of chars. 5.7.2. If -5 is selected twice (by -55 or -5 -5), some horizontal punctuations would be printed as their vertical counterparts in vertical mode and vice versa. Although CNPRINT can detect Big5 files automatically, it may fail in some extreme cases, so it is best to supply -5 (or define the default code type to BIG5 in CNPRINT.CMD). 5.7.3. In vertical mode, adjustment of punctuation mark is disabled. If document is GB/Hz/ZW, selected symbol characters are rotated to make them appear better, and some ASCII punctuations would be printed as their Chinese counterparts. For GB/HZ/ZW, if -v is selected twice, some punctuations are replaced with better looking ones (for BIG5, -v is enough). For JIS/KSC, -v is enough, but this function needs improvement. 5.7.4. The multi-input function can be used to merge several text files, e.g. cnprint -wn99 file1 file2 file3 -o=file.all 5.7.5. If the output file (either PS or others) is missing, look for CNPRINT.TMP under your current or /tmp directory (or C: drive in DOS). 5.7.6. Menu options Most of the menu options are straight forward and need no explanation. F: This switch functions the same as command-line option -f. If YES, switch left and right margins and page number positions on odd and even pages. It did NOT actually produce TWO-SIDED copies, but when two pages are copied to two sides of the paper, they look nicer. Duplex printing is not supported on most printers. N: When selected, you have the option to specify page position. 5.7.7. Paper size selection on command-line. It only change the size of the "paper" CNPRINT works with, which is imaginary. It does not automatically select the right size paper in your printer (which can only be determined by your computer system). 5.7.8. Paper margins and gap between columns. When they do not match, the requested values of gap, right and left margins will be adjusted slightly. The left margin will be least affected and the gap most most affected (by as much as 30%). If one column, 65% of the needed adjustment will be made on right margin and the rest on left margin. The margin is set as the requested value is. 6. FONT FILES ============= Please --FINISH-- reading this section before using CNPRINT. Skip part 1 only if you have used CNPRINT V2.20/V2.21 or later versions. If you plan to use TTF fonts (strongly recommended), you must read part 2. If you do not have enough space, I suggest you get one good TTF font. 6.1. HBF font You need at least ONE font to run CNPRINT, and CNPRINT can use almost any HBF font. If you do not have enough space, I suggest you get only one of the following fonts. The font-list below is only for the convenience of new users. For a full list please see the README file (00index.txt, or README, or similar) under /software/fonts directory (or its subdirectories). All HBF files for bitmap font files with different style and size (both GB and Big5, JIS/KSC) are stored under that directory. Please read the README file under that directory before you get any bitmap font file or HBF file, and make sure the HBF file and the bitmap font file(s) match. There are more fonts JIS/KSC fonts stored at crl.nmsu.edu [128.123.1.33] under /CLR/multiling/japanese(korean)/fonts, in BDF format. You can convert these BDF fonts to HBF using the programs in the /software/fonts/utils directory at ftp.ifcss.org. FTP site for fonts & HBF files: ftp.ifcss.org:/pub/software/fonts/(gb)(big5)(misc)(unicode)/hbf (misc: for JIS/KSC) (Bitmap font files) (HBF files) GB: cclib.j24, ccsym.24 (Jianti) ccs24.hbf cclib.f24, ccsym.24 (Fanti) ccs24f.hbf (There is also a set of nice 48x48 fonts) Big5: kcchin24.f00 (Fanti) etkcm24.hbf (or kcm24.hbf) kcchin24.f15 (Jianti) etkcs24j.hbf(or kcs24j.hbf) (there is also a set of 48x48 and 64x64 (?) fonts) JIS: jiskan24.bin jiskan24.hbf (There is also a 32x32 font and several 48x48 fonts) KSC: hanglm24.bin hanglm24.hbf unicode: unihan24.bin unihan24.hbf Big5 Plus or GBK: (do not know yet) NOTE: a). Get all bitmap font files in BINARY mode, HBF files in ASCII mode. If the fonts have extension .gz, use gunzip (or gzip -d) to unzip it. The gzip program can be found at pub/software/dos(unix)(vms)/utils directory. b). The bitmap font files, HBF files and the file "cnprint.cmd" (Beginners) should be put under the same directory; (Advanced Users) can be put under any directories you want, but those directories must be specified by HBFPATH (Note: "cnprint.cmd" should also be put under a directory specified by HBFPATH). c). An HBF font consists of one or more existing bitmap files and one HBF file (See article about HBF carried on HXWZ #128, CM9309B, or http://www.neurophys.wisc.edu/~cai/software.html for more). You need to get BOTH the bitmap files and the HBF files in order to use CNPRINT. The main benefit of HBF is that the software author does not need to design the program with a specific font in mind and that you can add any other HBF fonts the author never heard of. d). It is suggested that, after you get the HBF file, you rename them (make a link, or make a copy to the new name). (see part e) For example: (no longer needed since V3.00/3.01) ccs24.hbf --> cnj24.hbf kcm24.hbf --> cn5m24.hbf jiskan24.hbf --> cnjk24.hbf hang24.hbf --> cnkh24.hbf unihan24.hbf --> cnun24.hbf --------------------------- If you skip this step, the font selection function within document (e.g. @[fK]) will be lost. However, other functions will not be affected. e). For the font selection function within document to work, the name of the HBF file must be in the following format: (no longer needed since V3.00/3.01) cn&##.hbf (GB) cng&##.hbf (GBK) cn5&##.hbf (BIG5) cnp&##.hbf (BIG5 Plus) cnj&##.hbf (JIS) cnk&##.hbf (KSC) cnu&##.hbf (unicode) where & can be any letter (a-z, if your system is case-sensitive, use lower case only) and ## be the number reflecting the size of the font, e.g. 24 for 24x24. The command-line and "cnprint.cmd" still accepts HBF names other than "cn*##.hbf" format. It is suggested that you make the letters meaningful, for example, 'k' for Kaishu, 'f' for Fanti. For some non-square bitmap fonts, like kcchin16.f00, the HBF file is named as kcm14.hbf, it is better to rename it as cnm16.hbf (i.e. use numbers 16, 24, 48, 40, 56, 64). If you name it as cnm14.hbf, you can select it on command line with "-f=m14", but you could not select it with @[f*]. Since CNPRINT gets the size information from the HBF file, it is able to use fonts with any size. For example, if you have a 32x32 font and you name the HBF file as cnx56.hbf, it is still OK. f). From V3.00/3.01, you can use @[F***] to specify a font within a document. The *** is the full name of the HBF (or ttf, htf) font file, and should be 3 to 20 char long. So the requirements in notes d) and e) is no longer neccessary. However, other sequences for specifying fonts (e.g., @[V*], @[q*]) are still valid. g). You can also write your own HBF file according to HBF standard at http://ftp.ifcss.org:8001/www/pub/software/info/HBF-1.1/index.html. Notice that CNPRINT only uses the simple properties. For users who might use HBF in their own programs, the CNPRINT codes dealing with fonts are optimized and saved as a seperate file (HBF API) in ftp site ftp.neurophys.wisc.edu:/pub/cn/hbfapi2.c. 6.2. True Type Font (TTF) 6.2.1. From V3.00/V3.01, CNPRINT supports TTF fonts. However, a lot of so-called TTF fonts are actually not "TTF" fonts or do not fully conform to TTF standards, and some good TTF fonts are not yet supported due to my simple implementation. So not every TTF font will work. * Microsoft Windows (or IE 5.0) comes with good unicode fonts (mssong.ttf and mshei.ttf). These fonts, developed by Stone Corp. Zhuhai, China, contain all CJK characters, so one font should be good for all (GB, Big5, JIS and KSC). If you have IE international support, they may be in your C:\windows\fonts directory. * There are some TTF fonts in public domain for Big5: ftp.ifcss.org:/pub/software/fonts/big5/ms-win (or mac) * Note the NTU fonts are non-standard and may cause problems. * I am not aware of any TTF font in public domain for GB, JIS or KSC. 6.2.2. TTF support was well tested with Big5 TTF fonts (over 60) and unicode (using mssong.ttf and mshei.ttf, for all codes), but was not tested with GB, JIS and KSC TTF fonts. 6.2.3. To specify a TTF font, you may use the name of the TTF file directly, or use a *.htf file (header file for a TTF font) indirectly, on either command-line (-f=fontfilename) or in the document with the @[F***] sequence (*** is the FULL name of the TTF or HTF file, 3 to 40 char). You may also use @[T**] in a way similar as with HBF fonts, where ** can be any two characters and in this case the name of the HTF file must follow this rule: cn**.htf (GB) cng**.htf (GBK) cn5**.htf (BIG5) cnp**.htf (BIG5 Plus) cnj**.htf (JIS) cnk**.htf (KSC) cnu**.htf (unicode) 6.2.4. The header file *.htf should contain the following as the first line, followed by optional comment or property lines: TTF_FILE: your_ttf_filename # lines below are optional # some fonts have too much space around a char, "amplify" the char. This # is used to make chars from one font looks as big as those from other fonts _CharSizeScaling: 1.02 # add/reduce horizontal spacing between chars (1=8% of normal space) _AddCharSpacing: -1.2 6.2.5. Apple recommends a 10% space for Hanzi characters, which makes characters two far apart. To compensate this, use "_CharSizeScaling: 1.11" and "_AddCharSpacing: 0" in HTF file. 7. Known Problems ================= No software is without bugs. As CNPRINT is getting bigger, it contains more bugs. A lot of bugs were created when new functions were added. Anyway, your help in identifying those bugs is appreciated. 7.1. Q: The characters look OK but are meaningless, or they are distorted, shifted up/down, left/right. A1: Check HBF file, make sure it matches the bitmap font file. If you write you own HBF file, make sure the offset information is correct. A2: The bitmap font is distorted in transmission. Try to get it again, using BINARY mode and transmit properly. A3: You are printing a Big5 file with GB fonts. 7.2. Q1: CNPRINT failed to print, but I saw the printer was processing the job. Q2: CNPRINT failed to print when I use larger-size font (e.g. 56x56) to print long documents. It is OK when I print short documents. A1: This happens on some printers. There are two possibilities: font cache is too small or printer memory is used up. To avoid the first problem, you need to decrease the number of characters put on the font cache, but this is going to increase the second risk. Generally the problem can be solved with -n=# option (# is a number <= 1024, default 2048). For Q2, you may need to try different numbers (including numbers > 1024). (Thanks to Gong Wei, eng30219@leonis.nus.sg) A2: It might be due to network setup. Somehow before the PS file reaches the printer, some characters were deleted/added or words seperated. 7.3. Q: (DOS) The printer stops printing after one or two pages. Something like "printer is not ready, abort, ignore or retry?" is displayed on screen. If 'R' is typed, it would continue to print the next page. A1: Add MODE LPT2: RETRY=B in the autoexec.bat file (if the printer is connected to LPT2). (cf. p529, MS-DOS version 5.0 User's Guide and Ref., Microsoft Co 1991. Courtesy of Chang, KSU211@UKCC.uky.EDU) A2: see 7.4. 7.4. Q: CNPRINT only printed the first page. A: It may be due to the way your printer is connected to the computer, or the printer setup. You may get around by using -p1 option, i.e. print one page at a time (it helps if you also use -n=200 with -p1 if the document is large). Sometimes it is due to network setup, in that case, try not to print through the network. 7.5. Q: (VMS and UNIX) CNPRINT stops running after displaying "1". A: delete the line "#define TIME" in cnprint.c or delete the lines containing those unsupported functions. Some machines do not support function "remove()", just delete it. 7.6. Q: (DOS) When I typed "cnprint ...", the computer hung up. (VMS) When I typed "cnprint ...", strange messages were displayed on the screen. A1: The files may not be successfully unzipped, or you forgot to get the zipped file in BINARY mode. A2: (VMS) Did you follow the steps in IV ***carefully*** ? 7.7. Q: (DOS) The message "Not enough memory" was displayed at some stage. A: Disconnect network and other things and try CNPRINT again. You may want to generate PS file only (use -w option) if your printer is connected via network. 7.8. Q: (Big5) Some non-frequently used characters are not printed correctly, but the frequently used chars or symbols are OK. A: It is due to different versions of Big5. Try to match the font and the text, or use a conversion program, such as et2hku. In fact, the so-called HKU-Big5 did not exist at all. It was created by some HKU students and has been recalled. It would be best if you stop using it and convert all your text to "standard" Big5. 7.9. I am a user of V2.30/2.31. After I upgraded to V2.70/2.71, I can not print/view the PS files properly. A: From V2.40/2.41 a slightly different PS format was adopted. This change will benefit more users than it will bring trouble to. Use -g option to select the format of V2.30/2.31. There has been no major change in the PS format since V2.40/2.41. 7.10. Q1: When I print Hz files from ACT (or some GB/JIS/KSC files), the line breaks down at unusual places. Q2: (JIS/KSC/HZ/ZW) The lines are joined together (it seems that return characters were "eaten" by CNPRINT). A1: Some softwares omitted a '~' before the hard return in Hz files, so a soft return becomes a hard return for other softwares. Some GB/JIS/KSC file inserted a hard return at each display line. A partial solution is to use -n# option to set characters per line N (equal or slightly less than the number of chars in a Hz line, default value is determined automatically according to the input). A better solution is to use the repair function (-r#, see on-line help). A2: This is just the opposite of the above. Set a larger N with -n#. 7.11. Q: The English characters are printed but all CJK characters are missing. A: Your system could not read Hex numbers properly. Get HBFHX2D.c at ftp.neurophys.wisc.edu and follow the instructions. 7.12. Q1: (UNIX) The program says it could not find HBF file but it IS there, and I did everything correctly. Q2: (UNIX) I could not find the PS file with the name displayed on screen, but I found CNPRINT.TMP, which is a PS file. Q3: (UNIX) all other problems. A: Problems 1 and 2 should not exist in V2.70 or later. But if they are there, (Q1) move all files into one directory or (Q2) rename CNPRINT.TMP, and report to author. 7.13. Q: The program complains it could not find file "cnprint.cmd", but it is there. A: Read section VI(b) and question 12 of this section. 7.14. Q: (UNIX) The pipeline input did not work properly. A: Near the beginning of the source file, there is a line "#define copystdin 1". Uncomment that line. 7.15. Q1: When I select 7 columns, the program did not work properly. Q2: When I select very small character size, the program did not work properly. A1: This is 'normal'. The maximum number of columns you can select depends on the character size and paper margins. A2: V2.70/2.71 contains a fix to this problem, but somehow it does not work on some machines. A3: (DOS) In some cases it is due to small memory available. A4: (UNIX) Increasing MAXLINES (near the top of source) may help. 7.16. Q: I got a lot of error messages when I compile V2.70, (UNIX) but I had no problem with previous version. A1: (DEC Alpha VMS) Ignore the warnings as long as the .exe file is workable. A2: (UNIX, AIX, ConvexOS) Somehow the file contains CTRL-M at the end of each line. Open the file under DOS and save as another name, or use "fixctrlm.c" to get rid of the CTRL-Ms. A3: (UNIX) Use "gcc" or add the following line near the top of the program (thinks to Shih-Yin Lin, sylin@u1iu8.ccl.itri.org.tw): "#define const NULL". A4: (UNIX) Some features in V2.70 are not supported by your compiler. The exact "bug" has not determined at the time of this release. 7.17. Q: I got some out of range characters. A: This is most likely to be normal. The public fonts are usually 'standard' fonts, i.e., they do not cover those vendor-defined characters. Most softwares usually add some of their own characters. This is especially true for big5 since it seems there is no absolute standard. You can check the reported code against the code ranges in the HBF file or a standard table. 7.18. Q: When I print CNS file, it stops after displaying "CNS-->B5". A: (UNIX) Follow the instructions in file cns2b5.c. If you don't have it, get it at ftp.neurophys.wisc.edu:/pub/cn (use "anonymous" as user name). (VMS/DOS) Contact author. 7.19. Q: (UNIX) I could not specify printer options using -q option. A1: A simple shell program may help you get around it, but it is known not to work on all machines. ("cnprint.2nd_printer" at ftp.neurophys.wisc.edu:/pub/cn) A2: Use the -out option and direct output to lpr, e.g., cnprint my_GBfile -out | lpr -Pmyprinter A3: If you are a system manager, you may set up a print queue using cnprint as a filter. ("filter.script" at ftp.neurophys.wisc.edu:/pub/cn). 7.20. Q: I changed the settings in "cnprint.cmd", but they seem to be ignored by the program. A: You must have several "cnprint.cmd" in different directories, check the directories specified by your HBFPATH and keep only one copy of "cnprint.cmd". 7.21. Q: I can no longer print on my printer after I upgraded to V3.00/V3.01. A1: If you set PS language level to 2, then CNPRINT uses compression (a level 2 PostScript feature that could not be emulated in level 1 PS). Change the default setting back to level 1 in "cnprint.cmd". A2: If you used TTF font, it might be that your printer doesn't have enough memory to handle it. 7.22. Q: My default language is Japanese/Korean, when I print Chinese text, I got boxes instead. A: You will need to specify the correct code type if it was not your default language type. 8. AUTHOR ========= Yidao CAI (~{2LR@5@~}) Department of Neurobiology and Anatomy The University of Texas Medical School 6431 Fannin Street, #7.046 Houston, TX 77030 713-500-5579 cai@neurophys.wisc.edu http://www.neurophys.wisc.edu/~cai/ Please send suggestions and report bugs to the above address. Check part VII before you ask any question. The answer to your question might already be there. Please include your e-mail address in the mail body as I sometimes could not reach users with distorted e-mail addresses, and I understand those users need help the most because of their not-so-popular machines. Thank you for using CNPRINT. The author will try his best to offer technical support. However, there is no warranty for CNPRINT. CNPRINT is free for non-commercial and personal use ONLY. However, I would highly appreciate the following as a way to show your support: a). a postcard or e-mail, indicating the machine and system you are running; b). donation in any amount (suggested $5-$20). Those who are not full time students are especially encouraged to donate. Your contribution will be solely used in an educational fund (in memory of my mother) to help and encourage children from rural areas with their primary and high school education. Thank you for your generous support. Linux users: you may use this version and any previous version of CNPRINT (in its original form) for free under the linux operating system. Please note that this is not a GPL license. For ANY OTHER use, please contact author to get permission. The general rule is that if you use it not for profit, and you are not compensated for the work, your request will be granted free of charge (however, donation to the educational fund is more than welcome). If you use CNPRINT for profit, or you are compensated for the work, a small amount of fee will be charged. In any case, the money collected will go to the educational fund. If you install CNPRINT for group use (shared by more than one user on systems other than linux), you must inform author. Requests for using part of CNPRINT source code in your own software will be processed on individual basis. In particular, you may use the parts for conversions of unicode, Japanese formats, and CNS to BIG5 in your software as long as you informed me, but since the codes were modifed from the work of others (see part IX), you may also need to contact the original authors. The author grants free use of the GB<->BIG5 conversion portion of the source codes in freeware as long as credit is given, but its use in shareware or commencial software is subject to other conditions. The part handling HBF files is subject to the conditions in my HBF API, available at ifcss site or my neurophys site. 9. Acknowledgements =================== Thanks to numerous users of previous versions for valuble suggestions, encouragements, and bug fixes, which make the continuous improvement of CNPRINT possible. In particular, I would like to mention Nelson Chin (butta1@cs.bu.EDU), for both his suggestions and testing of CNPRINT on his systems, and Yigen Zeng (yigen.zeng@mop.luth.se), his valuble suggestions and testing efforts makes many important functions possible. Some initial ideas came from GB2PS V1.00 (Dr. Wei Sun, william@anucsd.anu.edu.au). The subroutines for conversion of Japanese format texts were modified from jconv.c by Ken Lunde. The subroutines for unicode were modified from the unicode package of Ross Paterson and/or Guo Jin. The cns2b5 subroutine was modified from that of Ross's package. Several core subroutines for TTF handling benifited from the work of Honda Liaw, the "freetype" project and "ttf2ps.c" of Liang Shing Ng. See file "cnprint.his" for names of other people who contributed to CNPRINT either directly or indirectly. 10. Revision History ==================== V3.20/3.21 (June 14, 2000) 1. Add format 4 true type font (TTF) support (tested with mssong.ttf, and mshei.ttf, which were developed by Stone Corp. Zhuhai, China, and are available from Microsoft web site or your C:\windows\fonts directory if you have IE CJK 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, does not support UCS that is greater than 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. Character size: eliminated extra space for bitmap fonts, thus characters will appear larger than before with less space in between. This change was to accommdate TTF fonts, which usually leaves more than neccessary spaces around characters. However, even with this change, characters from TTF fonts will still be smaller than those from bitmap fonts at the same size. You may use options in HTF/HBF files to make adjustments, e.g. _CharSizeScaling: 1.05 _AddCharSpacing: 1.8 Note: TTF suggests a 5% bearing on each side of a Hanzi character, thus "_CharSizeScaling: 1.11" and "_AddCharSpacing: 0.0" would take care of it. 8. MIME quoted printable auto detection 9. About DOS version (V3.21): starting from this release, a 32-bit compiler is used to generate the executable file. As a result, the file size is much larger. If you have an old machine, V2.90 or earlier may work better for you. V3.10/3.11 (March 20, 1999) 1. Add Big5 Plus and GBK support (not well tested, but works) (will the adoption of unicode, these two will fade away) 2. Optimize font use, build dictionary according to usage of characters in each font, not just the default font. It improves efficiency for documents with multiple fonts, or when you do not print all pages of a document. However, 286 or 386 users may see a slight increase in processing time. Now only a small step away from multiple language support. 3. Re-do the multiple column handling, use fixed space between columns for whole document (based on document default settings) --- hopefully this will eliminate some of the previously unknown bugs. 4. -cgap=#, -vgap=# command line options to specify space (in pts) between columns (def. 2.5 char width) and extra vertical space at the place of column number change (def. 1.5 document line spacing) 5. @[+23] @[-4] to specify char sizes relative to document default. 6. -mimeqp option for decoding MIME quoted printables (=A9=D7=E3 like text). 7. Many more changes inside, and hopeful not many new bugs created. V3.00/3.01 1. Add TTF (true type font) support using Honda Liaw's subroutines. Your printer or GhostView program must support level 2 PostScript. Use command line option -level2 or add a line POSTSCRIPT_LANGUAGE_LEVEL: 2 in the cnprint.cmd file to set the default to level 2. TTF fonts and HBF bitmap fonts can be used in the same document. 2. Allow large size with @[xxx] sequence @[F***]: specify a font, *** is a HBF/HTF/TTF filename (3 to 20 chars) The original usage of @[Fx] is still valid. @[T**]: specify HTF filename (see section V.2) 3. Bitmap compression using ASCII85: this function needs level 2 PostScript printer or Ghostview; it produces smaller PS files; printing speed can be faster or slower depending on your network and printer. 4. Font makers usually leave spaces around a character, but this space varies, so the visual sizes of characters from different fonts may not equal. To make them equal, you may add a line in the HBF/HTF file of each font to adjust their size: _CharSizeScaling: 1.002 Note that the number should be around 1, and is very sensitive to changes. You may also add addtional horizontal spacing between chars for a font: _AddCharSpacing: 1.8 This number is relative (1 = 8% of char width), the range is -5 to 20. For HBF file, these two lines must appear after all regular HBF property lines and before the HBF_END_FONT line 5. -level1 or -level2 set PS language level to 1 or 2 V2.90/2.91 (Jan 10, 1998) 1. print address labels (-label option). Need to update file cnprint.cmd for this option to work properly. See @[LBAS] in section V.3 on how to specify addresses of sender and receiver, and "cnprint.cmd" on how to specify label information. 2. GB<->B5 may use the phrase dictionary from "wordg2b" 3. added several command-line options: -f: two-sided format (but does not print two-sided!) -extr: extract/print selected pages from a PS file (use with -be, -o) -epsms: MS format EPS (add a CTRL-D at the beginning of the EPS file) -odd, -even: -o and -oo still works. 4. @[DF] also sets char width/height ratio (Cx, Cy) to default 5. optimized comma treatment in vertical mode 6. several bug fixes supplied by Ron Grenier V2.80/2.81 (June 27, 1997) 1. added several command-line options -mfeed (manual feed) -eps (-e still works) -nopage (do not print page number and date) -h#, set default English font (e.g. -h3: Helvetica) -big5, input file is big5 (-5 still works) 2. do not break English (ascii) words: algorithm rewritten 3. -io option, re-designed some of the messages so that it works better when used as a filter. For unix, filter setup is provided in appendix. V2.70/2.71 (June 1996) 1. -r8: CStar format to regular DOS format (-r7 the reserve) 2. -bk, booklet format (only even number of columns allowed) 3. -rm(lm/tm/bm)=12, right (left/top/bottom) margin 12 mm 4. -size=10.5, char size 10.5 pts 5. -euro, disable/enable printing European chars. Default: auto-detect. 6. Several functional sequences: @[BR]: issue a line break (useful in Japanese document); @[DF]: use default settings for font, size, line and char spaces; @[F0]: use default font. (Note: the default setting means the setting in "cnprint.cmd", command-line, or selected by menu) 7. Fixed a bug with @[C0], now return to default column numbers, not 1. 8. Add -letter(legal)(a3)(a4) to select paper sizes. Note it does not actually select the proper paper tray on printer, but only use the paper size to generate image. 9. Add -gb2hz, -hz2gb options (original -z and -zz still work). 10. (DOS and VMS) Accept wildcard in input file name (e.g. hxwz*.gb). 11. Set default page number position in "cnprint.cmd". 12. -env(s): envelope mode on command-line. 13. -fpg(5): (multiple input files) start new page for each new input file (if within 5 lines to bottom). 14. -bmps#: shift bitmap of a char. 15. CNS support (convert to Big5 and then print). 16. GB(HZ)<->B5 conversion. 17. Now write to stdout, thus can be used as a "filter". But there may be some problems with file protection for multiple users. It works on my linux as a filter defined in "printcap" file. V2.60/2.61 1. Six positions for page number 2. Allow pipeline-input for unix and DOS (-i option) 3. Support Korean KSC-5601 4. Support more Japanese formats: JIS (old-, new-, nec-), shift-JIS, EUC 5. Auto-detect input codes (either Chinese or Japanese, not both) 6. Vertical option for Japanese 7. -f hbfname --> -f=hbfname; -n 0 --> -n=0 8. Repair functions for GB/Big5/JIS 9. Added control to make the text (e.g. titles) appear at the center of a line (@[CB], @[CE]) 10. Support European characters generated by NJstar (those characters are mapped to 128-160) 11. Now do not break English (ascii) words and numbers like 123.4 12. Draw a line under text (@[UB], @[UE]) 13. Specify char size on command line: -size=15.4 14. Support unicode (utf8, utf7) 13. Fixed some bugs. V2.30/2.31 (Oct. 24, 1993) Appendix A ---------- paper sizes A (letter): 8.5 x 11 inch or 215.90 x 279.40 mm legal: 8.5 x 13.5 215.90 x 342.90 A4: 8.27 x 11.69 210.00 x 297.00 B: 11 x 17 279.40 x 431.80 A3: 11.69 x 16.54 297.00 x 420.00 Appendix B ---------- Dr. F. F. LEE's hz2gb can be found at ftp.ifcss.org/pub/software/unix/convert For HBF standard, see ftp.ifcss.org/pub/software/fonts/HBF jconv.c is at ftp.ora.com:/pub/examples/nutshell/ujip/src. GB/BIG5/JIS/KSC table files can be found at ftp.neurophys.wisc.edu:/pub/cn The HBF API used in CNPRINT can be found at ftp.neurophys.wisc.edu:/pub/cn A brief history of CNPRINT can be found at ftp.neurophys.wisc.edu:/pub/cn, file name "cnprint.his" If you want to know more about the technical aspects of CNPRINT, read file "cnprint.technotes" at ftp.neurophys.wisc.edu:/pub/cn All the files at ftp.neurophys.wisc.edu can be reached by www at http://www.neurophys.wisc.edu/~cai/software.html. The script file needed to setup cnprint as a filter for unix printers can be found at ftp.neurophys.wisc.edu:/pub/cn, "filter.script".