Difference between revisions of "Fonts"

From ArchWiki
Jump to navigation Jump to search
m (Removed link to Fonts FAQ, it redirected back to this very page)
Line 12: Line 12:
{{Article summary heading|Related articles}}
{{Article summary heading|Related articles}}
{{Article summary wiki|MS Fonts}}
{{Article summary wiki|MS Fonts}}
{{Article summary wiki|Fonts FAQ}}
{{Article summary wiki|Xorg Font Configuration}}
{{Article summary wiki|Xorg Font Configuration}}
{{Article summary end}}
{{Article summary end}}

Revision as of 01:19, 15 January 2008

Template:Article summary start Template:Article summary text Template:Article summary heading Template:I18n entry Template:I18n entry Template:Article summary heading Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end


A standard ArchLinux desktop installation provides an excellent font support, with the latest stable versions of the X.org X server, freetype2 (with bytecode interpreter enabled) and fontconfig. For more information on font configuration please see: Font Configuration

Different Kinds of Fonts

There exists different kinds of fonts for Linux.

  • bitmap fonts (.pcf .bdf .pcf.gz .bdf.gz)
  • PostScript fonts (.pfa .pfb)
    (pfa: ascii format; pfb: binary format)
  • TrueType/OpenType fonts (.ttf)
    (OpenType fonts with quadratic outlines have also .ttf suffix)
  • PostScript flavored OpenType fonts (.otf)
  • TeX bitmap fonts (.pk)
    (usually automatically generated from the METAFONT source .mf)
  • TeX virtual fonts (.vf)

Installing fonts

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Adding fonts in modern Linux system is much easier than before. Here I try to post a short tip aiming to make it more understanding by average users. First thing must be where I should put fonts inside. Usually you should put them under:

  • /usr/share/fonts
  • /usr/X11R6/lib/X11/fonts

This will make everybody on the system to be able to use them, however it requires root privileges. Copying them into:

  • ~/.fonts

folder is a good idea too.

Some font collections have been prepackaged for use in Arch Linux, search them by:

pacman -Ss fonts

Among the packages available you will see

extra/artwiz-fonts 1.3-1
    This is set of (improved) artwiz fonts.
extra/ttf-ms-fonts 1.3-6
    Un-extracted TTF Fonts from Microsoft

Then if you want to install these two packages, do:

pacman -S artwiz-fonts ttf-ms-fonts

This will install the fonts into /usr/X11R6/lib/X11/fonts dir. CJK (Chinese/Japanese/Korean) users are encouraged to install also ttf-arphic-uming, ttf-arphic-ukai and ttf-fireflysung for a proper display.

Another option is to use KDE Font Installer in the KDE Control Center. This seems to work flawlessly if you use KDE.

You can also manually copy fonts into above three directories, but don't forget to run as root:

fc-cache -vf

Mostly you are lucky to use them in your X windows environment like gnome, xfce4 or kde. However, some GTK1 or old applications don't support fontconfig. (Really? someone should check this and then fix it) You have run following commands in your fonts directory (in the terminal of course):

  ln -s /usr/share/fonts/encodings/encodings.dir yourfontdirectory/encodings.dir 

ex: if you-re using kde

   ln -s /usr/share/fonts/encodings/encodings.dir ~/.fonts/

then usually you need restart X.

