Bump :tools pdf
vedang/pdf-tools@d262cf9 -> vedang/pdf-tools@5f77dae Fixes #4989: remove local hacks for retina support in favor of upstream fixes.
This commit is contained in:
parent
044a1a5f2b
commit
38bc1ab81a
2 changed files with 1 additions and 55 deletions
|
@ -72,56 +72,6 @@
|
|||
(add-hook 'doom-switch-buffer-hook #'+pdf-reload-midnight-minor-mode-h
|
||||
nil 'local))))))
|
||||
|
||||
;; Add retina support for MacOS users
|
||||
(eval-when! IS-MAC
|
||||
(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)
|
||||
"Scale up the PDF on retina displays."
|
||||
:around #'pdf-util-frame-scale-factor
|
||||
(cond ((not pdf-view-use-scaling) 1)
|
||||
((and (memq (pdf-view-image-type) '(imagemagick image-io))
|
||||
(fboundp 'frame-monitor-attributes))
|
||||
(funcall orig-fn))
|
||||
;; Add special support for retina displays on MacOS
|
||||
((and (eq (framep-on-display) 'ns)
|
||||
(not +pdf--scaled-p)
|
||||
EMACS27+)
|
||||
(setq-local +pdf--scaled-p t)
|
||||
2)
|
||||
(1)))
|
||||
|
||||
(defadvice! +pdf--use-scaling-on-ns-a ()
|
||||
:before-until #'pdf-view-use-scaling-p
|
||||
(and (eq (framep-on-display) 'ns)
|
||||
EMACS27+))
|
||||
|
||||
(defadvice! +pdf--supply-width-to-create-image-calls-a (orig-fn &rest args)
|
||||
:around '(pdf-annot-show-annotation
|
||||
pdf-isearch-hl-matches
|
||||
pdf-view-display-region)
|
||||
(letf! (defun create-image (file-or-data &optional type data-p &rest props)
|
||||
(apply create-image file-or-data type data-p
|
||||
:width (car (pdf-view-image-size))
|
||||
props))
|
||||
(apply orig-fn args))))
|
||||
|
||||
;; Silence "File *.pdf is large (X MiB), really open?" prompts for pdfs
|
||||
(defadvice! +pdf-suppress-large-file-prompts-a (orig-fn size op-type filename &optional offer-raw)
|
||||
:around #'abort-if-file-too-large
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue