1. Home
  2. Tutorials
  3. Linux Fonts
Yolinux.com Tutorial

Linux Fonts

Fonts:

Commercial Fonts:

Installing Microsoft TrueType fonts on Linux:

These instructions are for RedHat 7.3-9.0 and current Fedora Core RPM based distribution running on x86 compatable hardware. Downloads and in-depth instructions for other platforms can be found at CoreFonts.sourceforge.net.

Follow these steps to build an RPM (as root):

  1. Download: cabextract-0.6-1.i386.rpm
  2. Install RPM: rpm -ivh cabextract-0.6-1.i386.rpm
  3. Download: msttcorefonts-1.3-4.spec
  4. Create RPM: rpmbuild -bb msttcorefonts-1.3-4.spec
    (This downloads Microsoft CAB files and extracts the fonts and builds an RPM. Uses wget, rpm-build, chkfontpath, fc-cache, ttmkfdir)
  5. This creates /usr/src/redhat/RPMS/noarch/msttcorefonts-1.3-4.noarch.rpm

Installing RPM: msttcorefonts-1.3-4.noarch.rpm

  • rpm -ivh msttcorefonts-1.3-4.noarch.rpm
  • Restart X server:
    • RedHat 9.0 - Fedora Core: /sbin/service xfs reload
    • RedHat 8.0: /sbin/service xfs restart

Links:

Linux/Unix X-Window Font Tools:

Man pages for /usr/X11R6/bin/

  • xfontsel - point and click selection of X11 font names
  • showfont - font dumper for X font server
  • xlsfonts - List all the fonts on your system
  • fslsfonts - List fonts served by X font server
  • mkfontdir - create an index of X font files in a directory
  • fsinfo - X font server information utility
  • fstobdf - generate BDF font from X font server
  • xfd - display all the characters in an X font
  • xfs - X font server
  • chkfontpath - simple interface for adding, removing, and listing directories in the X font server's path
  • fc-cache - create an index of FreeType font files in a directory

Linux Font Installation:

Copy fonts to the appropriate font directory:

  • System font path: (as specified by config file /etc/X11/fs/config)
    • /usr/X11R6/lib/X11/fonts/
    • /usr/share/fonts/
  • Local user font path: ~/.fonts
Register the fonts with X-Windows and then use the command fc-list to verify that fonts are available to the system.
[prompt ~]$ fc-list
KacstLetter:style=KacstLetter
KacstBook:style=KacstBook
Gothic:style=Bold
Courier:style=Regular
URW Palladio L:style=Italic
AR PL KaitiM GB:style=Regular
Cursor:style=Regular
sys:style=Italic
fxd:style=Regular
Luxi Mono:style=Bold Oblique
Courier:style=Bold
sys:style=Regular
Bitstream Charter:style=Bold
Baekmuk Gulim:style=Regular
URW Bookman L:style=Demi Bold Italic
fxd:style=Bold Italic
...
...
...

Example: Add TrueType Fonts to the system (as root) Red Hat 7.3+ or xfs based Linux system:

  • Create font directory: mkdir -m 755 /usr/X11R6/lib/X11/fonts/TrueType
  • Copy all ".ttf" files to the above directory. (Lower case and no spaces in the file names):

    Script to convert files with upper case names to lower case file names:

    do
    b=`echo $a | awk '{print tolower($0)}'`
    mv $a $b
    done
  • chmod 644 *.ttf
  • ttmkfdir > fonts.scale
  • Create index of X font files in directory: /usr/X11R6/bin/mkfontdir
    (Red Hat 7.0: package freetype, 7.3+: package xorg-x11-font-utils)
  • Add font directory to the xfs config file: /etc/X11/fs/config
    catalogue = comma-separated-list-of-font-directories
  • Update font-config cache: /usr/bin/fc-cache
  • /usr/sbin/chkfontpath --add /font-directory-path
  • xset fp rehash
  • service xfs restart
    (or: /etc/init.d/xfs restart)
  • Restart X:
    • init 3
    • init 5

Gnome Font Manager Tools:

  • GNOME font configuration: /usr/bin/redhat-update-gnome-font-install
  • GNOME font properties: /usr/bin/gnome-font-properties
  • GNOME font viewer: /usr/bin/gnome-font-viewer
Path and names reflect Fedora Linux distro.

Links: