Fixing font file names

The Characteristics of a Typeface (for widescr...

Image by arnoKath via Flickr

So you want to rationalise your font directory? Let’s face it, who doesn’t?

I had a bunch of old CDs lying around with fonts scattered throughout them. Going through each in turn I copied all the font files into a single working directory:

find -iname "*.ttf" -exec cp "{}" ~/fontwork

I also threw my installed fonts into the mix:

cp ~/.fonts/* ~/fontwork

fontwork ended up containing 1300+ files. Many of these had awful names like “basd12.ttf”. Just awful.

I decided to fix them up by extracting the embedded family and style information. Neither apt-cache nor google could find me an existing utility to pull out this info, so I quickly wrote one using the excellent freetype2 library. It’s imaginatively called fontinfo. I also wrote a little shell script to rename the font files and remove duplicates.

You can snag both from my github repository.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s