
tfmtodit Command in Linux
The tfmtodit command generates a font description file from a TeX Font Metric (TFM) file, making it compatible with groff and its grodvi output driver. This is helpful when inspecting or modifying font metrics.
Table of Contents
Here is a comprehensive guide to the options available with the tfmtodit command in Linux −
Syntax of the tfmtodit Command
The syntax if tfmtodit command in Linux is as follows −
tfmtodit [options] tfm-file map-file font
In the above syntax −
- tfm-file is the input file containing TFM (TeX Font Metric) data, which includes font metrics like character width, height, depth, and kerning.
- map-file is an encoding file that maps characters from the TFM file to a specific character set for typesetting or editing.
- font is the output file containing the generated human-readable or editable font description.
The [options] field is used to specify options to modify the command's output.
tfmtodit Command Options
The options for the tfmtodit command are listed below −
Options | Description |
---|---|
-g gf-file | Use the specified Metafont .gf file to include special and numspecial metrics. |
-k skew-char | Set the skew character position (decimal, octal 0, or hex 0x). Ignores kerns involving this character. |
-s | Add a special directive to the output file. |
-v, --version | Display version info and exit. |
--help | Show usage and exit. |
Examples of tfmtodit Command in Linux
This section explores how to use the tfmtodit command in Linux with examples −
Creating a Font Description File
To create a font description file from a TFM file, use the tfmtodit command in the following way −
tfmtodit file.tfm text.enc output
In the above command −
- tfm is the input TFM file. It contains the metrics for a specific font used in TeX/LaTeX documents.
- enc is an encoding file that maps characters from the font to their corresponding encoded values. The encoding file is necessary for interpreting how the TFM file's font metrics should be applied to text.
- output is the destination for the conversion. The output file will contain the font description.

The above output provides a groff font description file. It includes the font name, internal name, space width, checksum, and design size. The charset section lists characters with their corresponding metrics, such as width and character codes.
Adding Special Directive
To add a special directive to the output file, use the -s option −
tfmtodit -s file.tfm text.enc output

Using a Specific Metafont File
To use a specific metafont file or .gf file to include special and numspecial metrics, use the -g option followed by the metafont file −
tfmtodit -g file.gb file.tfm text.enc output
Setting the Skew Character Position
To set the skew character and ignore the kerning, use the -k option followed by the value. The value can be given in decimal, octal, and hexadecimal −
tfmtodit -k 0x25 file.gb file.tfm text.enc output
In the above command, the 0x25 specifically refers to the percent sign (%). If used in a command like -k 0x25, it means that the percent sign (%) is being specified as the skew character, and any kerning adjustments involving this character would be ignored.
Displaying Usage Help
To display the usage help for the tfmtodit command, use the --help option −
tfmtodit --help
Conclusion
The tfmtodit command in Linux is a tool for creating a font description file from a TFM (TeX Font Metric) file. This is useful for inspecting or modifying font metrics. The command offers various options, such as adding special directives, using specific Metafont files, or setting skew character positions. It is generally used to convert a TFM file into a format compatible with the DVI output device for tools like groff.