HOWTO: Add TrueType Fonts (.ttf)


Forum: DSL Tips and Tricks
Topic: HOWTO: Add TrueType Fonts (.ttf)
started by: fodder

Posted by fodder on June 03 2007,07:24
Notes:
  As with most things in Linux there are multiple ways to do everything, however, this is how I got TTFs to work on my systems.
  In addition, these instructions are for setting up your system to load the new fonts each time you boot.
  And finally, these are very detailed instructions, the kind I wish I had had a few months ago when I started dabbling in DSL so I could have learned some of the basics of simply how to do things in this distro.  For those of you who are not beginners, just look at the bold text and don't be bothered with the minutia. :)

HOWTO: Add TrueType Fonts to DSL (Tested on DSL 3.3)

Major step 1: Install XFree86
 a) Download XFree86.dsl from MyDSL repository
   - Click on the "MyDSL" icon on your desktop.
   - Click on "System".
   - Scroll to the bottom of the list and click on "XFree86.dsl".
   - Click "Download".
   - Set the "To Dir:" to "/hda1" and click "Download". (Or set the directory to wherever you save your MyDSL extensions to - see the "Getting Started With DSL, myDSL section" that pops up on boot for more info.)

 b) Edit .xserverrc
   - Right-click on the Emelfm icon on your desktop and select "emelFM as super-user".
   - The left panel should be at /ramdisk/home/dsl and the capital "H" just under "Bookmarks" should be pressed.
   - Scroll down to ".xserverrc", select it, then click "Edit" in the center column - this will open a text editor (probably Beaver.)
   - Change the line that reads: "exec /usr/bin/X11.../dev/null" to "exec /usr/X11R6/bin/XFree86 -nolisten tcp", save the file and close the editor.

 c) Copy, rename, and edit XF86Config-4_vesa
   - Go back to your emelFM window and in the left pane scroll up to and double-click on "XFree86_config_files".
   - In the right pane, navigate to /etc/X11/ .
   - Select "XF86Config-4_vesa" in the left pane and click "Copy" in the center column.
   - Select "XF86Config-4_vesa" in the right pane, click "Rename" in the center column, and remove the "_vesa" from the end of the filename.
Quote
Important note: The "XF86Config-4" file contains configuration information that must be specific to your system.  I used the "_vesa" example because I have very low display requirements but you may have other needs.  I actually only made one change to the configuration to support my specific mouse and I found the correct syntax in one of the other examples.

I recommend trying the "_vesa" file first, if that doesn't work try swapping out the "InputDevice", "Monitor" and "Screen" sections from some of the other examples, searching this site for XFree86 threads of people with similar hardware to yours and going to the XFree86 site for help with your specific setup.

However, there is one typo in the file that needs to be changed...

   - Click "Edit" in the center column and scroll down to "Section "InputDevice", Identifier "Mouse[2]" and change "Option   Protocal" to read "Option    Protocol"
   - Save the file and close the editor.

 d) Test your configuration
   - Right-click on your desktop and select "WindowManager","Restart".
   - If your config file is correct then you'll briefly see a half-screen of what was on the screen just before you restarted, then a B/W textured full screen with your mouse pointer as a large "X" in the middle, then you should be taken back to what looks like your original Fluxbox screen right after boot.
   - You can check to make sure that XFree86 is really running by clicking the "ATerminal" icon on your desktop and typing "pstree" and <enter>.  You should see XFree86 somewhere on the "diagram".  It is a listing of all the processes currently running on your system.
   - If your config file is not correct (like mine wasn't because of my mouse) your system will most likely get stuck at the B/W screen.  To get back to your standard Fluxbox screen press "Ctrl-Alt-F1" then press "Ctrl-C".  When the prompt appears, type "xsetup.sh" and go through the setup process.  Then when you are back at the prompt, type "exit".
   - Note: running "xsetup.sh" overwrites your ".xserverrc" file so  you'll need to repeat step "b)" when you want to try again with a new configuration.
   - Now you'll need to re-edit your config file until it matches your system...good luck!

 e) Add ".xserverrc" and "XF86Config-4" to backup (".filetool.lst")
   - Right-click on your desktop and select "Apps","Tools","emelFM","emelFM as super-user".
   - In the left panel scroll down to ".filetool.lst", select it, then click "Edit" in the center column.
   - Add these lines below the existing ones:
Code Sample
/home/dsl/.xserverrc
/etc/X11/XF86Config-4

   - Save the file and close the editor.
   - Right-click on your desktop and select "System", "Backup/Restore".
   - Set "Device:" to "hda1" and click "Backup". (Or set the device to wherever you save your backup file, "backup.tar.gz", to - see the "Getting Started With DSL, Saving Your Configuration" that pops up on boot for more info.)
   - That should complete your install of XFree86.


