Linux HOWTOs

About | Home | Search

HOWTO: fontconfig
Description: Library for font customization and configuration
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# FontConfig 2.13.1
# =================
# This typically comes with X, so I generally only install it this
# way if I need it on a box that doesn't have X installed on it
# (like a server that uses mrtg/rrdtool with cairo)

# If the web site link ever stops working, try here:

# If you ever want to uninstall fontconfig, or clean up files from an
# old version before installing the new one, skip down to the bottom

# Prerequisites:
# iconv
# freetype
# expat
# pkg-config
# docbook2html (Slackware includes this in the sgml-tools/linuxdoc-tools
#  package)
# pdfjadetex (Slackware's teTeX or TeX Live)

# Install/update Python lxml
su -c "pip install -U lxml"

# Get it
test -f installed/fontconfig-2.13.1.tar.bz2 &&
 mv installed/fontconfig-2.13.1.tar.bz2 .
test ! -f fontconfig-2.13.1.tar.bz2 &&
 wget --no-check-certificate \

# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "fontconfig-*" -exec rm -r {} \;
tar xjvf ~/fontconfig-2.13.1.tar.bz2
cd fontconfig-2.13.1
test $UID = 0 && chown -R root:root .

# If you don't want documentation add --disable-docs

# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
 ./configure --sysconfdir=/etc --prefix=/usr --libdir=/usr/lib64 \
--mandir=/usr/man --docdir=/usr/doc/fontconfig-2.13.1 --localstatedir=/var

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
 ./configure --sysconfdir=/etc --prefix=/usr --mandir=/usr/man \
--docdir=/usr/doc/fontconfig-2.13.1 --localstatedir=/var

# If you get an error about pdfjadetex, you may need to tell your shell
# where teTeX is:
# . /etc/profile.d/ 

# Build it

# Become root to install it

# Remove old shared library files, install it
rm -f /usr/lib*/libfontconfig.*
make install

# See the msttcorefonts HOWTO if you want to
# install some fonts.  See /etc/fonts/fonts.conf for font directory
# locations, etc.

# 'make install' does this, but remember to run this to update the font
# indexes when you install/remove fonts in the future
fc-cache -f

# Run this to list available fonts

# Become yourself again

# Save the source for later
mkdir -p -m 0700 installed
rm -f installed/fontconfig-*.tar.*
mv fontconfig-2.13.1.tar.bz2 installed/

# If you ever want to uninstall FontConfig, this should do it:
test -d src/fontconfig-* && ( cd src/fontconfig-* ; make uninstall )
## This is a bit severe, may be used by others...
#test -d /etc/fonts && rm -r /etc/fonts
( cd /usr/bin ; rm -f fc-cache fc-cat fc-list fc-match )
test -d /usr/doc/fontconfig && rm -r /usr/doc/fontconfig
find /usr/doc -maxdepth 1 -type d -name "fontconfig-*" -exec rm -r {} \;
test -d /usr/include/fontconfig && rm -r /usr/include/fontconfig
( cd /usr/man/man1 ; fc-cache.1 fc-cat.1 fc-list.1 fc-match.1 )
test -d /usr/share/doc/fontconfig && rm -r /usr/share/doc/fontconfig
rm -f /usr/lib/libfontconfig.* /usr/lib64/libfontconfig.* \
 /usr/lib/pkgconfig/fontconfig.pc /usr/lib64/pkgconfig/fontconfig.pc \
 /usr/man/man3/Fc*.3 /usr/man/man5/fonts-conf.5
test -d /var/cache/fontconfig && rm -r /var/cache/fontconfig
find ~/src -maxdepth 1 -type d -name "fontconfig-*" -exec rm -r {} \;
rm -f ~/installed/fontconfig-*.tar.*

Back to the list

Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>