Ubuntu – How to get the right DPI resolution on Ubuntu 13.04 Saucy

dpilightdmresolutionxorg

The physical DPI of my laptop screen is approximately 142 dots per inch as you can calculate from the correct output of xrandr --query:

$ xrandr --query | head
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm

However, Ubuntu appearantly forces the X server to use 96 dpi and thus assume a wrong physical size of the display, which you can check with xdpyinfo

$ xdpyinfo | grep -B2 dots
screen #0:
  dimensions:    1920x1080 pixels (508x286 millimeters)
  resolution:    96x96 dots per inch

As a consequence, fonts and other visual elements are smaller as they should be. You can check with any web browser on this website. The square is too small, less than 1 in^2.

This answer lists a number of work-arounds, none of which works for me:

  1. Tell lightdm to start X with the option -dpi 142, which I achieved on Saucy by editing /etc/lightdm/lightdm.conf.d/50-xserver-command.conf. Has no effect.

  2. Run xrandr -dpi 142x142, when starting the X session by adding a file to /etc/X11/Xsession.d/. Has no effect

  3. Set the text-scaling-factor, which can be achieved in a number of ways. This only effects fonts rendered by Unity/Gnome/GTK(?), basically the standard Ubuntu GUI, but fails for other apps such as web browsers or PDF viewers. Not what I want.

How do I get Ubuntu to use the correct dpi for my screen?

Update: This appears to be a known bug disguised as a feature. What are your workarounds?

Best Answer

To get current DPI resolution use

xdpyinfo | grep -B2 resolution

To update DPI resolution say to 142 dpi use

xrandr --dpi 142
Related Question