10.6. Configuring Fonts
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: 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 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. Make sure that the font cache is updated by running the following command: 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 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> Ensure the permissions for your directory are set to 755 . Specify the directory name when updating the font cache with the fc-cache command. 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 Copy the font to the ~/.local/share/fonts/ directory to install it. Make sure that the font cache is updated by running the following command: 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. 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: Procedure 10.15. Substituting a Font Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview , type Fonts Tweak Tool , and then press Enter . Click the Font Substitutions tab. 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 . 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 . 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: Figure 10.2. Configuring a Font Alias with Fonts Tweak Tool Procedure 10.16. Configuring a Font Alias Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview , type Fonts Tweak Tool , and then press Enter . Click the Font Aliases tab. 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. 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. 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: Procedure 10.17. Configuring Multiple Languages Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview , type Fonts Tweak Tool , and then press Enter . Click the Language Ordering tab. 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 . 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. 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: Procedure 10.18. Changing the Font Properties Start the Fonts Tweak Tool by pressing the Super key to enter the Activities Overview , type Fonts Tweak Tool , and then press Enter . Click the Fonts Properties tab. 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. Change the font properties as needed. 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.
fc-list : file fc-cache /usr/local/share/fonts/ <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <dir>/PATH/TO/YOUR/DIRECTORY_NAME</dir> </fontconfig> chmod -R 755 /PATH/TO/YOUR/DIRECTORY_NAME fc-cache DIRECTORY_NAME fc-cache ~/.local/share/fonts yum install fonts-tweak-tool yum install fonts-tweak-tool yum install fonts-tweak-tool yum install fonts-tweak-tool