Do not just throw .ttf files someplace on your system. It makes migrations more difficult, and makes a big mess in your computer. Package management software like RPM lets you easily install your fonts in an organized standard way, manage font upgrades, and make massive font distribution a piece of cake.
Here we'll provide templates and instructions for you to easily build RPM packages of your fonts. We'll accept contributions with instructions to build different types of packages.
To build RPMs, you need a special structure of directories and some configurations on your environment. You should do everything as a regular user, in all steps. In fact, we recommend that you do not do this as root.
To create this directories, do this:
bash$ cd ~ bash$ mkdir -p src/rpm bash$ cd src/rpm bash$ cp -r /usr/src/redhat/* . bash$ ls BUILD/ RPMS/ SOURCES/ SPECS/ SRPMS/ bash$ |
(the "~" is an alias to the current user's home directory name, and the command line knows it should interpret it this way)
Of course this is on a Red Hat system, but the important point is to have the following directories under src/rpm:
BUILD/
RPMS/noarch/
SRPMS/
Then, you'll have to create the .rpmmacros file in you home directory, with this single line content:
%_topdir YOUR_HOME_DIR_HERE/src/rpm |
And you should substitute YOUR_HOME_DIR_HERE with the absolute name of your $HOME directory. So as an example, my .rpmmacros file contains this line:
%_topdir /home/aviram/src/rpm |
Now you must think about a name for your font collection. To make things easy in this documentation, we'll use the name myfonts from now on. Then you must create a directory named ~/src/myfonts/myfonts (yes, myfonts two times) and put all your .ttf files right under it. So you'll have something like:
bash$ cd ~/src bash$ find myfonts/myfonts/ myfonts/myfonts/ myfonts/myfonts/font1.ttf myfonts/myfonts/font2.ttf myfonts/myfonts/font3.ttf ... |
To build an RPM package you'll have to create a .spec file that provides instructions to the package builder on how to organize the files, package description, author, copyright, etc. We provide a template here that you can use to start your work. The template looks like this:
Example 1. The .spec file template
You must change the following items to meet your package characteristic's (leave everything else untouched):
This file must be named as the name of the package - myfonts.spec in our example. And you must put it under the main directory of the package. So in the end we'll have something like this:
bash$ cd ~/src bash$ find myfonts myfonts/ myfonts/myfonts.spec myfonts/myfonts/ myfonts/myfonts/font1.ttf myfonts/myfonts/font2.ttf myfonts/myfonts/font3.ttf ... |
We are almost ready to go. Next steps:
bash$ cd ~/src bash$ tar -czvf myfonts.tar.gz myfonts bash$ rpmbuild -ta myfonts.tar.gz |
Done (after seeing a lot of messages about the building process). So we basically created a .tar.gz containing all our font files and myfonts.spec, and then we used rpmbuild on it, that will look for myfonts.spec inside the archive and follow its instructions.
You'll find the generated RPM under ~/src/rpm/RPMS/noarch/ directory, and this is the file you'll deploy and install. Under ~/src/rpm/SRPMS/ you'll find the source RPM file, which you should backup if you need to regenerate the deployable RPM again in the future. When you'll need it, you should do:
bash$ rpmbuild --rebuild myfonts-1.0-1.src.rpm |
And the RPM file will be generated again.
For more information and advanced RPM packaging, read the Maximum RPM book, available in many formats in the rpm.org site.