Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to find and then change the screen DPI (dots per inch) setting in 12.04 and 12.10. However, I can't seem to find any app or config file that can do this. Is there any app or conf file for this?

Note that this is for 12.04+ so the following will not work:

Moreover, they are basically changing the font size, not the actual screen DPI.

share|improve this question

9 Answers 9

up vote 27 down vote accepted

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:

1) Run gksudo gedit, open /etc/lightdm/lightdm.conf and add a parameter under [SeatDefaults] section:

xserver-command=X -dpi 90

Restart your computer or restart X. Now xdpyinfo | grep dots will report 90x90 dots and cat /var/log/Xorg.0.log | grep DPI 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 90x90

Then run 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 Xft.dpi: 90.

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.

share|improve this answer
2  
This is a very complete (Enjoyed the whole thing) answer full of new information. Thanks whtyger. +1 –  Luis Mar 25 '13 at 12:27
1  
Thanks for the high mark. I've spent several days digging everywhere for the resolution of the issue and now glad to share it with everybody. –  whtyger Mar 25 '13 at 13:34
    
here's a spreadsheet to save you a bit of time computing the values: docs.google.com/spreadsheet/… –  Tom Carchrae Dec 29 '13 at 17:41
    
    
I didnt manage to change dpi with both methods, it just forgets settings after I restart. –  umpirsky Jun 11 at 5:33

Starting with 14.04 we have an option that helps a bit:

Scaling Support

In the image below we can see the scaling it has at 0.75 on the fonts and title bars:

enter image description here

In the image below we can see the scaling it has at 1.38 on the fonts and title bars:

enter image description here

share|improve this answer
1  
That worked for me in Ubuntu 14.04 (german: "Anzeigegeräte") I had to restore the default font-scaling factor to 1.0 (I set it to 2.0 berfore) and rescale the Launcher-Icon size in "All Settings"->"Darstellung" –  rubo77 Jun 19 at 7:54

While the xserver-command=X -dpi ... and xrandr --dpi ... given above may have worked very well in earlier versions of Ubuntu, in Ubuntu 13.10 (which is what I have) Unity ignores those settings and keeps the dpi fixed (as far as the X server is concerned at 96 dpi).

And the xrandr --scale ... command does scale the screen as described but scales it in such a way that makes text and icons a little bit blurry. But it works.

It appears that in Ubuntu 13.10 the best option might be not to try to change the dpi setting for the X server but instead use the unity-tweak-tool to change the default fonts used by Unity and the default font scaling factor. You can download the unity-tweak-tool from the Ubuntu Software Center. When you open the unity-tweak-tool go to the Fonts button and try changing the font scaling factor to 1.2 or 1.25 (or higher or lower) to get the fonts to appear a good size for you. On this control panel you can also change the default fonts used by Unity. Admittedly this solution doesn't scale everything on the screen, just the text, but it works really well on my laptop with its 166 dpi screen. It appears web browsers like Firefox and Chromium don't notice this setting setting but each both Firefox and Chromium allow you to set a minimum font size in their application settings to scale-up the fonts on web pages in the same way.

share|improve this answer
    
Good research Carl. –  Luis Mar 23 at 2:39

As far as my experience in Ubuntu goes, changing the font DPI setting changes a lot more than just the way fonts are rendered. It also applies to icons and the size of menus for example.

It's just that Xorg hints the Desktop Environment on what the physical display's DPI is. And yes, you can override this in the Xorg.conf, but it has the same effect as changing the setting in your DE. For example in Kubuntu/KDE:

enter image description here

share|improve this answer
    
Is there an Ubuntu (Unity) version of this font manager. –  Luis Jan 26 '13 at 23:37
    
@LuisAlvarado No, it appears this is only GNOME2 and KDE offering this... Gnome-tweak-tool should be able to do this, but it crashes my 12.10 Unity VM whenever changing the font size. –  gertvdijk Jan 26 '13 at 23:44

Had a similar problem, on a 2880x1620 screen. See http://ubuntuforums.org/showthread.php?t=2106549 Solved by putting

xrandr --output DP-0 --scale 0.75x0.75

into my ~.xprofile

Instead of "DP-0", put whatever

xrandr

tells you as device name.

You can tweak the scale of course, but 0.5 somehow did not look nice on my screen.

share|improve this answer
    
This i only a workaround, cause you loose the real resolution. With this scaling your monitor only displays half the pixel instead of re-rendering it in the scaled resolution –  rubo77 Feb 12 at 0:41
    
Unfortunately the mouse does not scale at the same rate as the screen when using this :-( When scaling down as you are this is harmless as the mouse just explores empty space outside the screen but when scaling up to get a complex application to display well on smaller screens, the mouse does not reach to the edge of the screen which makes this unusable in that use case –  marsbard Mar 4 at 12:41

You can't actually change the physical ppi of your monitor. The real ppi is the actual hardware ppi, however most software will assume a ppi of 72 dpi for historical reasons, though 96 dpi is not uncommon now.

You can change the resolution of the monitor, which changes the translated ppi, and you can change things like the font size.

If you install MyUnity you can change the font DPI, amongst other things.

If you had a true 1024x768 pixel (resolution) monitor and it was true 72dpi, it would be about a 17" monitor. If you set a font size of 72 then a character would be 1" high. If you set the display to 800x600 resolution then the font would be larger, while setting 1600x1200 would make the font appear smaller.

share|improve this answer
    
What about xorg options like "UseEDIDDpi" and "DPI"? I have read that for example the first one can disable reading the EDID from the video card in case it is read wrong and with DPI you can change DPI. This is what confuses me. –  Luis Oct 8 '12 at 17:00

Install Ubuntu-Tweak http://ubuntu-tweak.com/

Open it and go to 'Tweaks > Fonts'. Then change the 'Text scaling factor'

Works great. Enjoy.

share|improve this answer

You can scale everything with xrandr, which is probably what you're looking for. I'm not sure how it works internally, but the effect seems to be a dpi change.

To scale your resolution, first find the name of your display with xrandr:

lars:~$ xrandr
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 1600 x 1600
LVDS connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1366x768       60.0*+
   1280x768       60.0 +
   1280x720       60.0 +
   1024x768       60.0 +
   1024x600       60.0 +
   800x600        60.0 +
   800x480        60.0 +
   720x480        60.0 +
   640x480        60.0 +
DFP1 disconnected (normal left inverted right x axis y axis)
CRT1 disconnected (normal left inverted right x axis y axis)

So, in my case my laptop display is called LVDS.

Then run the following to scale your resolution:

xrandr --output LVDS --scale 0.75x0.75

The Launcher and Panel might disappear for a moment, but just hover your cursor over them and they should reappear. You might also have to resize any open windows so that they fit the smaller resolution.

share|improve this answer

I am using Zorin8 (based on Ubuntu13.x).

You could scale the screen with mouse (1024/800=1.28, 768/600=1.28):

xrandr --output LVDS1 --mode 800x600 --panning 1024x768 --scale 1.28x1.28

Or only pan the screen, so you have to use the mouse to see parts that are not visible on screen:

xrandr --output LVDS1 --mode 800x600 --panning 1024x768
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.