Random Noise

cat /dev/random >> /dev/dsp

Archive for July 2007

Better UI and fonts in linux – I

leave a comment »

So you want to have your linux GUI to look uber cool huh?

Remember last time when you installed linux on your home PC? If you are like me, probably you spent atleast a week before you feel comfortable with the settings and customizations. You make sure that all the required tools and applications installed. Like Firefox, OpenOffice, Mplayer and so on. But, no matter what you do linux GUI dosen’t look consistent! All the apps don’t use same fonts, font-sizes. The UI components look different for different apps etc. Probably you know the reason: All the applications in linux use different GUI toolkits. The two most commonly used toolkits are GTK and QT. So, what? Well they rely on different redering techniques unique to the toolkit. This gap between the two can be bridged by installing GTK-Qt Theme Engine.”The GTK-Qt Theme Engine is a plug-in for GTK that allows GTK applications to use Qt widget styles.”

Most of the Linux distros have GTK-Qt Theme Engine available as a package.
Install it :

Gentoo: emerge x11-themes/gtk-engines-qt
Ubuntu: apt-get install gtk-qt-engine
Fedora: yum install gtk-qt-engine

Once you done with that. Use it from KDE control center.
Find a screenshot from my Gentoo machine here.
Now it’s time to fix the fonts. The rendering of the fonts depends on following things:

  1. Screen Size (17″, 19″, 20″ etc.)
  2. Screen Resolution (1024×768, 1280×1024, 1680×1050 etc.)
  3. Dots per Inch or DPI in short (http://en.wikipedia.org/wiki/Dots_per_inch)
  4. Freetype’s Byte Code Interpreter switch
  5. Sub Pixel Rendering (http://en.wikipedia.org/wiki/Subpixel_rendering)
  6. Font Hinting

Dots per pixel:
“Dots per inch (DPI) is a measure of printing resolution, in particular the number of individual dots of ink a printer or toner can produce within a linear one-inch (2.54 cm) space.”. Modern monitors support DPI = 96×96 or sometimes more. Though 96×96 is enough to get good quality fonts.

The screen size, screen resolution and the DPI all are related by the following equation:
For monitor width in millimeters to achieve DPI of 96:

x = (25.4 x resolution width in pixels)/96

Same for monitor height in millimeters:

y = (25.4 x resolution height in pixels)/96

Do I need the above x and y values?
If you have NVidia graphics card, you don’t have to do the above calculation. You can tell the nvidia driver to calculate it for you.For this specify the following in /etc/X11/xorg.conf under device section:

Section “Device”

Driver “nvidia”

Option “UseEdidDpi” “FALSE” #
Option “DPI” “96 x 96” # specify these two lines

End Section

If you have an ATI graphics card, the graphics drivers sucks. So we have to tell it what to use. For example you have monitor with native max resolution 1280 x 1024:

(25.4 x 1280)/96 = 338.6
(25.4 x 1024)/96 = 270.9

For this specify the following in /etc/X11/xorg.conf under monitor section:

Section “Monitor”

DisplaySize 338.6 270.9

End Section

After this restart your X. press Ctrl + Alt + F1, then if promted enter login info and enter following command:

/etc/init.d/xdm restart

In the next part, I’ll will continue with beautifying fonts in linux.

Written by Vivek Unune

July 7, 2007 at 1:01 am

Posted in gentoo, linux

Tagged with , , , , ,