Fonts and DPI
Making nice looking fonts on your screen takes a little bit on know how. A great help to improve the fonts is to learn the correct DPI for your screen. When a person in the forums mentioned that my fonts looked fuzzy, I never considered the the DPI was set incorrectly for my monitor. The problem was that I had been using the original DPI the X server choose when installed and the X server doesn’t always know how to the correct value. If the X server cannot determine the size of the screen it will set a default value and your fonts will appear hazy.
First place to look to find the DPI for the monitor, is in the user guide that came with your computer or the manufactures website may also have this information. However, if it isn’t it isn’t very difficult to figure out.
First see if X recognizes the monitor’s physical size:
xdpyinfo | grep dimensions
If X server knows this value, then it can calculate the correct DPI. If the dimensions are correct then the correct DPI will be calculated:
xdpyinfo | grep resolution grep DPI /var/log/Xorg.0.log
The X server will default to 75×75 if it cannot discover a value. If the DPIs are wrong, you’ll have to tell X server the correct dimension of your monitor. Since most specifications now just list the diagonal length of the screen, I’m going to use that. The MacBook I use has a 13.3″ (diagonal) LCD screen with 1280 x 800 resolution. With the Pythagorean theorem you can discover your horizontal and vertical measurements.
Using bc (a command line calculator) this will give us the diagonal resolution:
echo 'scale=5;sqrt(1280^2+800^2)' | bc
Using the diagonal length divided by the diagonal resolution will give the aspect percentage and multiplying as aspect percentage times the horizontal and vertical resolutions will give the monitor’s horizontal and vertical lengths.
echo 'scale=5;(13.3/1509)*1280' | bc 11.27680 echo 'scale=5;(13.3/1509)*800' | bc 7.04800
With this I know my monitors physical dimensions are 11.27680 wide by 7.04800 high. Now X server needs to be told of these values. X server doesn’t use inches though and the values has to be calculated for metric. I like to do this with Google, just type in “11.2768 inches in millimeters”.
Now tell X server in whole values in the “
/etc/X11/xorg.conf” file in the Monitor section:
Section "Monitor" Identifier "Monitor0" DisplaySize 286 179
Kill the X server and restart and the new values for DPI will take effect.
Gnome and KDE have their own DPI settings that might override the correct DPI. Gnome only has the ability to set one value for DPI, if horizontal and vertical DPI differ, choose a medium in between. In KDE 4, users have the ability to disabled KDE’s DPI setting and use the X servers.
Fonts and Web Browsers
Firefox in particular, has a built-in way of how it renders fonts, so fonts in Firefox may not look as good as your other applications. To set up sizes of fonts in your web browser a good way is to set the fonts to corresponding css values. Adjust what regular size reading font you want in your web browser with the corresponding to font size medium in css samples, and set xx-small to the smallest readable size.
Thanks to Padaa for showing me that my fonts weren’t up snuff, though I berated him for getting off topic ;) .