Fix #4989: pdf scaling on retina displays
This commit is contained in:
parent
91573dd95f
commit
ea9753a5f2
1 changed files with 18 additions and 3 deletions
|
@ -106,8 +106,24 @@
|
||||||
|
|
||||||
;; Add retina support for MacOS users
|
;; Add retina support for MacOS users
|
||||||
(eval-when! IS-MAC
|
(eval-when! IS-MAC
|
||||||
(defvar +pdf--scaled-p nil)
|
(defun +pdf-view-create-page-a (page &optional window)
|
||||||
|
"Create an image of PAGE for display on WINDOW."
|
||||||
|
:override #'pdf-view-create-page
|
||||||
|
(let* ((size (pdf-view-desired-image-size page window))
|
||||||
|
(width (if (not (pdf-view-use-scaling-p))
|
||||||
|
(car size)
|
||||||
|
(* 2 (car size))))
|
||||||
|
(data (pdf-cache-renderpage
|
||||||
|
page width width))
|
||||||
|
(hotspots (pdf-view-apply-hotspot-functions
|
||||||
|
window page size)))
|
||||||
|
(pdf-view-create-image data
|
||||||
|
:width width
|
||||||
|
:scale (if (pdf-view-use-scaling-p) 0.5 1)
|
||||||
|
:map hotspots
|
||||||
|
:pointer 'arrow)))
|
||||||
|
|
||||||
|
(defvar +pdf--scaled-p nil)
|
||||||
(defadvice! +pdf--scale-up-on-retina-display-a (orig-fn &rest args)
|
(defadvice! +pdf--scale-up-on-retina-display-a (orig-fn &rest args)
|
||||||
"Scale up the PDF on retina displays."
|
"Scale up the PDF on retina displays."
|
||||||
:around #'pdf-util-frame-scale-factor
|
:around #'pdf-util-frame-scale-factor
|
||||||
|
@ -126,8 +142,7 @@
|
||||||
(defadvice! +pdf--use-scaling-on-ns-a ()
|
(defadvice! +pdf--use-scaling-on-ns-a ()
|
||||||
:before-until #'pdf-view-use-scaling-p
|
:before-until #'pdf-view-use-scaling-p
|
||||||
(and (eq (framep-on-display) 'ns)
|
(and (eq (framep-on-display) 'ns)
|
||||||
EMACS27+
|
EMACS27+))
|
||||||
pdf-view-use-scaling))
|
|
||||||
|
|
||||||
(defadvice! +pdf--supply-width-to-create-image-calls-a (orig-fn &rest args)
|
(defadvice! +pdf--supply-width-to-create-image-calls-a (orig-fn &rest args)
|
||||||
:around '(pdf-annot-show-annotation
|
:around '(pdf-annot-show-annotation
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue