Project 16B: Installing TrueType Fonts for Use with Core X

 < Day Day Up > 



Now that you’ve learned the easy font installation method, let’s try the second method, which is a bit more cumbersome, at least initially. This method, which I’ll call the “X method,” installs fonts globally for use with the much older core X font subsystem. In general, you don’t really need to worry too much about this method unless you need to install fonts for use with the GIMP, which is not handled by fontconfig.

16B-1: Installing Fonts Using the X Method

To install fonts with the X method, follow these steps:

  1. Create a new folder in your user’s Home folder window and call it myxfonts.

  2. Drag the fonts you want to install into the new myxfonts folder. Let’s use the remaining two fonts you downloaded earlier.

  3. Open a Terminal window and become root.

  4. Create a new system folder for your new X fonts called xsysfonts by typing the following command and pressing ENTER: mkdir /usr/share/fonts/xsysfonts/

  5. Copy the fonts from your myxfonts folder to the system xsysfonts folder by typing the following command and pressing ENTER:

    cp myxfonts/*.ttf /usr/share/fonts/xsysfonts

    This will copy all of the fonts in your myxfonts folder, so make sure that only the fonts you want to install are there.

  6. Type cd /usr/share/fonts/xsysfonts and press ENTER to move over to the xsysfonts folder.

  7. Type ttmkfdir > fonts.scale and press ENTER. Don’t forget to put a space on either side of the > character. This, to put it simply, translates the names of the fonts in the directory into the lengthy font-naming format that the core X font subsystem understands. The font grudge.ttf, for example, becomes -misc-Grudge-medium-r-normal — 0-0-0-0-p-0-iso10646-1 in core X lingo.

  8. Type in mkfontdir and press ENTER. This creates an index of the fonts in the directory so that the core X font subsystem knows what’s in there.

  9. Finally, teach your system where to find the new xsysfonts folder by typing in the following command and pressing ENTER:

    /usr/sbin/chkfontpath -a /usr/share/fonts/xsysfonts
    Note 

    You don’t need to perform step 9 again when adding additional fonts in the future using the X method.

You’re done, so restart your machine and take a well-deserved break with the beverage of your choice. Once you’re done drinking, and your computer has booted back up, you will find that your fonts appear in the font menus of most of the programs on your machine, including OpenOffice.org.

To make things easier on yourself in the future, I recommend backing up all the files in the myxfonts folder in your Home folder to CD or floppy. After doing that, you can trash the original fonts still in the myxfonts folder so as to avoid installing them again by accident and to save disk space. You might as well keep the folder itself, however, as you might want to use it again when you install new fonts in the future.

16B-2: Uninstalling Fonts Installed with the X Method (Optional)

To uninstall any of the fonts you install using the method introduced in 16B-1, follow these steps:

  1. Open a new Terminal window and become root.

  2. Type cd /usr/share/fonts/xsysfonts and press ENTER.

  3. Type rm fontname.ttf (replacing fontname with the name of the font you want to remove) and press ENTER. Repeat this step for each of the fonts you want to remove.

  4. After you have finished removing all the fonts you want to remove, type ttmkfdir > fonts.scale and press ENTER. Remember to put a space on either side of the > character.

  5. Type mkfontdir and press ENTER.

  6. Exit out of the Terminal. The fonts will be gone once you restart your system, though you needn’t do that immediately.



 < Day Day Up > 



Linux for Non-Geeks. A Hands-On, Project-Based, Take-It-Slow Guidebook
Linux for Non-Geeks: A Hands-On, Project-Based, Take-It-Slow Guidebook
ISBN: 1593270348
EAN: 2147483647
Year: 2003
Pages: 188

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net