Gentoo Wiki


Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process

This article is still a Stub. You can help Gentoo-Wiki by expanding it.

DPI is the ratio between the number of pixels and the distance along a given direction. For monitors, this is a two-dimensional quantity, determined by the with and height of the viewable area.

Some monitors can give their physical dimensions to the display adapter, and if the driver supports this, it is possible to compute the DPI automatically. For example, from the /var/log/Xorg.0.log file.

Code: grep -i DPI /var/log/Xorg.0.log
$ grep -i DPI /var/log/Xorg.0.log
(**) NVIDIA(0): Option "UseEdidDpi" "false"
(**) NVIDIA(0): DPI set to (90, 90); computed from "DisplaySize" Monitor section option

If the driver cannot determine the physical dimensions of the display it is possible to specify it in the xorg.conf file with the DisplaySize option.


Making the Display Manager(DM) Choose DPI

The instructions for KDM are as follows.

Choosing DPI using KDM

Change the KDM config file, /usr/kde/KDE-VERSION/share/config/kdm/kdmrc to pass -dpi 96 parameter to X server. (Or any other DPI value you want.) Then restart KDM.

File: /usr/kde/KDEVERSION/share/config/kdm/kdmrc
 ServerArgsLocal=-nolisten tcp -dpi 96

Editing xorg.conf file

Setting the width and height of the screen (in millimeters) using the following directive: DisplaySize <width> <height> in the Monitor section of /etc/X11/xorg.conf solves this.

File: /etc/X11/xorg.conf
Section "Monitor"
    Identifier          "Monitor0"
    DisplaySize         340 270

The simplest way is to measure the values with a ruler. For example 15 inch display should be around 340mm x 270mm, 19 inch around 380mm x 305mm.

The values for DisplaySize can be calculated with the formula 25.4 × width / dpi or respectively 25.4 × height / dpi, 25.4mm being 1 inch. E.g. to use a dpi of 75 with a resolution of 1600x1200, the calculation would be 25.4 × 1600 / 75 = 542 and 25.4 × 1200 / 75 = 406, resulting in the setting DisplaySize 542 406.

Another way to get the values is to ask X server to calculate it for you. Run it using startx -- -dpi 96 command, where 96 is required value for dpi and check the dimension:

Code: xdpyinfo | grep -B1 dot
$ xdpyinfo | grep -B1 dot
  dimensions:    1152x864 pixels (XXXxYYY millimeters)
  resolution:    90x90 dots per inch

Use these XXX and YYY values for DisplaySize parameter.

Yet another way to discover your display's dimensions, if your hardware provides that information (you may need to emerge -tav xrandr first), is to use:

# xrandr --query
 SZ:    Pixels          Physical       Refresh
*0   1680 x 1050   ( 431mm x 272mm )  *60  
Current rotation - normal
Current reflection - none
Rotations possible - normal 
Reflections possible - none

I was able to achieve the best results using the dimensions obtained by using this calculator:

i810 notebook users(samsung x20): Use 855resolution to get 1400x1050, most probably X won't start or the driver will use the next lowest resolution if you're just setting the xorg.conf to 1400x1050 without using the tool. Which looks like the font is blurred on every second line while reading this at tiny font sizes, couldn't see a difference @16+. Please add if this is also true for chips on desktop motherboards.

IF you are using nVidia's Drivers, a better way to do this would be to add this in your device section. This works a lot better with dual monitors also:

File: /etc/X11/xorg.conf
   Option   "UseEdidDpi"   "FALSE"
   Option   "DPI"   "96 x 96"

Set DPI in Xdefaults

The above strategies did not work for me. If you have the same problem try this

add the following to the .Xdefaults file in your home directory

File: ~/.Xdefaults

Xft.dpi: 96.0

if the file does not exist create it and add the following to the /etc/X11/Sessions/Xsession file

File: /etc/X11/Sessions/Xsession

if [ -f $HOME/.Xdefaults]; then

 xrdb -merge $HOME/.Xdefaults


for more info look here

note: this only changes the fonts (as far as I know)

Retrieved from ""

Last modified: Tue, 16 Sep 2008 21:57:00 +0000 Hits: 5,867