Debian Codegraph @

texk/cjkutils/cjkutils-src/hbf2gf/hbf2gf.1

raw
1 .\" man page for hbf2gf
2 .\"
3 .\" Copyright (C) 1994-2021 Werner Lemberg <[email protected]>
4 .\"
5 .\" This program is free software; you can redistribute it and/or modify
6 .\" it under the terms of the GNU General Public License as published by
7 .\" the Free Software Foundation; either version 2 of the License, or
8 .\" (at your option) any later version.
9 .\"
10 .\" This program is distributed in the hope that it will be useful,
11 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
12 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 .\" GNU General Public License for more details.
14 .\"
15 .\" You should have received a copy of the GNU General Public License
16 .\" along with this program in doc/COPYING; if not, write to the Free
17 .\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
18 .\" MA 02110-1301 USA
19 .\"
20 .
21 .TH HBF2GF 1 16-Oct-2021 "CJK Version 4.8.5"
22 .SH NAME
23 hbf2gf \- convert a CJK bitmap font into subfonts usable by TeX and Omega.
24 .
25 .
26 .SH SYNOPSIS
27 .na
28 .nh
29 .B hbf2gf
30 .RB [ \-q ]
31 .IR \%configuration-file [ .cfg ]
32 .br
33 .B hbf2gf
34 'in +\n(.ku
35 .RB [ \-q ]
36 .RB [ \-p ]
37 .RB [ \-g ]
38 .RB [ \-n ]
39 .I \%subfont-name \%x-resolution
40 .RI [ \%y-scale \ | \ \%y-resolution ]
41 .br
42 .in
43 .B hbf2gf
44 .B \-t
45 .RB [ \-q ]
46 .I \%subfont-name
47 .br
48 .B "hbf2gf \-\-version"
49 |
50 .B \-\-help
51 .ad
52 .hy
53 .
54 .
55 .
56 .\" ====
57 .\" ==== macro definitions
58 .\" ====
59 .
60 .\" here we define \TeX for troff and nroff
61 .if t .ds TX \fRT\h'-0.1667m'\v'0.20v'E\v'-0.20v'\h'-0.125m'X\fP
62 .if n .ds TX TeX
63 .
64 .\" and here the same for \LaTeX
65 .if t \{\
66 .ie '\*(.T'dvi' \
67 .ds LX \fRL\h'-0.36m'\v'-0.15v'\s-3A\s0\h'-0.15m'\v'0.15v'\fP\*(TX
68 .el .ds LX \fRL\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\fP\*(TX
69 .\}
70 .if n .ds LX LaTeX
71 .
72 .\" \LaTeXe
73 .\" note that we need \vareps for TeX instead of \eps which can only be
74 .\" accessed with the \N escape sequence (in the Math Italic font)
75 .if t \{\
76 .ie '\*(.T'dvi' .ds LE \*(LX\h'0.15m'2\v'0.20v'\f(MI\N'34'\fP\v'-0.20v'
77 .el .ds LE \*(LX\h'0.15m'2\v'0.20v'\(*e\v'-0.20v'
78 .\}
79 .if n .ds LE LaTeX\ 2e
80 .
81 .\" a definition for \Delta
82 .if t .ds DE \(*D
83 .if n .ds DE Delta_
84 .
85 .\" a typewriter font
86 .if t \{\
87 .de C
88 \fC\\$1\fP\\$2
89 ..
90 .\}
91 .if n \{\
92 .de C
93 \\$1\\$2
94 ..
95 .\}
96 .
97 .\" an addition to .TP to allow two labels for the same item
98 .de TQ
99 .br
100 .ns
101 .TP
102 ..
103 .
104 .\" ====
105 .\" ==== end of macro definitions
106 .\" ====
107 .
108 .
109 .
110 .SH DESCRIPTION
111 CJK bitmap fonts can't be directly used with \*(TX
112 because the number of characters in such fonts exceeds\ 256, the limit of a
113 \*(TX
114 font.
115 Thus it is necessary to split these fonts into subfonts, and this is
116 exactly what
117 .B hbf2gf
118 does.
119 .PP
120 As the name says,
121 .B hbf2gf
122 uses CJK fonts in a certain format which is called
123 .B Hanzi Bitmap Font
124 .RB ( HBF )
125 format.
126 It simply consists of the CJK bitmap file(s) and a text file in a format
127 very similar to the BDF format of the X\ Window System which describes the
128 bitmap font files: the encoding, the size, etc.
129 The produced
130 .C GF
131 files can then be converted with
132 .B gftopk
133 into standard
134 .C PK
135 files.
136 .PP
137 .B hbf2gf
138 can be called in three modes:
139 .
140 .PP
141 .in +2m
142 .B hbf2gf
143 .RB [ \-q ]
144 .IR configuration-file [ .cfg ]
145 .PP
146 .in +5m
147 This call normally creates a set of
148 .C GF
149 files, one
150 .C PL
151 file, and a batch file which must be executed after
152 .B hbf2gf
153 has finished.
154 This script will then call
155 .B gftopk
156 to convert all
157 .C GF
158 files into
159 .C PK
160 files, and it will call
161 .B pltotf
162 to convert the
163 .C PL
164 file into a
165 .C TFM
166 file.
167 Finally it will copy the
168 .C TFM
169 file so that each
170 .C PK
171 file has its
172 .C TFM
173 file (which are all identical).
174 .PP
175 .in +5m
176 If
177 .B ofm_file
178 is set to \(oqyes\(cq in the configuration file,
179 .C OFM
180 and
181 .C OVF
182 files will be created too.
183 .
184 .PP
185 .in +5m
186 .B \-q
187 makes
188 .B hbf2gf
189 quiet.
190 .PP
191 .in +2m
192 .na
193 .nh
194 .B hbf2gf
195 'in +\n(.ku
196 .RB [ \-q ]
197 .RB [ \-p ]
198 .RB [ \-g ]
199 .RB [ \-n ]
200 .I \%subfont-name \%x-resolution
201 .RI [ \%y-scale \ | \ \%y-resolution ]
202 .ad
203 .hy
204 .PP
205 .in +5m
206 This mode is intended for use with
207 .B \%mktexpk
208 and its derivates.
209 Only one
210 .C GF
211 file together with a
212 .C PL
213 file for the given subfont will be computed, taking the horizontal
214 resolution and a vertical scaling factor (if the value is smaller than\ 10)
215 resp. the vertical resolution (otherwise) from the command line, ignoring
216 the
217 .B nmb_fonts
218 parameter of the configuration file.
219 The last two characters (which are interpreted as the subfont number) are
220 stripped to get the name for the configuration file (which must end with
221 \(oq\c
222 .C \&.cfg \(cq).
223 No job file will be created.
224 If option
225 .B \-p
226 is set, no
227 .C PL
228 file is created.
229 If
230 .B \-g
231 is set, no
232 .C GF
233 file is created.
234 The extension can be controlled with
235 .BR \-n ;
236 if set, the extension is \(oq\c
237 .C \&.gf \(cq,
238 otherwise \(oq\c
239 .C \&. <\c
240 .IR resolution >\c
241 .C gf \(cq.
242 .B \-q
243 makes
244 .B hbf2gf
245 quiet.
246 .
247 .PP
248 .in +2m
249 .na
250 .nh
251 .B hbf2gf
252 'in +\n(.ku
253 .B \-t
254 .RB [ \-q ]
255 .I \%subfont-name
256 .ad
257 .hy
258 .PP
259 .in +5m
260 This mode is intended for use with scripts like
261 .BR \%mktexpk ;
262 it tests whether the specified subfont name leads to an
263 .B hbf2gf
264 configuration file.
265 It returns 0 on success and prints out the name of that configuration file
266 (provided the
267 .B \-q
268 switch isn't set).
269 This test isn't a thorough one; it only removes the last two characters
270 and checks whether a configuration file with that name exists.
271 .PP
272 See the next section for more details about configuration files.
273 .PP
274 Specifying the option
275 .B \-\-version
276 returns the current version of
277 .B hbf2gf
278 and the used file search library (e.g.\ \c
279 .BR kpathsea ).
280 Usage information is shown with the
281 .B \-\-help
282 parameter.
283 .
284 .
285 .SH "CONFIGURATION FILE"
286 Here a sample configuration file (\c
287 .C gsfs14.cfg )
288 for a 56\(mu56 Chinese font in GB encoding; note that all information
289 about the font is in the
290 .C jfs56.hbf
291 file.
292 See the
293 .B "FILE SEARCHING"
294 section how HBF fonts and
295 .B hbf2gf
296 configuration files are found.
297 See the
298 .B AVAILABILITY
299 section where to get CJK fonts together with its
300 .C HBF
301 files:
302 .PP
303 .if t \fC
304 .nf
305 hbf_header jfs56.hbf
306 mag_x 1
307 threshold 128
308 comment jianti fansongti 56x56 pixel font
309
310 design_size 14.4
311
312 y_offset \-13
313
314 nmb_files \-1
315
316 output_name gsfs14
317
318 checksum 123456789
319
320 dpi_x 300
321
322 pk_files no
323 tfm_files yes
324
325 coding codingscheme GuoBiao encoded TeX text
326
327 pk_directory $HBF_TARGET/pk/modeless/gb2312/gsfs14/
328 tfm_directory $HBF_TARGET/tfm/gb2312/gsfs14/
329 .fi
330 .if t \fP
331 .PP
332 A configuration file is a plain text file consisting of keywords and its
333 arguments.
334 A keyword must start a line, otherwise the whole line will be ignored.
335 If the word starting a line is not a keyword, the line will be ignored too.
336 Empty lines will also be skipped.
337 The search for keywords is case insensitive; in contrast, the arguments will
338 be taken exactly as given (except \(oqyes\(cq and \(oqno\(cq which can be written with
339 uppercase or lowercase letters).
340 Each keyword has one argument which must be separated by whitespace (blanks
341 or tabs) from the keyword and must be on the same line.
342 Each line must not be longer than 256 characters.
343 .PP
344 You can use environment variables in the configuration file.
345 The escape character starting an environment variable in the configuration
346 file is always \(oq\c
347 .C $ \(cq,
348 even for operating systems like DOS which has other conventions.
349 .B hbf2gf
350 recognizes only environment variable names which start with a letter or an
351 underscore, followed by alphanumeric characters or underscores.
352 You can surround the variable with braces to indicate where the variable
353 name ends, for example
354 .C ${FOO} .
355 To get a dollar sign you must write \(oq\c
356 .C $$ \(cq.
357 The expansion of environment variables in hbf2gf itself (without the help of
358 either kpathsea, emtexdir, or MiKTeX searching routines) is very limited;
359 this feature has been carried over from previous versions.
360 It can't expand variables set in texmf.cnf; it also can't handle more than
361 one directory as the variable's value.
362 .B Don't use it except for the \(oqpk_directory\(cq and \(oqtfm_directory\(cq
363 .B parameters!
364 .PP
365 This is the list of all necessary keywords:
366 .TP
367 .B hbf_header
368 The HBF header file name of the input font(s).
369 .B hbf2gf
370 uses the given searching mechanism (kpathsea, emtexdir, or MiKTeX) to locate
371 this file.
372 .TP
373 .B output_name
374 The name stem of the output files.
375 A running two digit decimal number starting with \(oq\c
376 .C 01 \(cq
377 will be appended.
378 For Unicode fonts see the keyword
379 .B unicode
380 below.
381 This value is in almost all cases identical to the name of the configuration
382 file.
383 .PP
384 And now all optional keywords:
385 .TP
386 .B x_offset
387 Increases the character width.
388 Will be applied on both sides; default for non-rotated glyphs is the value
389 given in the HBF header
390 .RB ( HBF_BITMAP_BOUNDING_BOX )
391 scaled to
392 .B design_size
393 (in pixels).
394 .TP
395 .B y_offset
396 Shifts all characters up or down; default for non-rotated glyphs is the value
397 given in the HBF header
398 .RB ( HBF_BITMAP_BOUNDING_BOX )
399 scaled to
400 .B design_size
401 (in pixels).
402 .TP
403 .B design_size
404 The design size (in points) of the font.
405 .B x_offset
406 and
407 .B y_offset
408 refer to this size.
409 Default is\ 10.0.
410 .TP
411 .B slant
412 The slant of the font (given as \*(DEx\ /\ \*(DEy).
413 Only values in the range 0\ \(<=\ \fBslant\fP\ \(<=\ 1 are allowed.
414 Default is\ 0.0.
415 .TP
416 .B rotation
417 If set to \(oqyes\(cq, all glyphs will be rotated 90\ degrees counter-clockwise.
418 The default offsets as given in the HBF header will be ignored (and set
419 to\ 0).
420 Default is \(oqno\(cq.
421 .TP
422 .B mag_x
423 .TQ
424 .B mag_y
425 Scaling values of the characters to reach design size.
426 If only one magnification is given, x and y values are assumed to be equal.
427 Default is \fBmag_x\fP\ =\ \fBmag_y\fP\ =\ 1.0.
428 .PP
429 .TP
430 .B threshold
431 A value between 1 and\ 254 defining a threshold for converting the internal
432 graymap into the output bitmap; lower values cut more pixels.
433 Default value is\ 128.
434 .PP
435 .TP
436 .B comment
437 A comment describing the font; default is none.
438 .PP
439 .TP
440 .B nmb_fonts
441 The number of subfonts to create.
442 Default value is \-1 for creating all fonts.
443 .TP
444 .B unicode
445 If \(oqyes\(cq, a two digit hexadecimal number will be used as a running number,
446 starting with the value of the first byte of the first code range.
447 Default is \(oqno\(cq.
448 .TP
449 .B min_char
450 The minimum value of the encoding.
451 You should set this value to get correct subfile offsets if it is not
452 identical to the lowest character code in the HBF file.
453 .PP
454 .TP
455 .B dpi_x
456 .TQ
457 .B dpi_y
458 The horizontal and vertical resolution (in dpi) of the printer.
459 If only one resolution is given, x and y values are assumed to be equal.
460 Default is\ 300.
461 .TP
462 .B checksum
463 A checksum to identify the
464 .C GF
465 files with the appropriate
466 .C TFM
467 files.
468 The default value of this unsigned 32bit integer is\ 0.
469 .TP
470 .B coding
471 A comment describing the coding scheme; default is none.
472 .PP
473 .TP
474 .B pk_directory
475 The destination directory of the
476 .C PK
477 files; default: none.
478 Attention!
479 The batch file will not check whether this directory exists.
480 .TP
481 .B tfm_directory
482 The destination directory of the
483 .C TFM
484 files; default: none.
485 Attention!
486 The batch file will not check whether this directory exists.
487 .TP
488 .B pk_files
489 Whether to create
490 .C PK
491 files or not; default is \(oqyes\(cq.
492 .TP
493 .B tfm_files
494 Whether to create
495 .C TFM
496 files or not; default is \(oqyes\(cq.
497 .TP
498 .B ofm_file
499 Whether to create an
500 .C OPL
501 file or not; default is \(oqno\(cq.
502 The batch file will then use
503 .B ovp2ovf
504 of the Omega distribution to convert it into an
505 .C OFM
506 and an
507 .C OVF
508 file.
509 The
510 .C OPL
511 file simply maps all subfonts back to a single Omega font.
512 .TP
513 .B long_extension
514 If \(oqyes\(cq,
515 .C PK
516 files will include the resolution in the extension (e.g.
517 .C gsso1201.300pk ).
518 This affects the batch file only (default is \(oqyes\(cq).
519 .TP
520 .B rm_command
521 The shell command to remove files; default: \(oqrm\(cq.
522 .TP
523 .B cp_command
524 The shell command to copy files; default: \(oqcp\(cq.
525 .TP
526 .B job_extension
527 The extension of the batch file which calls
528 .B gftopk
529 and
530 .B pltotf
531 to convert the
532 .C GF
533 and the
534 .C PL
535 files into
536 .C PK
537 and
538 .C TFM
539 files respectively; default is none.
540 .
541 .
542 .SH "FILE SEARCHING"
543 .B hbf2gf
544 uses either the
545 .BR kpathsea ,
546 .BR emtexdir ,
547 or
548 .B MiKTeX
549 library for searching files
550 .RB ( emtexdir
551 will work only on operating systems which have an MS-DOSish background,
552 i.e., MS-DOS, OS/2, Windows;
553 .B MiKTeX
554 is for Win32 systems).
555 .
556 .SS kpathsea
557 The actual version of kpathsea is displayed on screen if you call
558 .B hbf2gf
559 .BR \-\-version .
560 .PP
561 Here is a table of the file type and the corresponding
562 .B kpathsea
563 variables.
564 .PP
565 .in +4m
566 .ta 2i
567 .br
568 .C "\&.hbf MISCFONTS"
569 .br
570 .C "\&.cfg HBF2GFINPUTS"
571 .PP
572 Please consult the info files of
573 .B kpathsea
574 for details on these variables.
575 The decision which naming scheme to use for variables will be done during
576 compilation.
577 .PP
578 You should set the
579 .C TEXMFCNF
580 variable to the directory where your
581 .C texmf.cnf
582 configuration file resides.
583 .PP
584 Here is the proper command to find out to which value a
585 .B kpathsea
586 variable is set (we use
587 .C MISCFONTS
588 as an example).
589 This is especially useful if a variable isn't set in
590 .C texmf.cnf
591 or in the environment, thus pointing to the default value which is
592 hard-coded into the
593 .B kpathsea
594 library.
595 .PP
596 .in +2m
597 .C "kpsewhich \-progname=hbf2gf \-expand\-var='$MISCFONTS'"
598 .PP
599 We select the program name also since it is possible to specify
600 variables which are searched only for a certain program \(en in our
601 example it would be
602 .C MISCFONTS.hbf2gf .
603 .PP
604 A similar but not identical method is to say
605 .PP
606 .in +2m
607 .C "kpsewhich \-progname=hbf2gf \-show\-path='misc fonts'"
608 .PP
609 [A full list of format types can be obtained by saying \(oq\c
610 .C "kpsewhich \-\-help" \(cq
611 on the command line prompt.]
612 This is exactly how
613 .B hbf2gf
614 searches for files; the disadvantage is that all variables are expanded
615 which can cause very long strings.
616 .
617 .SS emtexdir
618 .PP
619 Here the list of suffixes and its related environment variables to be set in
620 .C autoexec.bat
621 (resp. in
622 .C config.sys
623 for OS/2):
624 .PP
625 .in +4m
626 .ta 2i
627 .br
628 .C "\&.hbf HBFONTS"
629 .br
630 .C "\&.cfg HBFCFG"
631 .PP
632 If one of the variables isn't set, a warning message is emitted.
633 The current directory will always be searched.
634 As usual, one exclamation mark appended to a directory path causes
635 subdirectories one level deep to be searched, two exclamation marks causes
636 all subdirectories to be searched.
637 Example:
638 .PP
639 .in +2m
640 .C HBFONTS=c:\\\\fonts\\\\hbf!!;d:\\\\myfonts\\\\hbf!
641 .PP
642 Constructions like \(oq\c
643 .C c:\\\\fonts!!\\\\hbf \(cq
644 aren't possible.
645 .
646 .SS MikTeX
647 .PP
648 Please consult the documentation files of
649 .B MiKTeX
650 for more details.
651 .
652 .
653 .SH LIMITATIONS
654 The x and y output size must not exceed
655 .BR MAX_CHAR_SIZE ,
656 which is defined at compile time; its default value is 1023\ (pixel).
657 .
658 .
659 .SH "SEE ALSO"
660 .BR ttf2pk (1)
661 .PP
662 .C hbf2gf.w :
663 'in +\n(.ku
664 this is the source code written in
665 .B CWEB
666 which can be converted into a pretty-printed \*(TX
667 document using
668 .BR cweave .
669 The CJK package also contains a preformatted
670 .C hbf2gf.pdf
671 file.
672 .PP
673 the
674 .B CJK
675 documentation files (\c
676 .C hbf2gf.txt ).
677 .PP
678 the
679 .B Hanzi Bitmap File
680 .RB ( HBF )
681 standard version\ 1.3; available at
682 .C \%ftp.ifcss.org .
683 .PP
684 the Omega documentation available at
685 .C ftp.ens.fr
686 and the CTAN hosts and mirrors.
687 .
688 .
689 .SH FILES
690 .TP
691 .C *.cfg
692 The
693 .B hbf2gf
694 configuration scripts.
695 .TP
696 .C *.hbf
697 HBF header files which describe fixed-width bitmap fonts.
698 Note that the bitmap font name(s) themselves as specified in the header files
699 are irrelevant for
700 .BR hbf2gf .
701 .
702 .
703 .SH AVAILABILITY
704 .B hbf2gf
705 is part of the CJK macro package for \*(LE
706 available at the CTAN hosts and its mirrors.
707 .PP
708 CJK fonts together with HBF header files can be found at
709 .C ftp.ifcss.org
710 and its mirrors.
711 .
712 .
713 .SH AUTHORS
714 Werner Lemberg
715 .C <[email protected]>
716 .br
717 Ross Paterson (the HBF API)
718 .C <[email protected]>