HOWTO Set DPI (Dots Per Inch)

From Gentoo Linux Wiki

Jump to: navigation, search



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 the i810 driver:

File: from /var/log/Xorg.0.log
[...]
(--) I810(0): Virtual size is 1024x768 (pitch 1024)
[...]
(--) I810(0): Display dimensions: (300, 230) mm
(--) I810(0): DPI set to (86, 84)
[...]

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.

/usr/share/doc/nvidia-glx-<version>/README.gz (appendix Y).

xorg.conf man page.

  • resolution: 1152x864
  • size: 325x243 [mm]
  • DPI: 90x90


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 96 with a resolution of 1920x1200, the calculation would be 25.4 × 1920 / 96 = 508 and 25.4 × 1200 / 96 = 318, resulting in the setting DisplaySize 508 318.

File: /etc/X11/xorg.conf

Add the following line into the Monitor section:

DisplaySize 325 243

nvidia

File: /etc/X11/xorg.conf

Add the following line into the Device section:

Option "UseEdidDpi" "false"
# emerge -av xdpyinfo
Code: xdpyinfo | grep -B1 dot
$ xdpyinfo | grep -B1 dot
  dimensions:    1152x864 pixels (325x244 millimeters)
  resolution:    90x90 dots per inch
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

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

Personal tools