fonts.dir for TrueType fonts

Roland Smith rsmith at xs4all.nl
Wed Dec 30 14:59:03 UTC 2015


On Thu, Dec 24, 2015 at 12:39:39PM -0500, Robert Ames wrote:
> > From: brandon.wandersee at gmail.com
> > To: robertames at hotmail.com
> > CC: freebsd-questions at freebsd.org
> > Subject: Re: fonts.dir for TrueType fonts
> > Date: Thu, 24 Dec 2015 10:33:40 -0600
> > 
> > 
> > Robert Ames writes:
> > 
> > > In the Handbook, under section "5.5.2. TrueType Fonts" it states:
> > >
> > >> Once the files have been copied into this directory, use ttmkfdir
> > >> to create a fonts.dir, so that the X font renderer knows that these
> > >> new files have been installed. ttmkfdir is available from the FreeBSD
> > >> Ports Collection as x11-fonts/ttmkfdir.
> > >  
> > > ttmkdir is not in the current Ports Collection.  So how does one 
> > > create fonts.dir?
> > >
> > > I'm assuming the Handbook is out of date so I guess what I'm really
> > > asking is how does one add TrueType fonts?
> >
> > Fonts I've added to ~/.fonts have always just worked, as have fonts
> > installed from ports. Are you having an issue with a particular font, or
> > were you just following along in the Handbook and got stuck when it
> > called for x11-fonts/ttmkfdir?
> 
> Just following along in the Handbook.  I've installed TrueType fonts in
> /usr/local/share/fonts/TrueType/ and added a FontPath to /etc/X11/xorg.conf.
> Was just making sure there was nothing else I needed to do.

Instead of querying the X-server, most modern applications (including those
built on the GTK+ and QT toolkits) these days use the fontconfig library in
combination with freetype to discover fonts. By default, this is set to look
for fonts in /usr/local/share/fonts and /usr/local/lib/X11/fonts and
subdirectories. So any new fonts you put there should be found automatically
after running fc-cache(1) to renew the cache.

Like presumably many others I have a collection of fonts that I use and install on all
my machines. The following is the script that I use to install these fonts and
make them visible to the system.

    #!/bin/sh
    if [ `id -u` -ne 0 ]; then
        echo "This script must be run as root."
        exit 1
    fi

    FDIR=/usr/local/share/fonts/local/

    # Remove all files to make sure we don't leave any cruft.
    rm -f $FDIR/*

    install -C -m 644 -v *.otf *.ttf *.pfb $FDIR

    # Update fontconfig cache
    fc-cache -svf $FDIR

As you can see I don't bother using mkfontscale.

Roland
-- 
R.F.Smith                                   http://rsmith.home.xs4all.nl/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 5753 3324 1661 B0FE 8D93  FCED 40F6 D5DC A38A 33E0 (keyID: A38A33E0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20151230/88c60474/attachment.sig>


More information about the freebsd-questions mailing list