Function: org--get-display-dpi

org--get-display-dpi is a byte-compiled function defined in org.el.gz.

Signature

(org--get-display-dpi)

Documentation

Get the DPI of the display.

The function assumes that the display has the same pixel width in the horizontal and vertical directions.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--get-display-dpi ()
  "Get the DPI of the display.
The function assumes that the display has the same pixel width in
the horizontal and vertical directions."
  (if (display-graphic-p)
      (seq-max
       (mapcar
        (lambda (attr-list)
          ;; Compute the DPI for a given display ATTR-LIST
          (let* ((height-mm   (nth 1 (alist-get 'mm-size attr-list)))
                 (height-px   (nth 3 (alist-get 'geometry attr-list)))
                 (scale       (alist-get 'scale-factor attr-list 1.0)))
            (round (/ (/ height-px scale) (/ height-mm 25.4)))))
        (display-monitor-attributes-list)))
    (error "Attempt to calculate the dpi of a non-graphic display")))