Fonts
From ArchWiki
Article summary |
---|
Covers the selection and installation of fonts on Arch Linux. |
Available in languages |
English |
Italiano |
繁體中文 |
Español |
Русский |
Legal |
Certain font licenses may impose some legal limitations. |
Related articles |
Font Configuration |
Java Fonts - Sun JRE |
MS Fonts |
This article is about adding fonts. For information about font configuration, please see: Font Configuration.
Contents |
Font formats
Most computer fonts used today are in either bitmap or outline data formats. Bitmap fonts store fixed images for each glyph in each typeface and point size. Outline or vector fonts store characters as instructions for drawing each glyph's lines and curves. Outline fonts scale smoothly in size over a wide range.
Common font filename extensions include:
- bdf and bdf.gz – bitmap fonts, bitmap distribution format and gzip compressed bdf
- pcf and pcf.gz – bitmaps, portable compiled font and gzip compressed pcf
- psf, psfu, psf.gz and psfu.gz – bitmaps, PC screen font, PC screen font Unicode and the gzipped versions
- pfa and pfb – outline fonts, PostScript font ASCII and PostScript font binary. PostScript fonts carry built-in printer instructions.
- ttf – outline, TrueType font. Originally designed as a replacement for the PostScript fonts.
- otf – outline, OpenType font. TrueType with PostScript typographic instructions.
For most purposes, the technical differences between TrueType and OpenType can be ignored, some fonts with a ttf extension are actually OpenType fonts.
Other formats
The typesetting application, TeX, and its companion font software, Metafont, render characters using their own methods. Some of the file extensions used for fonts by these two programs are *pk, *gf, mf and vf.
FontForge, a font editing application, can store fonts in its native text-based format, sfd, spline font database.
Installation
Various methods of installing fonts.
Pacman
Fonts and font collections in the enabled repositories can be installed using pacman. Available fonts may be found by using:
# pacman -Ss font
Or to search for ttf fonts only:
# pacman -Ss ttf
Creating a package
If you want to give pacman the ability to manage your fonts, you can create an Arch package. These can also be shared with the community in the AUR. Here is an example of how to create a basic package. To learn more about building packages, read PKGBUILD.
pkgname=ttf-fontname pkgver=1.0 pkgrel=1 depends=('fontconfig' 'xorg-font-utils') pkgdesc="custom fonts" source=(http://someurl.org/$pkgname.tar.bz2) install=$pkgname.install build() { mkdir -p $startdir/pkg/usr/share/fonts/TTF cp $startdir/src/*.ttf $startdir/pkg/usr/share/fonts/TTF }
This PKGBUILD assumes the fonts are TrueType. An install file (ttf-fontname.install) will also need to be created to update the font cache:
post_install() { echo -n "Updating font cache... " fc-cache -f > /dev/null mkfontscale /usr/share/fonts/TTF /usr/share/fonts/Type1 mkfontdir /usr/share/fonts/TTF /usr/share/fonts/Type1 echo "done." } post_upgrade() { post_install $1 } op=$1 shift $op $*
Manual installation
The recommended way of adding fonts to your system that are not in the repositories is described in #Creating a package. This gives pacman the ability to be able to remove or update them at a later time. Fonts can alternately be installed manually as well.
To install fonts system-wide (available for all users), move the folder to the /usr/share/fonts/ directory. To install fonts for only a single user, use ~/.fonts/ instead.
Then update the font cache:
$ fc-cache -vf
Older applications
With older applications (GTK1...) that do not support fontconfig (e.g. xfontsel) the index will need to be created in the font directory:
$ mkfontscale $ mkfontdir
Or, to include more than one folder with one command:
$ for dir in /font/dir1/ /font/dir2/; do xset +fp $dir; done && xset fp rehash
Font packages
This is a selective list that includes many font packages from the AUR along with those in the official repositories.
Arabic
- ttf-sil-lateef - Unicode Arabic font from SIL (AUR)
- ttf-sil-scheherazade - Unicode Arabic font from SIL (AUR)
- arabeyes-fonts - Collection of free Arabic fonts (AUR)
Braille
- ttf-ubraille - Font containing Unicode symbols for braille
Chinese, Japanese, Korean, Vietnamese
- ttf-arphic-ukai - Kaiti (brush stroke) Unicode font (enabling anti-aliasing is suggested)
- ttf-arphic-uming - Mingti (printed) Unicode font
- ttf-fireflysung - New Sung font
- wqy-zenhei - Hei Ti Style (sans-serif) Chinese Outline font embedded with bitmapped Song Ti.
- wqy-bitmapfont - Bitmapped Song Ti (serif) Chinese font
- ttf-hannom-usong - Song Ti quality TrueType fonts for Unicode Han and Nom (Chinese and Vietnamese) characters (AUR)
- otf-ipafont - Japanese Gothic (san-serif) and Mincho (serif) font set; one of the highest quality open source fonts (AUR)
- ttf-vlgothic - Japanese Gothic fonts. Default of Fedora-ja/Ubuntu-ja/Vine Linux (AUR)
- ttf-ume - Japanese font set includes Gothic/Mincho and several weights (AUR)
- ttf-aquafont - Handwritten fixed-width TrueType font (AUR)
- ttf-baekmuk - Collection of Korean TrueType fonts (AUR)
- ttf-alee - Set of free Hangul TrueType fonts (AUR)
- ttf-unfonts-core - Un fonts (default Baekmuk fonts may be unsatisfactory) (AUR)
Cyrillic
See: Unicode below
- font-arhangai - Mongolian Cyrillic (AUR)
Hebrew
- culmus - Nice collection of free Hebrew fonts
Indic
- ttf-freebanglafont - Font for Bangla
- ttf-indic-otf - Indic Opentype Fonts collection (containing ttf-freebanglafont)
Khmer
- ttf-khmer - Font covering glyphs for Khmer language
Latin
- font-bh-ttf - Xorg Luxi fonts
- ttf-cheapskate - Font collection from dustismo.com
- ttf-isabella - Calligraphic font based on the Isabella Breviary of 1497
- ttf-junicode - Junius font containing almost complete medieval latin script glyphs
- ttf-ms-fonts - Un-extracted fonts from Microsoft. Note: Trebuchet Bold, trebucbd.ttf, is missing from this package.
- ttf-ms-fonts-lic - Cleaner alternative to the above (AUR)
Sinhala
- ttf-lklug - Sinhala Unicode font (AUR)
Tamil
- ttf-tamil - Tamil Unicode fonts (AUR)
Thai
- ttf-thai - Font covering glyphs for Thai
Programmer
- dina-font
- terminus-font
- ttf-inconsolata-g (AUR)
- DejaVu Sans Mono (from package ttf-dejavu), Lucida Typewriter (included in package jre).
Math
- font-mathematica - Mathematica fonts by Wolfram Research, Inc.
- ttf-mathtype - MathType fonts (AUR)
- ttf-computer-modern-fonts - Flagged out of date as of 2009-11-14 (AUR)
Unicode
- ttf-dejavu - Extension and replacement of Bitstream Vera
- ttf-liberation - Collection of free fonts developed for Red Hat
- ttf-linux-libertine - Replacement for Times New Roman
- ttf-freefont - Clones of Times, Helvetica and Courier with large Unicode support but unequal quality
- ttf-mph-2b-damase - Covers full plane 1 and several scripts
- ttf-liberastika - Liberation fonts with the Cyrillic glyphs redrawn (AUR)
- ttf-sil-fonts - Gentium, Charis, Doulos, Andika and Abyssinica from SIL (AUR)
Recommendations
Some recommendations for different types of uses.
International users
- Chinese
- wqy-zenhei (Hei Ti embedded with bitmapped Song Ti, also supporting Japanese (partial) and Korean characters), ttf-arphic-ukai (Kai Ti) , ttf-hannom-usong (Song Ti, supporting Vietnamese characters)
- Japanese
- otf-ipafont
- Korean
- ttf-baekmuk
Desktop Environments
- ttf-ms-fonts - Official Microsoft Fonts
- ttf-dejavu - Popular Linux Serif and Sans-Serif fonts
- ttf-liberation - Fonts designed by Red Hat to replace Microsoft Fonts on Linux
- ttf-arkpandora - Alternative to Arial and Times New Roman fonts
Unneccessary:
- xorg-fonts-75dpi and xorg-fonts-100dpi - old bitmap fonts installed with the Xorg server. It is safe to remove these.
Terminals
Here are some suggestions. Every user has their own preference, experiment to find one that suits you.
- Andale Mono
- Bitstream Vera Mono
- Courier
- Courier New
- Default 8x16
- Dina
- DejaVu fonts (ttf-dejavu)
- Gamov
- Inconsolata
- Liberation Mono
- Lucida Typewriter
- Monaco
- Monospace
- Profont
- Proggy Clean
- Terminus
Console fonts
The console, meaning a terminal running with no X windows, uses the ASCII character set as the default. This font and the keymap used are easily changed.
A console font is limited to either 256 or 512 characters. The fonts are found in /usr/share/kbd/consolefonts/. Keymaps, the connection between the key pressed and the character used by the computer, are found in the subdirectories of /usr/share/kbd/keymaps/.
Previewing and testing
Unfortunately, no organized library of images is available to preview console fonts. The user can, however, use setfont to temporarily change the font and be able to consider its use as the default. The available glyphs or letters in the font can also be viewed as a table with the command showconsolefont.
If the newly changed font is not suitable, a return to the default font is done by issuing the command setfont without any arguments. If the console display is totally unreadable, this command will still work—the user just types in setfont while "working blind."
Note that setfont only works on the console currently being used. Any other consoles, active or inactive, remain unaffected.
Examples
Change the font. This example is distinctive:
$ setfont /usr/share/kbd/consolefonts/gr737b-9x16-medieval.psfu.gz
Or change the font to one with 512 glyphs and set the keymap to ISO 8859-5 using the -m option:
$ setfont /usr/share/kbd/consolefonts/LatArCyrHeb-16.psfu.gz -m 8859-5
Then issue commands that send text to the display, perhaps view a manpage and try vi or nano, and view the table of glyphs with the command, showconsolefont.
Return to the default font with,
$ setfont
Changing the default font
To change the default font, the CONSOLEFONT= and CONSOLEMAP= settings in /etc/rc.conf must be altered. Again, the fonts can be found in /usr/share/kbd/consolefonts/ directory and keymaps can be found in the subdirectories of /usr/share/kbd/keymaps/.
Examples
For displaying characters such as Č, ž, đ, or š, using the font lat2-16.psfu.gz:
CONSOLEFONT="lat2-16.psfu.gz"
Set the proper keymap, in this case:
CONSOLEMAP="8859-2"
To use the specified font in early userspace, that is, early in the bootup process, add the keymap hook to /etc/mkinitcpio.conf:
HOOKS="base udev autodetect pata scsi sata filesystems keymap"
Then rebuild the image:
# mkinitcpio -p kernel26