Fonts

From Alpine Linux

Fonts available in Alpine Linux covers a wide range of languages. If you can't see your language and instead (tofu), a substitute character appears, you need to install the font that has glyphs (little picture) created for it. The preferred location for user installed font is ~/.fonts, especially when downloaded from unknown sources.

The system font directory /usr/share/fonts is reserved for the font packages installed using apk. The trusted system fonts that Alpine Linux packages are from well known sources like corporations like Google, Adobe, open organizations like Xorg or well known font designers or projects licensed as SIL, GPL, etc.

Warning: Fonts have been used as a source of security exploits. So always use ~/.fonts for fonts downloaded from unknown sources.


Installation

Default internal fb fonts (tty console) or xorg fonts (desktops) are suitable for a default installation. font-misc-misc is installed with Xorg, so fonts for most languages (Japanese, Korean, Latin, Cyrillic) are already covered. Exceptions are Arabic, Persian, Thai, Tamil, etc. according to the Wikipedia Page on languages for article translation.

These selections will cover most languages and are a good fit for most setups:

# apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra

These selections add special support for cyrillic languages like Russian and Serbian, etc.:

# apk add font-vollkorn font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic

These selections cover special Asiatic languages like Japanese, etc.:

# apk add font-terminus font-noto font-noto-thai font-noto-tibetan font-ipa font-sony-misc font-jis-misc

The following will add some partially supported Chinese fonts:

# apk add font-isas-misc

These selection will cover, in general Arabic, Thai, Ethiopic, Hebrew, Romanian, Persian, Korean Hangul, Greek, Persian, Russian/Slavic Cyrillic, Macedonian/Serbian, Armenian, Georgian, Lao, Devanagari, Urdu (Hindustani as in Northern India and Pakistan), Cherokee, Thaana languages support for desktop setups:

# apk add font-terminus font-noto font-noto-extra font-arabic-misc # apk add font-misc-cyrillic font-mutt-misc font-screen-cyrillic font-winitzki-cyrillic font-cronyx-cyrillic # apk add font-noto-arabic font-noto-armenian font-noto-cherokee font-noto-devanagari font-noto-ethiopic font-noto-georgian # apk add font-noto-hebrew font-noto-lao font-noto-malayalam font-noto-tamil font-noto-thaana font-noto-thai

Configuration

Changing default font

fc-cache -fv utility from fontconfig package can be used to display the font locations and to update the cache.

Some applications do not specify a specific font to use but rather say sans-serif [sans means without as in without tiny lines], serif, monospace [as in proportional square font]. This is where Fontconfig comes into place by substituting the general font type with a specific font that you like. For package developers, /etc/fonts/conf.avail contains a fontconfig configuration file. This will be symlinked into /etc/fonts/conf.d. See /etc/fonts/conf.d/README for details about the meaning behind the priority numbers.

For regular users, you want to create/edit your personal ~/.fonts.conf. This is in XML and describes which preferred font to use for these general types. See this for details.

Per-user Configuration is made in ~/.fonts.conf but it's hard to configure. An easier method is to use the ~/.Xresources file.

The following will set up for all users, a minimal resource usage for fonts. No antialiasing. No hint, etc:

# cat > /home/*/.Xresources << EOF Xft.antialias: 0 Xft.rgba: rgb Xft.autohint: 0 Xft.hinting: 1 Xft.hintstyle: hintslight EOF

Console font

The default console font built in Kernel for all monitors used to be VGA8x16. A kernel setting allowed automatic use of TER16x32 font for high resolution HiDPI monitors like UHD 4K, and enabled in Alpine Linux since v3.22. This change does not have any effect on standard Full HD monitors (1920x1080).

Changing console font

The default console font can be changed without installing additional font packages i.e making use of kernel builtin fonts like VGA8x8, VGA8x16 and TER16x32. Setting the kernel parameter fbcon=font:FONT_NAME will effect the change. Setting the kernel parameter fbcon=font:VGA8x16 for HiDPI monitors will override their default console font i.e TER16x32.

Console font can also be changed by installing better looking fonts packages like font-terminus which installs fonts in /usr/share/consolefonts.

  1. Install the font-terminus package:

    # apk add font-terminus

  2. Try out fonts in a virtual console using setfont command from kbd package as follows:

    # setfont /usr/share/consolefonts/ter-132n.psf.gz

  3. Edit the /etc/conf.d/consolefont file and set the font of your choice, e.g.

    Contents of /etc/conf.d/consolefont

    ... consolefont="ter-132n.psf.gz" ...
  4. Enable consolefont service using the command

    # rc-update add consolefont boot

