.\" man page for hbf2gf .\" Copyright (C) 1994-2015 Werner Lemberg .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this program in doc/COPYING; if not, write to the Free .\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, .\" MA 02110-1301 USA .TH HBF2GF 1 18-Apr-2015 "" "TeX Live" .SH NAME hbf2gf \- convert a CJK bitmap font into subfonts usable by TeX and Omega. .SH SYNOPSIS .na .nh .HP \fBhbf2gf\fR [\-q] \fIconfiguration-file\fR[.cfg] .HP \fBhbf2gf\fR [\-q] [\-p] [\-g] [\-n] \fIsubfont-name\fR \fIx-resolution\fR [\fIy\-scale\fR|\fIy\-resolution\fR] .HP \fBhbf2gf\fR \-t [\-q] \fIsubfont-name\fR .HP \fBhbf2gf\fR \-\-version|\-\-help .ad .hy .SH DESCRIPTION CJK bitmap fonts can't be directly used with TeX because the number of characters in such fonts exceeds\ 256, the limit of a TeX font. Thus it is necessary to split these fonts into subfonts, and this is exactly what .B hbf2gf does. .PP As the name says, .B hbf2gf uses CJK fonts in a certain format which is called .B Hanzi Bitmap Font .RB ( HBF ) format. It simply consists of the CJK bitmap file(s) and a text file in a format very similar to the BDF format of the X\ Window System which describes the bitmap font files: the encoding, the size, etc. The produced .B GF files can then be converted with .B gftopk into standard .B PK files. .PP .B hbf2gf can be called in three modes: . .PP .in +2m .B hbf2gf .RB [ \-q ] .IR configuration-file [.cfg] .PP .in +5m This call normally creates a set of .B GF files, one .B PL file, and a batch file which must be executed after .B hbf2gf has finished. This script will then call .B gftopk to convert all .B GF files into .B PK files, and it will call .B pltotf to convert the .B PL file into a .B TFM file. Finally it will copy the .B TFM file so that each .B PK file has its .B TFM file (which are all identical). .PP .in +5m If .B ofm_file is set to \(oqyes\(cq in the configuration file, .B OFM and .B OVF files will be created too. . .PP .in +5m .B \-q makes .B hbf2gf quiet. .PP .in +2m .na .nh .B hbf2gf 'in +\n(.ku .RB [ \-q ] .RB [ \-p ] .RB [ \-g ] .RB [ \-n ] .I subfont\-name .I x\-resolution .RI [ y\-scale\ |\ y\-resolution ] .ad .hy .PP .in +5m This mode is intended for use with .B mktexpk and its derivates. Only one .B GF file together with a .B PL file for the given subfont will be computed, taking the horizontal resolution and a vertical scaling factor (if the value is smaller than\ 10) resp. the vertical resolution (otherwise) from the command line, ignoring the .B nmb_fonts parameter of the configuration file. The last two characters (which are interpreted as the subfont number) are stripped to get the name for the configuration file (which must end with '.cfg'. No job file will be created. If option .B \-p is set, no .B PL file is created. If .B \-g is set, no .B GF file is created. The extension can be controlled with .BR \-n ; if set, the extension is '\fB.gf\fR' otherwise '\fB.\fIresolution\fBgf\fR'. .B \-q makes .B hbf2gf quiet. . .PP .in +2m .na .nh .B hbf2gf 'in +\n(.ku .B \-t .RB [ \-q ] .I subfont-name .ad .hy .PP .in +5m This mode is intended for use with scripts like .BR mktexpk ; it tests whether the specified subfont name leads to an .B hbf2gf configuration file. It returns 0 on success and prints out the name of that configuration file (provided the .B \-q switch isn't set). This test isn't a thorough one; it only removes the last two characters and checks whether a configuration file with that name exists. .PP See the next section for more details about configuration files. .PP Specifying the option .B \-\-version returns the current version of .B hbf2gf and the used file search library (e.g.\ \c .BR kpathsea ). Usage information is shown with the .B \-\-help parameter. .SH "CONFIGURATION FILE" Here a sample configuration file (\fBgsfs14.cfg\fR) for a 56\(mu56 Chinese font in GB encoding; note that all information about the font is in the .B jfs56.hbf file. See the .B "FILE SEARCHING" section how HBF fonts and .B hbf2gf configuration files are found. See the .B AVAILABILITY section where to get CJK fonts together with its .B HBF files: .PP .nf hbf_header jfs56.hbf mag_x 1 threshold 128 comment jianti fansongti 56x56 pixel font design_size 14.4 y_offset \-13 nmb_files \-1 output_name gsfs14 checksum 123456789 dpi_x 300 pk_files no tfm_files yes coding codingscheme GuoBiao encoded TeX text pk_directory $HBF_TARGET/pk/modeless/gb2312/gsfs14/ tfm_directory $HBF_TARGET/tfm/gb2312/gsfs14/ .fi .PP A configuration file is a plain text file consisting of keywords and its arguments. A keyword must start a line, otherwise the whole line will be ignored. If the word starting a line is not a keyword, the line will be ignored too. Empty lines will also be skipped. The search for keywords is case insensitive; in contrast, the arguments will be taken exactly as given (except 'yes' and 'no' which can be written with uppercase or lowercase letters). Each keyword has one argument which must be separated by whitespace (blanks or tabs) from the keyword and must be on the same line. Each line must not be longer than 256 characters. .PP You can use environment variables in the configuration file. The escape character starting an environment variable in the configuration file is always '\fB$\fR', even for operating systems like DOS which has other conventions. .B hbf2gf recognizes only environment variable names which start with a letter or an underscore, followed by alphanumeric characters or underscores. You can surround the variable with braces to indicate where the variable name ends, for example .B ${FOO} . To get a dollar sign you must write '$$', The expansion of environment variables in hbf2gf itself (without the help of either kpathsea, emtexdir, or MiKTeX searching routines) is very limited; this feature has been carried over from previous versions. It can't expand variables set in texmf.cnf; it also can't handle more than one directory as the variable's value. \fBDon't use it except for the 'pk_directory' and 'tfm_directory' parameters!\fR .PP This is the list of all necessary keywords: .TP .B hbf_header The HBF header file name of the input font(s). .B hbf2gf uses the given searching mechanism (kpathsea, emtexdir, or MiKTeX) to locate this file. .TP .B output_name The name stem of the output files. A running two digit decimal number starting with '01' will be appended. For Unicode fonts see the keyword .B unicode below. This value is in almost all cases identical to the name of the configuration file. .PP And now all optional keywords: .TP .B x_offset Increases the character width. Will be applied on both sides; default for non-rotated glyphs is the value given in the HBF header .RB ( HBF_BITMAP_BOUNDING_BOX ) scaled to .B design_size (in pixels). .TP .B y_offset Shifts all characters up or down; default for non-rotated glyphs is the value given in the HBF header .RB ( HBF_BITMAP_BOUNDING_BOX ) scaled to .B design_size (in pixels). .TP .B design_size The design size (in points) of the font. .B x_offset and .B y_offset refer to this size. Default is\ 10.0. .TP .B slant The slant of the font (given as Delta_x\ /\ Delta_y). Only values in the range 0\ \(<=\ \fBslant\fR\ \(<=\ 1 are allowed. Default is\ 0.0. .TP .B rotation If set to 'yes', all glyphs will be rotated 90\ degrees counter-clockwise. The default offsets as given in the HBF header will be ignored (and set to\ 0). Default is 'no'. .TP .B mag_x .TQ .B mag_y Scaling values of the characters to reach design size. If only one magnification is given, x and y values are assumed to be equal. Default is \fBmag_x\fR\ =\ \fBmag_y\fR\ =\ 1.0. .PP .TP .B threshold A value between 1 and\ 254 defining a threshold for converting the internal graymap into the output bitmap; lower values cut more pixels. Default value is\ 128. .PP .TP .B comment A comment describing the font; default is none. .PP .TP .B nmb_fonts The number of subfonts to create. Default value is \-1 for creating all fonts. .TP .B unicode If 'yes', a two digit hexadecimal number will be used as a running number, starting with the value of the first byte of the first code range. Default is 'no'. .TP .B min_char The minimum value of the encoding. You should set this value to get correct subfile offsets if it is not identical to the lowest character code in the HBF file. .PP .TP .B dpi_x .TQ .B dpi_y The horizontal and vertical resolution (in dpi) of the printer. If only one resolution is given, x and y values are assumed to be equal. Default is\ 300. .TP .B checksum A checksum to identify the .B GF files with the appropriate .B TFM files. The default value of this unsigned 32bit integer is\ 0. .TP .B coding A comment describing the coding scheme; default is none. .PP .TP .B pk_directory The destination directory of the .B PK files; default: none. Attention! The batch file will not check whether this directory exists. .TP .B tfm_directory The destination directory of the .B TFM files; default: none. Attention! The batch file will not check whether this directory exists. .TP .B pk_files Whether to create .B PK files or not; default is 'yes'. .TP .B tfm_files Whether to create .B TFM files or not; default is 'yes'. .TP .B ofm_file Whether to create an .B OPL file or not; default is 'no'. The batch file will then use .B ovp2ovf of the Omega distribution to convert it into an .B OFM and an .B OVF file. The .B OPL file simply maps all subfonts back to a single Omega font. .TP .B long_extension If 'yes', .B PK files will include the resolution in the extension (e.g. \fBgsso1201.300pk\fR). This affects the batch file only (default is 'yes'). .TP .B rm_command The shell command to remove files; default: 'rm'. .TP .B cp_command The shell command to copy files; default: 'cp'. .TP .B job_extension The extension of the batch file which calls .B gftopk and .B pltotf to convert the .B GF and the .B PL files into .B PK and .B TFM files respectively; default is none. . . .SH "FILE SEARCHING" .B hbf2gf uses .BR kpathsea . The actual version of kpathsea is displayed on screen if you call .B hbf2gf .BR \-\-version . .PP Here is a table of the file type and the corresponding .B kpathsea variables. .PP .in +4m .ta 2i .br .B ".hbf MISCFONTS" .br .B ".cfg HBF2GFINPUTS" .PP Please consult the info files of .B kpathsea for details on these variables. The decision which naming scheme to use for variables will be done during compilation. .PP You should set the .B TEXMFCNF variable to the directory where your .B texmf.cnf configuration file resides. .PP Here is the proper command to find out to which value a .B kpathsea variable is set (we use .B MISCFONTS as an example). This is especially useful if a variable isn't set in .B texmf.cnf or in the environment, thus pointing to the default value which is hard-coded into the .B kpathsea library. .PP .in +2m .B "kpsewhich \-progname=hbf2gf \-expand\-var='$MISCFONTS'" .PP We select the program name also since it is possible to specify variables which are searched only for a certain program \(en in our example it would be .B MISCFONTS.hbf2gf . .PP A similar but not identical method is to say .PP .in +2m .B "kpsewhich \-progname=hbf2gf \-show\-path='misc fonts'" .PP [A full list of format types can be obtained by saying "kpsewhich \-\-help" on the command line prompt.] This is exactly how .B hbf2gf searches for files; the disadvantage is that all variables are expanded which can cause very long strings. .SH LIMITATIONS The x and y output size must not exceed .BR MAX_CHAR_SIZE , which is defined at compile time; its default value is 1023\ (pixel). . . .SH "SEE ALSO" .TP .BR ttf2pk (1) .TP .B hbf2gf.w this is the source code written in .B CWEB which can be converted into a pretty-printed TeX document using .BR cweave . The CJK package also contains a preformatted .B hbf2gf.pdf file. .P the .B CJK documentation files (hbf2gf.txt). .P the .B Hanzi Bitmap File .RB ( HBF ) standard version\ 1.3; available at .B \%ftp.ifcss.org . .P the Omega documentation available at .B ftp.ens.fr and the CTAN hosts and mirrors. . . .SH FILES .TP .B *.cfg The .B hbf2gf configuration scripts. .TP .B *.hbf HBF header files which describe fixed-width bitmap fonts. Note that the bitmap font name(s) themselves as specified in the header files are irrelevant for .BR hbf2gf . . . .SH AVAILABILITY .B hbf2gf is part of the CJK macro package for LaTeX\ 2e. available at the CTAN hosts and its mirrors. .PP CJK fonts together with HBF header files can be found at .B ftp.ifcss.org and its mirrors. . . .SH AUTHORS Werner Lemberg .B .br Ross Paterson (the HBF API) .B