Adding a new TTF font to Linux

One thing that keeps me doing development on a Mac OS X is its awesome Monaco font. I saw the font first time while using Mac in my college, and I fell in love with the font ( yeah, that sounds crazy… ). I prefer Monaco over very popular terminal fonts like courier or courier new. Monaco is as crisp as courier and at the same time as sober as Helvetica.

Ok. Now to the main point.. I have been using Linux almost 10 years now. I remember from the initial days, adding a new TTF font in Linux; I always felt the steps to be too much cryptic.

After a long time today I found a seemless way to install a new TTF font.

And as Monaco is my favorite for terminal programs, I’ll show the steps using Monaco.

  1. Download a TTF font or fonts file. In case of Monaco just download it from here.
  2. Unzip, gunzip, untar, bunzip2 do whatever is required on the fonts file. For Monaco we do nothing.
  3. Copy the .ttf file to a nice place.
    $ sudo mkdir /usr/share/fonts/truetype
    $ sudo cp Monaco_Linux.ttf /usr/share/fonts/truetype/
  4. Now we need to create required files for the new fonts ( i.e. fonts.scale and fonts.dir )
    $ cd /usr/share/fonts/truetype
    $ sudo mkfontscale
    $ sudo mkfontdir
  5. This creates the required files, now we need to add the fonts to cache. One way to do it is add to cache and restart X Font Server
    $ sudo fc-cache
    $ sudo chkfontpath --add /usr/share/fonts/truetype
    $ sudo /etc/rc.d/init.d/xfs restart

    OR easy way to do it is refresh the cache forcefully. Which does not require restarting the server
    $ sudo chkfontpath --add /usr/share/fonts/truetype
    $ sudo fc-cache -fv
  6. Restart the program you want to use the font in.

You can always copy the fonts in ~/.fonts directory if you don’t have root access.

References and Resources:

Tags: , ,

Bluetooth Proximity

Recently I stumbled across this awesome utility called Proximity. Its a neat small utility that detects if you are near your system or away from it. And it does this by checking the status of your bluetooth phone. Hence the range for away is about 30ft.

This is a pretty useful thing. Couple of ideas that come to my mind for its use are

  1. Use bluetooth to lock your computer
  2. Use bluetooth to change Messenger Status
  3. Use bluetooth to play/pause a movie

Here is a list of AppleScripts for the ideas above

Start Screensaver using AppleScript

tell application id "" to launch
end try

Stop ScreenSaver using AppleScript
tell application id "" to quit
end try

Please note that if password on wake is set true then it will ask for password

Go Away in Adium using AppleScript
tell application "Adium" to go away
Available in Adium using AppleScript
tell application "Adium" to go away
Play and Pause VLC using AppleScript
tell application "VLC" to play
The same script plays and pauses a file

Tags: , , , , ,