Change DPI in Ubuntu

 Author:   Posted on:   Updated on:  -
By default Ubuntu assumes you use a 96 DPI monitor. But nowadays pixel density keeps increasing as monitors with high resolution became accessible. There is no straightforward option in Ubuntu with Unity to change the default DPI which is considered to be 96 DPI (run in  a terminal xrdb -query). But there are two parameters which control the user interface DPI (this affects font rendering too) and font rendering only.

The parameter that controls user interface and fonts DPI is scaling-factor and the font rendering parameter is text-scaling factor. These parameters can be modified by the Displays application, by GNOME Tweak Tool and by Unity Tweak Tool, but none of these allows you to set a value with 3-4 decimals.

What's the scaling factor's value

The scaling factor is 1 for a 96 DPI. My display has a DPI of 102.24, so the scaling factor is 102.24 / 96 = 1.064989. GNOME Tweak Tool rounded this value to 1.10 so it's useless.

If you don't know what your display DPI is, simply measure its width in inches and divide your horizontal resolution in pixels by the measured value. Another way of getting the width and height of your display is by running xrandr and looking at the connected monitor. Example output: DVI-I-2 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm.

If I convert 477 milimeters to inches I get 477 / 25.4 = 18.78 inches. The horizontal width is 1080 pixels, so the DPI is 1920 / 18.78 = 102.24. To find scaling factor value, I divide 102.24 by 96 and the result is 1.065.

Dconf Editor allows you to set this value with 16 decimals. It can be installed by running sudo apt-get install dconf-editor in a terminal. These parameters are found in org.gnome.desktop.interface.

dconf Editor screenshot showing DPI settings

I didn't change the interface DPI (scaling-factor) as my DPI is not so high to make the interface look too small. I only changed fonts DPI (text-scaling-factor) as I like for the user interface the font Ubuntu size 8 which looked too small.

What are the effects

  • If you open a LibreOffice Writer document at 100% size and overlay a sheet of paper on the screen it should be exactly the same size.
  • A font with the size equal to screen DPI will have a height of 1 inch on the display.
  • Usually (depends on program - e.g. qpdfview follows DPI, Evince doesn't) documents displayed at 100% are the same size as if they were on paper.


No comments :

Post a Comment

Please read the comments policy before posting.