Fonts

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources

Fonts are a core part of the system and are necessary in order to represent text on a display.

The best starting point for general information about configuration, use and management of fonts on Gentoo, particularly for software running under X or a Wayland compositor (including terminal emulators), is the Fontconfig page.

Additionally:

  • For information about configuring fonts for the Linux console specifically (rather than for GUI-based terminal emulators), refer to the Fonts/Console page.
  • For information about software for working with fonts, refer to the Fonts/Software page.
  • For background on font-related concepts, terminology, and systems (e.g. Unicode), refer to the Fonts/Background page.

Home directory

When installing fonts on a local basis, each user can create a .local/share/fonts directory in their home directory. This directory can then be filled with font files:

user $mkdir -p ~/.local/share/fonts
user $cp ~/Downloads/Inconsolata.otf ~/.local/share/fonts

To make a newly-installed font available, refresh the Fontconfig cache via fc-cache(1):

user $fc-cache -fv

Use an application such as a terminal emulator or an office program to confirm that the font is now available.

Note
Historically, the ~/.fonts directory was used to store fonts on a per-user basis. The modern equivalent is ~/.local/share/fonts.
Note
Fonts can also be installed in a subfolder of the ~/.local/share/fonts directory.

Globally available

System administrators (those with root privileges) can copy fonts into the system's /usr/local/share/fonts directory. This will make fonts available to any user on the system.

root #cp /home/larry/Downloads/Inconsolata.otf /usr/local/share/fonts

Font installation to support viewing more scripts

Gentoo doesn't install many fonts by default. If a character needs to be displayed, but no font is available to display it, it will be rendered using the .notdef character, informally known as tofu. Tofu is typically displayed as either:

  • an empty square, ☐;
  • a box with an X in it, ☒;
  • a box with a question mark in it, ⍰;
  • a box containing the Unicode code point in hexadecimal.

Google's "Noto" typeface family is an attempt to provide a single typeface with glyphs for all assigned Unicode code points; the name "Noto" is an abbreviation of "No Tofu". (Refer to the "Writing systems" section of the Fonts/Background page for an explanation of the word glyph and related terminology.)

On Gentoo, the Noto family is available via the media-fonts/noto, media-fonts/noto-cjk, and media-fonts/noto-emoji packages.

Once installed, Noto Emoji can be configured for use as a fallback font (used when a glyph does not exist in the selected font) for Emoji by running:

root #eselect fontconfig enable 75-noto-emoji-fallback.conf

Note that Web browsers tend to use their own font selection logic; often simply installing the package is sufficient.

Non-Latin scripts

If support for additional glyphs is required consider installing a selection of the following packages:

Language Package(s)
Arabic media-fonts/arabeyes-fonts media-fonts/noto
Bengali media-fonts/lohit-bengali media-fonts/noto
Japanese media-fonts/mikachan-font-ttf media-fonts/noto-cjk
Korean media-fonts/alee-fonts media-fonts/noto-cjk
Persian media-fonts/farsi-fonts media-fonts/noto
Tamil media-fonts/lohit-tamil media-fonts/noto
Thai media-fonts/thaifonts-scalable media-fonts/noto

Symbols

One option for a symbol font is Symbola, provided by the media-fonts/ttf-ancient-fonts::guru package in the GURU overlay. This font has previously been provided by the media-fonts/symbola::guru package, which is now obsolete.

Non-latin font in TTY (in for example Ctrl-Alt-F2)

See available fonts in /usr/share/consolefonts/

For example, you want to fix the output of Cyrillic text in TTY:

FILE ~/.config/bash/bashrc
# If tty (without X)
if [[ "$TERM" = "linux" ]]; then
    setfont cyr-sun16
    # Without this - I see tofu (squares) on Cyrillic output from translate-shell
fi

Additional package considerations

media-fonts/fonts-meta (Meta package for fonts to cover most needs):

root #emerge --ask media-fonts/fonts-meta

Microsoft's TrueType media-fonts/corefonts:

root #emerge --ask media-fonts/corefonts

See also

External resources