If you want to share such fonts or keep from above manual operation, you can make an Arch package. Save the fonts you wish to install as a tar.bz2 and use a variation of the following PKGBUILD and .install to install them via ABS:

  pkgdesc=\"Fonts extra\"
  build()        {
    mkdir -p $startdir/pkg/usr/X11R6/lib/X11/fonts/local
    mv $startdir/src/*.ttf $startdir/pkg/usr/X11R6/lib/X11/fonts/local
# fonts-extra.install:
  # arg 1:  the new package version
  post_install() {
    echo -n \"updating font cache... \"
    cd /usr/X11R6/lib/X11/fonts/local
    ln -s /usr/X11R6/lib/X11/fonts/encodings/encodings.dir /usr/X11R6/lib/X11/fonts/local/encodings.dir
    echo \"done.\"

  # arg 1:  the new package version
  # arg 2:  the old package version
  post_upgrade() {
    post_install $1

  # arg 1:  the old package version
  pre_remove() {


  $op $*

Font Packages in Archlinux

NB: This is a selective list, but it does also include most font packages from AUR.

  • Hebrew
    • culmus - nice collection of free Hebrew fonts
  • Thai
    • ttf-thai - font covering glyphs for thai
  • Khmer
    • ttf-khmer - font covering glyphs for khmer language
  • Braille
    • ttf-ubraille - font containing symbols for braille (unicode)
  • “Programmer's fonts” (for coding and terminal display)

Best fonts for terminal

The best fonts for a terminal depends on what terminal emulator you are using and what features it supports. For example, it even depends on how your fonts.dir looks, as sometimes fonts get installed incorrectly. It also depends on how you have configured your X Server, if you use freetype2 or freetype1, if you use the autohinter with the bytecode interpreter compiled into freetypeN, if you have compiled in the BI but doesn't use the autohinter, if you have not compiled in the BI and use the autohinter, if you have not compiled in the BI but uses the autohinter, etc.

A top favorite of some Arch Linux users is Terminus (in community as "terminus-font").

Some other fonts to try out:

  • Lucida Typewriter
  • Andale Mono
  • Bitstream Vera Mono
  • Courier
  • Terminal
  • Test
  • Gamov
  • default8x16
  • monospace

Example how to use Terminus:

xterm -bg black -fg gray -fn -xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso8859-1
xterm -bg black -fg gray -fn -xos4-terminus-bold-r-normal--14-140-72-72-c-80-iso8859-1

Fonts in virtual console

Default font in virtual console can display only ASCII characters. If you use other characters you can change the CONSOLEFONT and CONSOLEMAP settings in your /etc/rc.conf file. Different fonts can be found in /usr/share/kbd/consolefonts directory and key maps can be found in the subdirectories of /usr/share/kbd/keymaps.


For displaying characters like "č ć ž đ š" use lat2-16.psfu.gz font:


Also, don't forget to set the proper key map, in this case:


Beautify Fonts for LCD in X

This method of beautifying fonts has been tested with GNOME/Xfce/KDE.

Remove Packages:

pacman -Rd cairo libxft freetype2

Install Packages

Install the *-lcd libraries:

pacman -S cairo-lcd libxft-lcd

Install the package freetype2-lcd from AUR

makepkg -ci /full/path/freetype2-lcd-*.pkg.tar.gz

Reset your font configuration:

As root:

rm /etc/fonts/conf.d/*
pacman -S fontconfig

Set the FreeType autohinter. As root :

ln -s /etc/fonts/conf.avail/10-autohint.conf /etc/fonts/conf.d/10-autohint.conf

Restart X11 (ctrl+alt+backspace)

At this point if you think fonts look too bold, modify the fonts configuration file: edit (or create if it doesn't exist yet) the file ~/.fonts.conf with the following content:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<match target="font" >
<test compare="more" name="weight">
<edit mode="assign" name="autohint">


Q. My fonts are too large or too small. The resolution seems wrong. My fonts are mis-shapen.

A(1). Read the Display Size/DPI section of Xorg for configuration sample settings and formula.

A(2). Get your proper resolution from a console, by typing:

xdpyinfo | grep resolution

Change the value to this in the Gnome font configurator. Restart X. Sometimes, the videocard gives bogus information to X. It may be better to settle on a value between 72-78 DPI for 1024x768 displays. 96 DPI is a good value for 1280x1024, but it depends on the exact resolution. I actually prefer 75 on my home machine, and the font sizes seem to be a bit more true to their proper sizes when this is set. In most cases, if the numbers don't match, you may use the following method.

You may also opt to force X to start with a forced resolution. This may produce good results in some display modes. For example, you may use:

startx -- -dpi 75

This will force X to start in 75x75 DPI mode. You may change your Gnome font settings (From the menu: Applications/Desktop Preferences/Font) to 75 DPI and you should get a good match.

If this worked well for you, you may edit your "startx" script to always force this option on startup. Edit the file "/usr/bin/startx" as root.

Change the following line:



defaultserverargs="-dpi 75"

Q. How do I install fonts?

A. An easy way to install fonts is to drop them into your "$HOME/.fonts" directory and running "fc-cache". You can also perform a system-wide font installation by copying the fonts to "/usr/share/fonts" or another font directory (as long as it is listed in your "/etc/fonts/fonts.conf" file), and then performing the "fc-cache" command as root. You may also need to run "ttmkfdir" or "mkfontdir" as well.

Q. The fonts in GNU Emacs are displayed as squares.

A. You need to install the xorg-fonts-75dpi or xorg-fonts-100dpi package.

Q. The fonts in OpenOffice.org look very bad.

A. By default, OpenOffice.org for Linux ships with inferior LibFreetype libraries that are built directly into the code. In the past you could force it to link to the latest version of your LibFreetype libraries by setting the following in a script. But for now (Jan 2008), you can't do anything about it.

export LD_PRELOAD=/usr/lib/xorg/modules/fonts/libfreetype.so

Q. The OpenOffice.org menu font looks really bad. It doesn't use antialiasing either.

A. This can be changed in the OpenOffice.org configurator. From the drop-down menu, select "Tools/Options/OpenOffice.org/Fonts". Check the box that says "Apply Replacement Table". Type "Andale Sans UI" in the font box (this may have to be input manually, if it doesn't appear in the drop-down menu) and choose your desired font for the "Replace With" option. Dropline users may prefer the system default, "Trebuchet MS". When selected, click the checkmark box. Then choose the "always" and "screen" options in the box below. Apply the changes, and your menu fonts should look great.

Q. OpenOffice.org doesn't detect my TrueType fonts!

A. Make sure that you add the appropriate entry in your /etc/X11/xorg.conf file that points your programs to the /usr/share/fonts/ directory.

For example, here's a sample of an xorg.conf file

Section "Files"
    RgbPath         "/usr/share/X11/rgb"
    ModulePath      "/usr/lib/xorg/modules"
    FontPath        "/usr/share/fonts/misc"
    FontPath        "/usr/share/fonts/75dpi"
    FontPath        "/usr/share/fonts/100dpi"
    FontPath        "/usr/share/fonts/TTF"
    FontPath        "/usr/share/fonts/Type1"

Another solution is to run the openoffice administration tool

# /opt/openoffice/spadmin

from which you can add fonts.

Q. Mozilla and other programs can no longer access TrueType fonts on my system, and are reverting to ugly fonts instead.

A. Make sure the "freetype" module is loaded in your /etc/X11/xorg.conf file and your /usr/share/fonts/TTF/fonts.dir lists all of the TrueType fonts you have installed.

Try checking your "Files" section of your xorg.conf, and make sure that you have all (or most) of these directories listed.

Section "Files"
    RgbPath         "/usr/share/X11/rgb"
    ModulePath      "/usr/lib/xorg/modules"
    FontPath        "/usr/share/fonts/misc"
    FontPath        "/usr/share/fonts/75dpi"
    FontPath        "/usr/share/fonts/100dpi"
    FontPath        "/usr/share/fonts/TTF"
    FontPath        "/usr/share/fonts/Type1"

Finally, go to the following font directories:


Try deleting the "fonts.dir" and "fonts.scale" files in these directories. You may want to make backups first though. Run these commands to replace them.


Make sure you restart X for the changes to come into effect.

Q. What are some suggested font settings for Mozilla/Firefox?

A. These are recommended for Firefox:

Proportional: Serif   Size (pixels): 16
Serif: Times New Roman
Sans-serif: Arial
Monospace: Courier New   Size (pixels): 13
Display resolution: System settings
  • Note: Times New Roman may appear to be a non-TTF font. If this is the case, read above about how to fix this.

I believe that the following are Dropline's Mozilla defaults (also recommended):

Proportional: Serif   Size (pixels): 14
Serif: Times New Roman
Sans-serif: Verdana
Cursive: Andale Mono
Fantasy: Andale Mono
Monospace: Courier New   Size (pixels): 11
Allow Documents to use other fonts: Enabled
Display resolution: System settings

Q. Why do my Apps show squares when there should be arrows and the like?

A. It may help to activate bitmap fonts. They are disabled by default.

cd /etc/fonts/conf.d
rm 10-bitmaps.conf
ln -s yes-bitmaps.conf 10-bitmaps.conf
cd -

If you think your fonts look ugly now then consider to remove the following packages.

pacman -Rs xorg-fonts-100dpi xorg-fonts-75dpi

Read here and here for some background info.

Q: I just upgraded via pacman -Syu and my fonts are all ugly

A: There are several possible conflicting issues here. See these threads:

1 - http://bbs.archlinux.org/viewtopic.php?t=866

2 - http://bbs.archlinux.org/viewtopic.php?t=4975