10.6. Configuring Fonts

Red Hat Enterprise Linux 7 uses the fontconfig utility for font management and customization. fontconfig simplifies font management and provides display features, such as anti-aliasing. This section describes the following font management tasks:
  • adding new fonts (both for one user and for all users)
  • specifying fonts to use in place of missing fonts
  • configuring font aliases
  • defining font preferences per language
  • customizing font properties
To compile a list of fonts available on the system, fontconfig searches directories that are by default listed in the /etc/fonts/fonts.conf configuration file.
To list all fonts installed on the system that are known to fontconfig, you can use the fc-list command:
$ fc-list : file
For more information on fc-list, see the fc-list(1) man page.
For more information on fontconfig and its configuration, see the fonts-conf(5) man page.

10.6.1. Adding Extra Fonts for All Users

You can install an extra font which will be available to users in applications that use fontconfig for font handling.

Procedure 10.12. Installing an Extra Font

  1. To install the font, copy it to the /usr/local/share/fonts/ directory. If that directory does not exist, create it.
  2. Create a subdirectory for each font-family you are installing as some fonts have multiple files for bold, italic, and so on.
  3. Make sure that the font cache is updated by running the following command:
    $ fc-cache /usr/local/share/fonts/

Important

fontconfig will detect the new fonts and make them available. Unlike user sessions, some applications might need to be restarted before they will allow you to use the new fonts, though.

Using Alternative Directories

Alternatively, you can also install fonts in another system directory than /usr/local/share/fonts/ if that directory is listed in the /etc/fonts/fonts.conf file. If it is not, then you need to create your own machine-wide configuration file in /etc/fonts/local.conf containing the directory you want to use. See the fonts-conf(5) man page for more information.
If you are using an alternative directory, remember to specify the directory name when updating the font cache with the fc-cache command:
$ fc-cache directory_name

10.6.2. Adding Extra Fonts for Individual Users

You can install an extra font which will be available to a specific user on your system in applications that use fontconfig for font handling.

Procedure 10.13. Installing an Extra Font

  1. Copy the font to the ~/.local/share/fonts/ directory to install it.
  2. Make sure that the font cache is updated by running the following command:
    $ fc-cache ~/.local/share/fonts

Important

fontconfig will detect the new fonts and make them available. You may need to restart running applications to see the changes. User sessions do not need to be restarted.

10.6.3. Substituting Fonts

When an application requests a font that is not available on the system, fontconfig reads the /etc/fonts/fonts.conf configuration file to determine the most similar available font to substitute for the requested font. Individual characters can also be substituted if they are not present in the requested font.
To configure a font substitution for a specific font, you can use the Fonts Tweak Tool. Note that the tool can only be used for per-user configuration.
Substituting Fonts with Fonts Tweak Tool

Figure 10.1. Substituting Fonts with Fonts Tweak Tool

Fonts Tweak Tool may not be installed by default on the system, to install it, run the following command:
# yum install fonts-tweak-tool

Procedure 10.14. Substituting a Font

  1. Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview, type Fonts Tweak Tool, and then press Enter.
  2. Click the Font Substitutions tab.
  3. Click the + button at the bottom left of the left pane, select or type the name of the font you want to substitute, and then click Add.
  4. Click the + button at the bottom left of the right pane, select the name of the font you want to use to substitute for the first font, and then click Add.
  5. Click Close.
Now, you have substituted an old font with your favourite which is now available to you.

10.6.4. Configuring Font Aliases

For each locale, Fonts Tweak Tool allows the individual users to configure different font aliases:
  • Sans Serif,
  • Serif,
  • Monospace,
  • Cursive, and
  • Fantasy.
These aliases are used to represent common types of fonts, such as the serif and monospace types. Applications as well as users can then refer to these aliases instead of having to specify a particular font installed on the system.
Users can override system default fonts by selecting a custom font for each of these aliases.
Fonts Tweak Tool may not be installed by default on the system, to install it, run the following command:
# yum install fonts-tweak-tool
Configuring a Font Alias with Fonts Tweak Tool

Figure 10.2. Configuring a Font Alias with Fonts Tweak Tool

Procedure 10.15. Configuring a Font Alias

  1. Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview, type Fonts Tweak Tool, and then press Enter.
  2. Click the Font Aliases tab.
  3. Click the + button at the bottom left of the left pane, select or type the name of the locale you want to configure the font aliases for, and then click Add.
    To configure default font aliases regardless of the used locale, select Default from the list of locales.
  4. At the right pane, locate the font alias you want to override the system defaults for, and select the custom font from the drop-down list.
  5. Click Close.
Now, you have overriden the system default alias and selected a new custom font.

10.6.5. Multiple Language Ordering

Fonts Tweak Tool allows users who have multiple languages configured for the user interface to change the order in which the languages are displayed in applications. This feature is especially useful for users who use both Latin and non-Latin based fonts and do not want to use the non-Latin based fonts to display Latin characters.
For example, if you have Japanese and English configured as your languages, and you want to avoid displaying English Latin characters with your Japanese non-Latin based fonts, configure English as the primary language, and Japanese as secondary. The Latin-based fonts will then be used to display English characters, and the non-Latin based fonts will only be used to display Japanese characters.
Fonts Tweak Tool may not be installed by default on the system, to install it, run the following command:
# yum install fonts-tweak-tool

Procedure 10.16. Configuring Multiple Languages

  1. Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview, type Fonts Tweak Tool, and then press Enter.
  2. Click the Language Ordering tab.
  3. Click the + button at the bottom left of the window, select or type the name of the language you want to configure as primary, and then click Add.
  4. To add another language, click the + button at the bottom left of the window, select the name of the language you want to configure as secondary, and then click Add.
    Repeat this step to add more languages.
  5. Click Close.

Important

For the user interface, you have now set your preferences in the order in which the languages are displayed in applications.
When multiple languages are configured, some applications (such as xterm and other Xft applications) may not display all characters for the user's languages properly. This is due to the lack of support for fallback fonts in those applications, or in the rendering libraries the applications are using.

10.6.6. Configuring Font Properties

Fonts Tweak Tool lets users change various font properties, allowing for fine-grained per-user font configuration.
Fonts Tweak Tool may not be installed by default on the system, to install it, run the following command:
# yum install fonts-tweak-tool

Procedure 10.17. Changing the Font Properties

  1. Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview, type Fonts Tweak Tool, and then press Enter.
  2. Click the Fonts Properties tab.
  3. Click the + button at the bottom left of the window, select or type the name of the font you want to change the properties for, and then click Add.
    Repeat this step to add more fonts.
  4. Change the font properties as needed.
  5. Click Close.
Depending on the added font, some of the font properties that the user can configure in the Fonts Properties tab include:
Use the embedded bitmap font if available.
This is useful for users who prefer bitmap fonts over outline fonts. To use the embedded bitmap font, add a suitable font and click Use embedded bitmap font if any.
Use the JIS X 2013:2004 glyphs.
To use Japanese glyphs from the JIS X 2013:2004 standard, rather than from JIS X 2013:2000 or older, add a font that supports JIS X 2013:2004, and then click on jp04 in the Features list.