Major step 2: Install xfstt and your TTFs
 a) Install MyDSL: "dsl-dpkg.dsl" and "gcc1-with-libs.dsl"
   - Click on the "MyDSL" icon on your desktop.
   - Click on "System".
   - Find and click on "dsl-dpkg.dsl"
   - Click "Download".
   - Leave "To Dir:" as "/tmp" and click "Download". (dsl-dpkg and gcc1 are programs/libraries that we need for installing, but after xfstt is installed you'll no longer need them.)
   - Repeat the above process for "gcc1-with-libs.dsl"

 b) Download and install "xfstt_1.2.1-3_i386.deb"
   - Click on Firefox on your desktop and type the following into the address bar: "http://ftp3.nrc.ca/debian-archive/pool/main/x/xfstt/"
   - Then click on "xfstt_1.2.1-3_i386.deb" and Firefox should download the file to your /home/dsl/ directory.
Quote
Important note: If this link doesn't work, try searching the net for that exact filename.  I tried the newest version "1.6..." but it requires a newer version of gcc then is currently included in the MyDSL repository.

   - On the desktop, click the "ATerminal" icon.
   - Type "sudo dpkg -i /home/dsl/xfstt_1.2.1-3_i386.deb"

 c) Copy TTF files to "/usr/share/fonts/truetype"
   - Right-click on the Emelfm icon on your desktop and select "emelFM as super-user".
   - In the right pane, navigate to "/usr/Share/fonts/truetype".
   - In the left pane, navigate to where ever you have your TrueType font files (.ttf files)  (/mnt/hda1 or /mnt/sda1 for examples - just remember to "mount" the drive first, you can use the mount tool in the bottom right hand corner of your desktop.)
   - Select all your .ttf files and click "Copy" in the center column.

  d) Stop X (Window Manager), start xfstt, restart X
   - Right-click on your desktop and select "WindowManager","Exit".
   - At the prompt type "sudo xfstt --sync
   - The last line should say "Found XX fonts" where XX is how many fonts you copied above.
   - Type "sudo xfstt --port 7100 &"  (standard port is 7101, but XFree86 uses 7100 in their config file.)
   - Restart X by typing "Exit".

 e) Save configuration to backup
   - Using the "emelFM as super-user" method as shown above, add the following lines to "/opt/bootlocal.sh"
Code Sample
sudo /usr/X11R6/bin/xfstt --sync
sudo /usr/X11R6/bin/xfstt --port 7100 &

   - And add the following lines to "/home/dsl/.filetool.lst"
Code Sample
/usr/doc/xfstt
/usr/X11R6/man/man1/
/usr/X11R6/bin/xfstt
/usr/share/doc/xfstt
/etc/rc6.d/K20xfstt
/etc/rc4.d/S20xfstt
/etc/rc3.d/S20xfstt
/etc/rc2.d/S20xfstt
/etc/rc1.d/K20xfstt
/etc/rc0.d/K20xfstt
/etc/rc5.d/S20xfstt
/etc/init.d/xfstt
/var/cache/xfstt/
/usr/share/fonts/truetype/

   - Right-click on your desktop and select "System", "Backup/Restore".
   - Set "Device:" to "hda1" and click "Backup".

Final notes:
This process allows access to the fonts from many system and GTK2 apps that I tested.  However, for some reason OpenOffice doesn't see them.  In order to get OpenOffice to see them use the following steps:
   - Install MyDSL: gnu-utils.dsl
   - In a terminal go to /usr/share/fonts/truetype, type "update-fonts-dir /usr/share/fonts/truetype" <enter>, ignore any warning about absolute path, then type "mkfontdir" <enter>.
   - Then type "xset +fp /usr/share/fonts/truetype" <enter>.
   - Your fonts should be now be available in OpenOffice - to make this change permanent, just add the "xset..." line to "bootlocal.sh"

There are many people here far more familiar with DSL than I.  If you are one of those people, please feel free to help me perfect this HOWTO.  Any suggestions, criticisms, updates, etc. are very welcome.  I will also try to answer any questions as I have time.  :)

For reference, I created this HOWTO with help from the following resources:
< http://www.xfree86.org/ >
< http://home.versatel.nl/henk.1955/ >
< http://damnsmalllinux.org/cgi-bin....06;st=0 >
< http://www.damnsmalllinux.org/wiki/index.php/XF86Config-4 >
< http://damnsmalllinux.org/cgi-bin....xfree86 >

< http://freshmeat.net/projects/xfstt/ >
< http://damnsmalllinux.org/cgi-bin....80;st=0 >
< http://linux.about.com/od/howtos/l/blfont4.htm >
< http://linuxgazette.net/issue28/ayers1.html >
< http://ftp3.nrc.ca/debian-archive/pool/main/x/xfstt/ >

Posted by WDef on June 10 2007,13:12
Thanks for this.  I'll give it a try at some stage.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.