Changing GRUB font and font size

The font in the GRUB boot screen might also be too small on high-resolution monitors. In order to change the default font and font size in grub, you first need install grub-mkfont package:

# apk add grub-mkfont

Then you can choose one of the fonts from /usr/share/fonts folder, say /usr/share/fonts/inconsolata/Inconsolata-Regular.otf from the font-inconsolata package. Then you can create a grub font with the desired size:

# grub-mkfont -s32 /usr/share/fonts/inconsolata/Inconsolata-Regular.otf -o /boot/grub/fonts/inconsolata-32.pf2

Here we are using size 32 but you can adjust it.

After creating the font you need to edit /etc/default/grub and add the configuration with the path for your selected font, e.g. /boot/grub/fonts/inconsolata-32.pf2:

Contents of /etc/default/grub

... GRUB_FONT=/boot/grub/fonts/inconsolata-32.pf2 ...

Finally you can run

# update-grub

and then you can reboot your system.

List of available fonts

Click font-* to view the complete list of font packages in package database. Given below is a partial list of font packages.

Font Package name Description
Utopia font-adobe-utopia-*
Noto font-noto-* These fonts covers around 1000 languages. If Alpine doesn't have a package for your language, you can search and download from Google into your ~/.font. noto comes from no to fu or gradual elimination of substitute characters off the web.
Terminus font-terminus Monospace font
BaKoMa font-bakoma-* Fonts for TeX typesetting system (for academics in the math and sciences and book writers) and TeX (WYSIWYG) editors
Bitstream Vera font-bitstream-*
Bera (Bitstream Vera Type 1) font-bitstream-type1 Use for LaTeX
Font Awesome font-awesome It was used in Twitter Bootstrap. It is a font representing things and brands as Icons.
GNU FreeFont font-freefont See link for support for different writing systems/languages
GNU Unifont font-unifont It contains glyphs of every codepoint
font-misc-cyrillic Cyrillic fonts (Russian/Slavic Style)
font-screen-cyrillic X.org public domain Cyrillic fonts for screen use
font-misc-ethiopic Ethiopic fonts used in Ethiopia and Eritrea
font-misc-misc Bitmap fonts in PCF format (shows glyphs of many types and installed by default by xorg-server package)
ClearlyU fonts font-mutt-misc Thai, Ethiopic, Hebrew,

Romanian, Persian, Korean Hangul, Greek, Persian, Russian/Slavic Cyrillic, Macedonian/Serbian, Armenian, Georgian, Lao, Devanagari, Urdu (Hindustani as in Northern India and Pakistan), Cherokee, Thaana. See link to changelog for full list of languages supported.

Overpass font-overpass
Luxi fonts font-bh-* designed by Kris Holmes and Charles Bigelow which bh is refers to the last name
IPA Font font-ipa A Japanese font
Chrome OS core fonts font-croscore
Vollkorn font-vollkorn A serif font with glyphs for Cyrillic (Russian/Slavic), Greek, Polish, Dutch, Bulgarian, Serbian, and small capitals
Open Sans font-opensans
Cantarell font-cantarell Designed for reading and the default GNOME font
DejaVu font-dejavu A modified Bitstream Vera with more styles and unicode coverage
Linux Libertine font-linux-libertine A free alternative to Times New Roman
Liberation font-liberation A free alternative to Helvetica and Arial
Inconsolata font-inconsolata A monospace font designed for terminals and reading source code
mononoki font-mononoki A font for programming and code review
Droid font-droid / font-droid-nonlatin Designed for small screens and was used in older Android
font-schumacher-misc Fixed width fonts by Dale Schumacher
font-sony-misc Japanese Kana fonts by Sony Electronics
font-cursor-misc A standard cursor font
font-sun-misc Cursor and glyph fonts by Sun Microsystems
font-winitzki-cyrillic A Cyrillic (Russian) font by Serge Winitzki designed for proofreading mixed Russian-English text
font-isas-misc Chinese Song Ti style fonts (thinner horizontal lines compared to vertical)
font-jis-misc A Japanese International Standard font
IBM Courier font-ibm-type1
font-dec-misc A Digital Equipment Corporation cursor and session fonts
font-cronyx-cyrillic A Russian font for X11 by Cronyx
font-arabic-misc A bitmap and proportional Arabic font in newspaper style [1]
Microsoft Core fonts msttcorefonts-installer Non-free proprietary Microsoft Core fonts for the Web

Due to their licensing, non-free fonts like Microsoft Core fonts are not recommended for commercial or open source projects.

See also