2019-08-27 12:36:20 +08:00
|
|
|
;;; tools/pdf/autoload/pdf.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;;;###autoload
|
2019-09-19 18:39:09 -04:00
|
|
|
(defun +pdf--supply-width-to-create-image-calls-a (orig-fn &rest args)
|
|
|
|
(cl-letf* ((old-create-image (symbol-function #'create-image))
|
|
|
|
((symbol-function #'create-image)
|
|
|
|
(lambda (file-or-data &optional type data-p &rest props)
|
|
|
|
(apply old-create-image file-or-data type data-p
|
|
|
|
:width (car (pdf-view-image-size))
|
|
|
|
props))))
|
|
|
|
(apply orig-fn args)))
|
|
|
|
|
2019-08-27 12:36:20 +08:00
|
|
|
;;;###autoload
|
2019-09-19 18:39:09 -04:00
|
|
|
(defun +pdf--util-frame-scale-factor-a (orig-fn)
|
2019-08-27 12:36:20 +08:00
|
|
|
(if (and pdf-view-use-scaling
|
|
|
|
(memq (pdf-view-image-type) '(imagemagick image-io))
|
|
|
|
(fboundp 'frame-monitor-attributes))
|
2019-09-19 18:39:09 -04:00
|
|
|
(funcall orig-fn)
|
|
|
|
;; Add special support for retina displays on MacOS
|
|
|
|
(if (and (eq (framep-on-display) 'ns)
|
|
|
|
EMACS27+)
|
2019-08-27 12:36:20 +08:00
|
|
|
2
|
|
|
|
1)))
|
2019-09-19 18:39:09 -04:00
|
|
|
|
2019-08-27 12:36:20 +08:00
|
|
|
;;;###autoload
|
2019-09-21 14:19:56 -04:00
|
|
|
(defun +pdf--view-use-scaling-p-a ()
|
2019-09-19 18:39:09 -04:00
|
|
|
"Returns t if on ns window-system on Emacs 27+."
|
|
|
|
(and (eq (framep-on-display) 'ns)
|
|
|
|
EMACS27+
|
|
|
|
pdf-view-use-scaling))
|