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.
Almost always, somebody has been there before you and solved at least part of whatever problem you are now having. In my case a source of much useful information (on 6th July 2004) was found at The Linux Documentation Project: en.tldp.org/HOWTO/FDU/truetype.html. Most of the help I needed was found from the afore referenced page.
Note, this article discusses what I had to do to get TrueType fonts working on a system on which SuSE Linux 8.1 had been installed. Other versions of SuSE Linux had slightly different procedures:
Making TrueType fonts work with SuSE 9.2 (very easy).
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!
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.
In order to have X-Windows, and hence KDE, use the TrueType fonts that we need to inform the X-Windows system where those fonts are being held. This can be done by modifying the XFree86 configuration file. On my SuSE Linux 8.1 system the configuration file is located at: /etc/X11/XF86Config
In this file it is necessary to add a reference to the font directory that has just been created. A line should be added in the “fonts” section:
I put this line in at the beginning of the “fonts” section — ahead of all the other FontPath lines. Of course, if you put the fonts in a different directory then you should make reference to whatever directory you chose to use.
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. The script also will create two other files that the X-Windows system needs before it will use the fonts.
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. # ---------------------- # Once the TrueType fonts are properly # installed, you must create both fonts.dir # and fonts.scale files. The following commands # do this: # # If you have SuSE 8.x you might need to use # the following command instead of using the # mkfontscale command. #ttmkfdir -o fonts.scale # The ttmkfdir command is not included in SuSE 9.0 # so in that case you need to use the fontscale # command instead. mkfontscale mkfontdir # This script needs to be placed in the # directory with the font files. Give it a # name with lower-case letters because it is # going to rename itself to lower-case anyway. # If, when you execute the script, it gives you # some cryptic error message for line 7, to the # effect of "binary operator expected" then it is # likely that your file names contain spaces and # you have ommitted some double-quotes in the # script. # (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.
This script was created by copying two sections of information from the web site mentioned above and simply merging them into one script, then adding some extra comments and making a simple alteration for use with SuSE 9.0. 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.
Attention: The script might need to be modified if you are not using SuSE 9.0 — the instructions are in the script itself so please check before you use it. If the ammendment is needed then running the script without the ammendment probably won't create a disaster, but neither will it get your fonts working ...
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.
Before I could execute the script with SuSE 8.1 it was necessary to use the SuSE YaST program to install the “ttmkfdir” program from the SuSE DVD/CDROM. However with SuSE 9.0 the “ttmkfdir” program isn't supplied at all so, instead, you need to use a program called “mkfontscale” which is supplied. The script knows about both of these programs but you will need to edit the script by hand to ensure that the program you are not using is commented out.
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.
If KDE is already running then the X-server can be restarted using Ctrl-Alt-Backspace. If it is not already running then it can be started from a shell prompt using the command init 5; it will probably be necessary to be logged in as root to do this.
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.
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.
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.
There does not appear to be a single control panel for all the KDE font requirements so two stages were needed:
KDE desk top icons: Right-click an empty part of the KDE desktop, choose the “configure desktop” option from the menu and then, when the configuration window opens, click the “desktop” icon and then choose the “appearance” panel. Inside this panel is the font setting for your icon titles.
KDE menus: Bringup the launcher menu (somewhat similar to the Windows “start” menu) and choose [preferences—look and feel—fonts]. This will show a window in which there are six font options for you to change.