Signup/Sign In
PUBLISHED ON: FEBRUARY 15, 2023

How to use Linux addftinfo command?

addftinfo is a command line tool which is included in the groff package (GNU replacement for the `troff` and `nroff` typesetting utilities). It reads a troff font file and adds some additional font-metric information that is used by the groff system and writes to the standard output.

Using some parametric information about the typeface and presumptions for the conventional troff names for characters, the information is added. The heights and depths of characters are the key new information. The font argument is the name of the file specifying the font; if the font ends in I, the font is presumed to be italic. The res and unitwidth arguments should match the equivalent values in the DESC file.

All other choices alter a factor that is used to calculate heights and depths. Each number is in inches/res for a typeface whose point size is unit width, just like the other amounts already present in the font file.

Syntax of addftinfo command

addftinfo [-asc-height n] [-body-depth n] [-body-height n] [-cap-height n] [-comma-depth n] [-desc-depth n] [-fig-height n] [-x-height n] res unitwidth font

How to install addftinfo command?

addftinfo command is included in the groff package. Here is how you can install groff package in different Linux distribution.

Debian/ubuntu - apt-get install groff
Alpine - apk add groff
Arch Linux - pacman -S groff
CentOS - yum install groff
Fedora - dnf install groff
OS X - brew install groff
Raspbian - apt-get install groff

Screenshot of ubuntu terminal install groff package to install addftinfo with apt tool.

addftinfo command options

--x-height The height of lowercase letters without ascenders such as x.
--fig-height The height of figures (digits).
--asc-height The height of characters with ascenders, such as b, d or l.
--body-height The height of characters such as parentheses.
--cap-height The height of uppercase letters such as A.
--comma-depth The depth of a comma.
--desc-depth The depth of characters with descenders, such as p, q, or y.
--body-depth The depth of characters such as parentheses.
-h, --help (or any undefined tag) Display usage.
-v, --version Output version information.

addftinfo makes no attempt to use the specified parameters to guess the unspecified parameters. If a parameter is not specified the default will be used. The defaults are chosen to have the reasonable values for a Times font.

Examples:

1. Execute addftinfo without any parameter.

addftinfo doesn't exit with an error to infer the unknown parameters from the supplied parameters. A parameter's default value will be used if it is not given. The defaults were selected to have values that are appropriate for a Times typeface. When we try to run a raw addftinfo command without any other arguments or options. It displays the default help message.

$ addftinfo
usage: addftinfo [-v] [-param value] ... resolution unitwidth font

2. add information to troff font files

addftinfo is used with all parameter options or all other choices to alter a factor that is used to calculate heights and depths. Each number is in inches/res for a typeface whose point size is unitwidth, just like the other amounts already present in the font file.

The following syntax must be used:

addftinfo [-paramOption value] resolution unitwidth font

Conclusion

In this article, we learnt about addftinfo command which comes with the groff package, how to install and use it.



About the author:
Pradeep has expertise in Linux, Go, Nginx, Apache, CyberSecurity, AppSec and various other technical areas. He has contributed to numerous publications and websites, providing his readers with insightful and informative content.