branch: externals/org
commit 1724419b70398e2c738e7c413b910de72577144e
Author: William <william.br...@studio.unibo.it>
Commit: Ihor Radchenko <yanta...@posteo.net>

    lisp/org.el: Fix computation of the DPI for multiple monitors
    
    * lisp/org.el (org--get-display-dpi): Examine actual monitor
    attributes to find DPI.  Use the maximum possible DPI as
    we (partially) did with `display-mm-height'.
    
    TINYCHANGE
---
 lisp/org.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 49f5c00c6d..a51cf8280f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16555,8 +16555,15 @@ This uses  `org-latex-to-html-convert-command', which 
see."
 The function assumes that the display has the same pixel width in
 the horizontal and vertical directions."
   (if (display-graphic-p)
-      (round (/ (display-pixel-height)
-               (/ (display-mm-height) 25.4)))
+      (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")))
 
 (defun org-create-formula-image

Reply via email to