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. As the root user, create the /usr/local/share/fonts/ directory and copy the font into it.
    Create a subdirectory for each font-family you are installing as some fonts have multiple files for bold, italic, and so on.
  2. 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.

10.6.2. Adding Extra Fonts for All Users 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 that directory is not listed in the /etc/fonts/fonts.conf file, you need to create your own machine-wide configuration file in /etc/fonts/local.conf.

Important

Do not edit the /etc/fonts/fonts.conf file because it will be replaced when the fontconfig library is updated.

Procedure 10.13. Installing an Extra Font

  1. As the root user, create your own machine-wide /etc/fonts/local.conf configuration file including the directory with fonts.
         
    <?xml version="1.0"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
        <dir>/PATH/TO/YOUR/DIRECTORY_NAME</dir>
    </fontconfig>
    
  2. Ensure the permissions for your directory are set to 755.
    # chmod -R 755 /PATH/TO/YOUR/DIRECTORY_NAME
  3. Specify the directory name when updating the font cache with the fc-cache command.
    # fc-cache DIRECTORY_NAME

10.6.3. 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.14. 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.4. 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.15. 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.5. 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.16. 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.6. 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.17. 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.7. 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.18. 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.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.