Actually you should do 2 things to set your DPI correctly.
I'll explain on example. I'm using Ubuntu LTS 12.04 with Gnome Classic and I've got a monitor with resolution 1680x1050. Let's check my starting settings:
xdpyinfo | grep dots reports
96x96 dots ,
xrdb -query | grep dpi reports
Xft.dpi: 96 ,
cat /var/log/Xorg.0.log | grep DPI reports some weird settings
NOUVEAU(0): DPI set to (90, 88).
Let's calculate optimal DPI for my monitor. Actual size of the screen in centimetres can be found with
xrandr | grep -w connected or with the long ruler by hand. In my case:
X = 47.4cm ;
Y = 29.6cm. Divide them by 2.54 to get the size in inches:
X ~ 18.66in ;
Y ~ 11.65in. Now divide actual dots amount (based on your resolution) by the size in inches:
X = 1680/18.66 ~ 90dpi ;
Y = 1050/11.65 ~ 90dpi. So my real dpi is 90. Let's start fixing it:
gksudo gedit, open
/etc/lightdm/lightdm.conf and add a parameter under
xserver-command=X -dpi 90
Restart your computer or restart X. Now
xdpyinfo | grep dots will report
90x90 dots and
grep DPI /var/log/Xorg.0.log will also show the desired setting.
Alternative variant, which doesn't depend on lightdm: create a file
77set_dpi somewhere (in home folder for example) and put the line in it:
xrandr --dpi 90
sudo mv ~/77set_dpi /etc/X11/Xsession.d/ and restart. The result should be the same (though in my case it won't fix the setting shown in Xorg log).
2) In GNOME3 DPI setting is hardcoded to 96 and cannot be changed directly, but the text can be scaled instead. Calculate the desired multiplier:
desired_DPI / 96 (in my case
90/96 = 0.9375). Now run the command (or use
dconf if you prefer):
gsettings set org.gnome.desktop.interface text-scaling-factor 0.9375
Changes will be applied immediately and xrdb will also be updated on the fly.
xrdb -query | grep dpi will report the desired
Now DPI is correctly set for the monitor.
P.S. There is another method to fix DPI setting much more difficult than double-step method mentioned above: download the sources of 'gnome-settings-daemon', fix the hardcoded setting in it and recompile them as mentioned in the guide http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html. I tried it also, but the result is absolutely the same.