HBF2GF(1) | General Commands Manual | HBF2GF(1) |
hbf2gf - convert a CJK bitmap font into subfonts usable by TeX and Omega.
hbf2gf [-q] configuration-file[.cfg]
hbf2gf
[-q] [-p] [-g] [-n] subfont-name
x-resolution [y-scale | y-resolution]
hbf2gf -t [-q] subfont-name
hbf2gf --version | --help
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 hbf2gf does.
As the name says, hbf2gf uses CJK fonts in a certain format which is called Hanzi Bitmap Font (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 GF files can then be converted with gftopk into standard PK files.
hbf2gf can be called in three modes:
hbf2gf [-q] configuration-file[.cfg]
This call normally creates a set of GF files, one PL file, and a batch file
which must be executed after hbf2gf has finished. This script will
then call gftopk to convert all GF files into PK files, and it will
call pltotf to convert the PL file into a TFM file. Finally it will
copy the TFM file so that each PK file has its TFM file (which are all
identical).
If ofm_file is set to ‘yes’ in the configuration file,
OFM and OVF files will be created too.
-q makes hbf2gf quiet.
hbf2gf
[-q] [-p] [-g] [-n] subfont-name
x-resolution [y-scale | y-resolution]
This mode is intended for use with mktexpk and its derivates. Only one
GF file together with a 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 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 -p is set, no PL file is created. If -g is set, no GF
file is created. The extension can be controlled with -n; if set, the
extension is ‘.gf’, otherwise
‘.<resolution>gf’. -q makes hbf2gf
quiet.
hbf2gf
-t [-q] subfont-name
This mode is intended for use with scripts like mktexpk; it tests
whether the specified subfont name leads to an hbf2gf configuration
file. It returns 0 on success and prints out the name of that configuration
file (provided the -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.
See the next section for more details about configuration files.
Specifying the option --version returns the current version of hbf2gf and the used file search library (e.g. kpathsea). Usage information is shown with the --help parameter.
Here a sample configuration file (gsfs14.cfg) for a 56×56 Chinese font in GB encoding; note that all information about the font is in the jfs56.hbf file. See the FILE SEARCHING section how HBF fonts and hbf2gf configuration files are found. See the AVAILABILITY section where to get CJK fonts together with its HBF files:
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/
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.
You can use environment variables in the configuration file. The escape character starting an environment variable in the configuration file is always ‘$’, even for operating systems like DOS which has other conventions. 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 ${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. Don't use it except for the ‘pk_directory’ and ‘tfm_directory’ parameters!
This is the list of all necessary keywords:
And now all optional keywords:
hbf2gf uses either the kpathsea, emtexdir, or MiKTeX library for searching files (emtexdir will work only on operating systems which have an MS-DOSish background, i.e., MS-DOS, OS/2, Windows; MiKTeX is for Win32 systems).
The actual version of kpathsea is displayed on screen if you call hbf2gf --version.
Here is a table of the file type and the corresponding kpathsea variables.
.hbf MISCFONTS
.cfg HBF2GFINPUTS
Please consult the info files of kpathsea for details on these variables. The decision which naming scheme to use for variables will be done during compilation.
You should set the TEXMFCNF variable to the directory where your texmf.cnf configuration file resides.
Here is the proper command to find out to which value a kpathsea variable is set (we use MISCFONTS as an example). This is especially useful if a variable isn't set in texmf.cnf or in the environment, thus pointing to the default value which is hard-coded into the kpathsea library.
kpsewhich -progname=hbf2gf -expand-var='$MISCFONTS'
We select the program name also since it is possible to specify variables which are searched only for a certain program – in our example it would be MISCFONTS.hbf2gf.
A similar but not identical method is to say
kpsewhich -progname=hbf2gf -show-path='misc fonts'
[A full list of format types can be obtained by saying ‘kpsewhich --help’ on the command line prompt.] This is exactly how hbf2gf searches for files; the disadvantage is that all variables are expanded which can cause very long strings.
Here the list of suffixes and its related environment variables to be set in autoexec.bat (resp. in config.sys for OS/2):
.hbf HBFONTS
.cfg HBFCFG
If one of the variables isn't set, a warning message is emitted. The current directory will always be searched. As usual, one exclamation mark appended to a directory path causes subdirectories one level deep to be searched, two exclamation marks causes all subdirectories to be searched. Example:
HBFONTS=c:\fonts\hbf!!;d:\myfonts\hbf!
Constructions like ‘c:\fonts!!\hbf’ aren't possible.
Please consult the documentation files of MiKTeX for more details.
The x and y output size must not exceed MAX_CHAR_SIZE, which is defined at compile time; its default value is 1023 (pixel).
hbf2gf.w:
this is the source code written in CWEB which can be converted into a
pretty-printed TeX document using cweave. The CJK package also
contains a preformatted hbf2gf.pdf file.
the CJK documentation files (hbf2gf.txt).
the Hanzi Bitmap File (HBF) standard version 1.3; available at ftp.ifcss.org.
the Omega documentation available at ftp.ens.fr and the CTAN hosts and mirrors.
hbf2gf is part of the CJK macro package for LaTeX 2e available at the CTAN hosts and its mirrors.
CJK fonts together with HBF header files can be found at ftp.ifcss.org and its mirrors.
Werner Lemberg <wl@gnu.org>
Ross Paterson (the HBF API) <ross@soi.city.ac.uk>
18-Apr-2015 | CJK Version 4.8.4 |