Saturday, July 22, 2006

Ubuntu: set correct DPI for X server

You can use utilities xdpyinfo | grep resolution and xrdb -query to get current DPI value. To change DPI values create a file ~/.Xresources or edit ~/.config/xfce4/Xft.xrdb (if using XFCE4) and add line:
Xft.dpi: 96
Or you can edit directly /etc/X11/xorg.conf and under "Monitor" section add a line:
DisplaySize XXX XXX (in my case it's 270 203)
XXX is calculated by using formula 25.4 * pixels (height or width) / DPI.

Note: X Window System has it's own DPI value set in /etc/X11/xorg.conf; desktop environment, for example XFCE4 - in ~/.config/xfce4/Xft.xrdb; Mozilla Firefox - in browser.display.screen_resolution (about:config).

UPDATE: There's a bug in Ubuntu 7.04 Feisty Fawn in xorg module, so that xorg doesn't honor DisplaySize line in xorg.conf.

6 Comments:

At 03 February, 2007 16:54, Anonymous Anonymous said...

excelente.
me funcionó perfecto. thanks.

 
At 26 February, 2007 03:31, Blogger 坚硬的泡沫 said...

i'm a newbie of xubuntu.

when i mousepad my ~/.config/xfce4/Xft.xrdb , it's empty. i put line:
Xft.dpi: 96
and try to save and exit, it shows up:
can't open file to write

any idea?

 
At 25 March, 2007 07:42, Anonymous Anonymous said...

you need to be root to edit some files. so try...

sudo mousepad ~/.config/xfce4/Xft.xrdb

 
At 27 April, 2007 11:10, Anonymous Anonymous said...

Files located in your home shouldn't be owned by root, especially configs like this one. Check its permissions and owner with "ls -l PATH/TO/FILE" which should look something like -rw-XXXXXX X your_user some_group .... X's are irrelevant but the rw part should be like that and your_user be your username. If not try "chmod u+w" and "sudo chown your_user filename". Hope that helps.

 
At 30 May, 2007 23:41, Blogger nuclon said...

by the way - why did I get wrong DPI at all?

I saw very small font after playing with Compiz, but it was OK before.

 
At 11 January, 2009 16:17, Anonymous Anonymous said...

thanks alot!
playing around with some different desktop environments and this suddenly happened. gotta love google :)

 

Post a Comment

<< Home