Putting DPI into perspective

Prior to the purchase of brand new workstations at work, Justin and Andy were working from Macbook Pro laptops. We had these Matrox DualHead2Go boxes which took a video signal and split it in two, for the purposes of connecting two monitors to a non-dualhead video card. I cannot tell you how much of a pain it was getting not only DVI output working under Linux through the proprietary ATI driver (although now that I know how, it’s pretty easy), but also getting it to talk to these Matrox boxes.. modelines.. resolutions.. triple displays.. gahh..

Never-the-less, I did get it to work. The final setup consisted of the laptop screen being enabled as the primary desktop, then the secondary desktop through the DVI output connecting to the Matrox box at a resolution of 2560×1024, which the box then split across two LCD screens. One of the problems was that the DPI resolution for the dualscreen setup was very wrong and as a result the fonts on the monitors were TINY.

So, the next trick was to tell the secondary monitor (the dualview box) what DPI it should run at (in this case, 96×96).

Even on my main box at work using the NVIDIA driver on a dualscreen setup, the DPI is wrong.
chris@gentoo ~ $ xdpyinfo |grep -A1 dimensions
dimensions: 3360x1050 pixels (948x303 millimeters)
resolution: 90x88 dots per inch

Should you need to specify your DPI too, here’s how you can!

The DPI is set on a per monitor basis in the /etc/X11/xorg.conf file. The option is DisplaySize and naturally goes in the relevant Monitor section.

Section "Monitor"
DisplaySize 336 252 # This is 96 DPI @ 1280x960

You calculate the DisplaySize values based on your monitor’s DPI and the resolution, the formula for which is:
Width x 25.4 / DPI
Height x 25.4 / DPI

My old Macbook has a res of 1280×800, so for 96 DPI fonts I would use:
1280 x 25.4 / 96
800 x 25.4 / 96
= 338 211

Intel driver
If you’re using Intel driver you may need to tell X not to get DDC info from the monitor. Set this in the video card Device section(s):
Option "DDC" "no"

NVIDIA driver
If you’re using NVIDIA drivers, then you can try the following settings in the video card Device section(s):
Option "UseEdidDpi" "false"
Option "DPI" "96 x 96"

Check the results!
You can use xdpyinfo to check the result. This is on my Macbook:
josiah ~ $ xdpyinfo |grep -A1 dimensions
dimensions: 1280x800 pixels (338x221 millimeters)
resolution: 96x96 dots per inch

Now you can enjoy your fonts the way they were meant to be.

1 thought on “Putting DPI into perspective

  1. Greg

    Thanks a lot; I had done this before but couldnt remember how; my Nvidia display has a nice decent font-sized now!

Leave a Reply

Your email address will not be published. Required fields are marked *