TrueType fonts, SuSE Linux 9.0 and KDE.

Persuading SuSE Linux (version 9.0) and KDE 3.1.x to co-operate in the use of TrueType fonts.

While using OpenOffice and Opera, both running under KDE and SuSE Linux, I had for a long time put-up with some fonts that really didn't look very nice. Eventually I found some time for research and discovered that bringing some TrueType fonts into use was not actually very difficult. In fact, when I came to repeat the process on subsequent computers, it only took about five minutes per computer.
Content revision history:
  • Article first written, 11th September 2004
  • Updated with better instructions, 24th September 2004.
  • Updated 14th August 2010 to incorporate a sensible script improvement offered by Gary Hoberg.

Preamble

Note, this article discusses what I had to do to get TrueType fonts working on a system on which SuSE Linux 9.0 had been installed. Other versions of SuSE Linux had slightly different procedures:

Making TrueType fonts work with SuSE Linux 8.1

Making TrueType fonts work with SuSE 9.2 (very easy).

Step 1: Create a directory containing the TrueType font files.

The directory that is going to contain the TrueType fonts must be permanently available while the X graphics system is running. Let us imagine that the directory is called /usr/TrueTypeFonts. Of course, you can call it something else if that is more convenient — just don't forget what you call it!

Step 2: Copy the TrueType font files.

Copy the .TTF files for the required TrueType fonts to the directory you just created. After copying the files, make sure that their file permissions are set to allow read access by anybody.

Step 3: Script file to convert file names to lower case

It is necessary to convert all the file names to lower case and to remove any space characters that the names contain. If any file names contain spaces then you will have to rename them by hand, unless you have a clever program to do it for you. However you might be happy to know that the following script will perform the tedious job of converting all the names to lower-case.

Create an executable text file containing the following script:

#!/bin/sh
 #
 ## -------- convert upper to lower case ---------
 
 ls * | while read f
  do
    if [ -f "$f" ]; then
      if [ "$f" != "`echo \"$f\" | tr A-Z a-z`" ]; then
       #Note that 'This' will overwrite 'this'!
       mv -iv "$f" "`echo \"$f\" | tr A-Z a-z`"
      fi
    fi
  done
 
# Note the punctuation -- the backquotes are
# important!  Remove any spaces from font names
# too.

# (Thank you Gary Hoberg for pointing offering a
# useful improvement to the script originally 
# presented on this page)

# ----------------------

 
# eof

Well, I don't suppose you really want to type that little lot do you? And even cutting and pasting can be a real nuisance sometimes so here is a link to a text file that contains the above script: text file with script. You still have a little work to do because you will still need to set the correct permission bits to make it executable and put it in the right place — don't just go rushing off to execute it wherever it happens to be because then bad things might happen.

The working parts of this script were originally copied from another web site (*). It will convert all the font file names to lower case and then compile two necessary files. This script file must be placed in the directory that contains the font files and executed from there.

To save yourself a little puzzle later please note that the script file will rename everything in the directory, including itself, so you might as well give it the script lower-case name to start with. Also if you get a message that says something about a binary operator expected on line 7 then it is likely that your file names contain spaces and you have missed some of the double quotes in the script. File names that have spaces in them need to be double-quoted or they won't get renamed properly, or at all, and, depending on the actual name of the file, might cause other undesirable side effects. So, you get the idea I'm sure, either remove the spaces first or make sure you have placed all the double-quotes correctly.

Also please note that the programs used by the script might have extra options that are pertinent to your situation or requirements so you might do yourself a favour by finding and reading and any appropriate documentation.

Step 4: Ensure the X server is not running.

Life is simpler and less confusing if the X-server is not running while you do all of these things. If you are logged-in as root at an ordinary text console then you can type “init 3” to stop the X-server. Later you will restart it with the command “init 5”.

Step 5: Execute the script file

Well, if you have edited the script appropriately, put it in the right place and set the permission bits correctly then now you can go ahead and run the script just created. When it has completed its work all of the file names should have been changed to lower case. One possible problem is that if you had two files that have the same name with different cases (for example “penguin.ttf” and “PENGUIN.TTF”) then the script will not perform correctly. Make sure that each font is represented by only one TTF file.

Step 6: Create links to your TrueType font files

You need to create some links to your font files so that the X-server knows where to find them. If you have a standard installation then the X-server already has a directory for true type fonts. That directory is: /usr/X11R6/lib/X11/fonts/truetype

Relocate yourself to that directory and then execute the following command:

ln -s /usr/TrueTypeFonts/*.ttf .

Naturally, if you didn't put your fonts into a directory called /usr/TrueTypeFonts then make sure you use the name of the directory that you did create.

Step 7: Run SuSEconfig

While logged-in as root at a text console type the following simple command.

SuSEconfig -module fonts

Step 8: Restart the X-server.

While logged in as root, type the command init 5. Once the computer tells you that runlevel 5 has been reached, you can press ALT-F7 to switch to the graphics console.

Step 9: Everything works, or perhaps not.

At this stage my TrueType fonts were available for use. If further help is needed then refer to en.tldp.org/HOWTO/FDU/truetype.html or find some other helpful web document.

Step 10: Printing and applications

Printing

Since I was using a postscript printer (a Kyocera FS1700 with postscript option) I did not need to do any further work to get the fonts to print.

Opera web browser

The Opera browser needed to be told to start using some of the newly installed fonts. This was achieved through the “preferences” dialogue boxes, obtained from the pull down menus or by pressing ALT-P.

KDE

For some reason I couldn't find the “preferences” option button on my desktop menu — I'm sure it used to be there but fortunately it isn't difficult to create a special button. A preferences button can be added to the panel with the following simple steps:

  • Right-click on a blank portion of the panel
  • Choose Add
  • Choose Add — Special button
  • Choose Add — Special button — preferences

Once the button is installed in the panel you can click the button and then choose “appearance and themes” followed by “fonts”. This should bring up a small font configuration window that allows you to select the fonts for the desktop, menus and so on. All of your newly installed TrueType fonts should be available to pick from.

 

End of article

Pertinent links

SuSE Linux
Purveyors of various distributions of GNU/Linux.
Opera
The fine web browser that was using horrid, ugly fonts until I installed the TrueType ones. Opera is available for Linux, Windows and some PDAs. It is also available in various languages.
Kyocera-Mita
Manufacturers of the least troublesome printer I ever owned. It has been working almost flawlessly with all of my DOS, Windows and Linux software since 1997.
XFree86 web site
This might be a good place to look for any documentation that you think you might need. The XFree documentation is moderately comprehensive and readable. If nothing else it might give you some clues about the questions you should be asking.
The KDE project website
A good place to begin, though perhaps not to end, your search for information about the KDE environment.

 

Navigation: (site map) learn linux home pagetechnical articles