# Automatic Font Generation

If you want to employ Automatic Font Generation Function, you must specify the font creation procedure in a file of Template for Font Creation. The template file must be specified -gen:. According to the template file, dviout creates the batch file and executes it. The batch file contains information on such as the required font names and sizes.
Of course, first of all, you should check that METAFONT is already installed and works properly (cf. Q_F6).
If METAFONT sources for missing fonts are not found or the specified parameters are not proper, some fonts would not be created automatically. Even so, dviout create a batch file which describe necessary routines. Executing this batch file by manual, you can create missing fonts.
The dviout package has a sample of the template file named "template". You should refer this file. The format of this file is following:
If you use only one line at %2nd, you can write this line in -gen: directly instead of the template file. In this case, add an apostrophe ` at the beginning of the specification line.
A line which starts with # is a comment line, and this line is not output to the batch file. However, there is only one exception. If the second character is an exclamation point !, the line is output unchanged.
# This statement is not output.
#! This line is output..
The template file has four sections. Each section is delimited by the three lines beginning with the % character
%1st
%2nd
%3rd
The section before the line of %1st, some special parameters is specified. You can specify four parameters in this section.
auto=no : This disables the automatic font generation which is done by a child process. Only the batch file with the name specified in gen_font is generated.
extra_size=300 : In addition to the missing font(s) in required resolution, you may want to create that font(s) with different resolution. In that case, you can specify the resolution in dpi for that fonts. The value of this parameter is also referred in the ^e calculation.
gen_tmp= : This specifies the name of the batch file used in a child process. The file name must be a full path name. The default is gen_tmp.bat in the directory indicated by the TMP or TEMP environment variables (Current Directory if it does exists).
gen_font= : This specifies the name of the batch file for creating a font when the child process is not successful. The file name must be a full path name. The default is gen_font.bat.
mode_name= : This specifies the relation between the dpi value and the METAFONT mode name. The format is
mode_name=<dpi value>:<mode name>
For example, "mode_name=300:CanonCX" denotes that the mode CanonCX is employed when font generation for 300 dpi.
You can specify this mode_name line repeatedly in the template file. However put these lines after the "extra_size=" line.
In the second part, between %1st and %2nd, preprocessing commands for batch file such as echo off are specified. Postprocessing commands such as error processing are specified in the fourth part, after %3rd.
In the third part, between %2nd and %3rd, the actual routine for font creation is specified. You can use the notation in the form "^ + lowercase letters (for example, ^s)" to specify command information for font generation. In execution of the font generation process, following strings in the command are interpreted (replaced) as
^s : the name of a missing (required) font.
^m : the magnification of the missing font.
^d : the size (dpi x magnification) of the font.
^D : the dpi of the font.
^M : the fraction equals to ^d/^D. For example, if^d=1500 and ^D=600, then ^M=2+300/600.
^n : the mode name for the dpi.
^N : the mode name for dpi set by "extra_size=."
^e : (dpi x magnification) specified in the first section of the template file.
When some fonts are missing in a dviout session, you may also want to create the font in different resolution from required one. In this case, for example, specify the dpi as "extra_size=360" in the first section of the template file.
If you want to output a string containing the caret ^ to a batch file, use two carets ^^. For example, ^^s will result in a string ^s in a batch file.
Here is some examples of the Template for Font Creation.