addftinfo Command in Linux



addftinfo is a command-line tool that allows you to add essential font-metric information to troff font files (tff) for use with the groff typesetting system. In simple terms, the addftinfo tweaks the fonts so that they can play nicely with the groff, especially when you are creating beautifully formatted documents on Linux.

When you execute the addftinfo command, it will read the existing ttf file from the system and then add some magic to it. This magic includes additional details about the font’s character heights and depths. However, you need to specify the parameter values so that the addftinfo command will read them and add magic to the file.

Table of Contents

Follow this guide to get a detailed understanding of −

How to Install addftinfo Command in Linux?

The addftinfo command tool is included in the groff package, which is not installed on most Linux systems by default. However, you can install the groff package directly from the Linux repository using the below-given apt command −

sudo apt install groff -y
addftinfo Command Linux 1

Note − The above command will work for Linux systems like Ubuntu, Debian, Linux Mint, Raspberry Pi OS and other such apt-based systems.

For Alpine Linux, the command to install groff utility will be −

apk add groff

For CentOS, you can use the below-given command −

yum install groff

The Arch Linux, users can run the below-given command for installing groff

pacman -S groff

If you are macOS users, you can install the groff utility through the below-provided command −

brew install groff

And the Fedora users can use the following command to install groff utility on their systems −

dnf install groff

Once you complete the groff installation, you can confirm the addftinfo installation on Linux by running the following version command −

addftinfo --version
addftinfo Command Linux 2

Syntax to addftinfo Command

The basic syntax to use addftinfo command on Linux is provided below −

addftinfo [ –paramvalue... ] res unitwidth font

Here,

  • addftinfo command reads the tff file and adds additional font metric information to the file.
  • res specifies the resolution (in dots/inch) of your output device.
  • unitwidth specifies the character’s width, usually measured in inches.
  • font refers to the font file name you want to enhance, and it should be in the format ttf. If you have font file with different names, you can convert them into ttf first.
  • [ –paramvalue... ] are optional parameters that can be used to specify values from various font metrics.

These options are described in the below-given table −

Options Description
-x-height The lowercase letters’ height without the ascenders, such as the letter ‘x
-asc-height The characters’ height with ascenders, such as letters ‘b’,’d’, or ‘l’.
-body-height The characters’ height, such as parentheses.
-body-depth The character’s depth, such as parentheses.
-fig-height The figures’ height (digits).
-cap-height The uppercase letters’ height, such as the letter A.
-comma-depth The comma’s depth.
-desc-depth The characters’ depth with a descender, such as the letter ‘p’, ‘q’, or ‘y’.
-v or --version Displays the version of the addftinfo command.
-h or --help Opens up the help section on the terminal to display the command’s usage.

Basic Example of addftinfo Command

Here, we have added a basic example to help you understand how you can use the addftinfo command on Linux. In the below-provided syntax, we have added all the options that can be used with the addftinfo command. You can remove an option according to your choice from the below-given syntax −

addftinfo -asc-height 0.6 -body-depth 0.3 -body-height 0.4 -cap-height 0.5
-comma-depth 0.2 -desc-depth 0.3 -fig-height 0.7 -x-height 0.5 75 10 ttf_filename

Make sure to replace the ttf_filename with the name of the ttf file that you want to use. You can change the parameter values according to your choice. Also, ensure the ttf file must be present at the current location.

Note − You will find the ttf files in the /usr/share/fonts location on the Linux systems.

In the following command, we have used the ttf file named NotoSerifYezidi-Bold.ttf and added information to the file using the addftinfo command −

addftinfo -asc-height 0.6 -body-depth 0.3 -body-height 0.4 -cap-height 0.5
-comma-depth 0.2 -desc-depth 0.3 -fig-height 0.7 -x-height 0.5 75 10 NotoSerifYezidi-Bold.ttf
addftinfo Command Linux 3

Conclusion

The addftinfo is a command line application used to read the ttf files and add additional font-metric information. You can use the addftinfo command by installing the groff package on your Linux system from the default repository. Once done, you can use the parameters with the addftinfo command individually or use them all at once to derive the heights and depths of characters.

We have provided the syntax and basic example for addftinfo command in this guide. It will help you understand the workings of the addftinfo command so that you can use it with your ttf files.

Advertisements