>> The patch retrieves its data from `display-monitor-attributes-list`
>> which seems more consistent than the previously used functions, albeit
>> having more overhead (parsing is to be done). It also accounts for the
>> scaling field provided by the aforementioned function.
>
> Not all the monitors have scaling field. Your patch should account for
> that.

For your reference, here's org-latex-preview--get-display-dpi, the
replacement for org--get-display-dpi in the upcoming org-latex-preview.

(defun org-latex-preview--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)
      (let ((mm-height (or (display-mm-height) 0))
            (mm-per-inch 25.4))
        (if (= 0 mm-height)
            140 ; Fallback reasonable DPI
          (round (/ (display-pixel-height) (/ mm-height mm-per-inch)))))
    (error "Attempt to calculate the dpi of a non-graphic display")))

If we cannot get the mm height we fall back to a reasonable DPI.

Karthik

Reply via email to