Pages - Menu

Monday, November 10, 2008

Font DPI broken in Intrepid

I upgraded my laptop (a Dell Vostro 1200) to Ubuntu Intrepid, and found my fonts in both GDM and Openbox were 2 sizes larger than expected. This made things look awful, so I started hunting around for a fix.

Fonts should be 96x96 DPI, for this, both the video driver and X need to know how physically large your screen is, in addition to the resolution they're displaying. xdpyinfo | grep dimensions reported the correct screen size in mm I was expecting, but cat /var/log/Xorg.0.log | grep DPI reported that the intel(0) driver was seeing a DPI of 95x153!!!

After browsing Ubuntu's Launchpad and the Arch Linux Wiki for a while, I found it seems to be a bug in the Xorg Intel video driver, specifically that it can't read the resolution information from my laptop's LCD panel properly.

My fix for this was by editing my /etc/X11/xorg.conf file, and adding these lines to the Device and Monitor sections:

Section "Device"
... existing info here...
Option "Monitor-LVDS" "Configured Monitor"

Section "Monitor"
... existing info here ...
Identifier "Configured Monitor"
DisplaySize 339 212

If you have a different resolution than 1280x800, you can calculate these values with the formula pixels*25.4/dpi and always round down. eg: 1024*25.4/96=270

Apparently if you have a nVidia card, using the nvidia binary driver, these options work:
Section "Device"
... existing info here ...
Option "UseEdidDpi" "false"
Option "DPI" "96 x 96"

Others have also reported that starting X with a manual DPI setting can work. You can do this by editing /etc/gdm/gdm.conf and finding this:
command=/usr/X11R6/bin/X -br -audit 0
and adding -dpi 96 on the end, so you get this
command=/usr/X11R6/bin/X -br -audit 0 -dpi 96
However, this did not work for me.

Some people have found that specifying Option "NoDDC" "true" in the Monitor/Device sections of their xorg.conf fixes this too. DDC is a protocol that reads extended information from your monitor that could be important (resolutions, refresh rates) so disabling it isn't really a "fix" as such. I don't recommend disabling DDC, especially if you are using a CRT which could be fried by an incorrect refresh rate.

The fix, either Intel's Monitor-LVDS command, nVidia's UseEdidDpi False, or starting X with a manual DPI, seems to be dependent on which video card and driver you are using. Out of interest, the fbdev driver (framebuffer, displays usplash and Ctrl+Alt+F1 terminals) would read DPI properly, but was restricted to 1024x786 res only.

No comments: