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 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
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.

Check in a few applications to see if the newly copied font has been made available. A terminal emulator or an office program should work nicely for this purpose.

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

Emoji and symbols

root #emerge --ask media-fonts/noto-emoji
Note
Once installed, Noto Emoji can be configured selected for use as a fallback font (used when a glyph does not exist in the selected font) for emoji symbols using the following command:
root #eselect fontconfig enable 75-noto-emoji-fallback.conf
Web browsers tend to use their own font selection logic, simply installing the package is enough.

Currently available through the GURU overlay:

root #emerge --ask media-fonts/symbola

Non-Latin scripts

Gentoo doesn't install many fonts by default; if a character needs to be displayed that the system does not have a glyph for it will be rendered using the .notdef character also known as tofu this is typically:

  • a little square which is often empty, ☐
  • a box with an X in it, ☒
  • a box with a question mark in it, ⍰
  • a box containing the unicode code point

The web browser used to view this page renders it as 􏿾.

Note
The Noto (no tofu) font family provides a single (if large) package that contains a consistent set of glyphs covering most commonly used languages.

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

Language Package(s)
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

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