summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVedang Manerikar <ved.manerikar@gmail.com>2022-10-12 20:47:13 +0530
committerVedang Manerikar <ved.manerikar@gmail.com>2022-11-25 11:30:59 +0530
commit1f91ba8894e3820faa82e5cc95a0de163c461cb0 (patch)
treee3ef97a4dad2a18b36178c8e097a0884296bf125
parent321e19ed597483ec4b5bebc2de160ba3803f1a8b (diff)
Render crisp images for HiDPI screens by default
Copying from the README: > `pdf-tools` version `1.1.0` release changed the default value of > `pdf-view-use-scaling` to `t` (previously, it was `nil`). This has > been done keeping in mind that most modern monitors are HiDPI > screens, so the default configuration should cater to this user. If > you are not using a HiDPI screen, you might have to change this > value to `nil` in your configuration. Closes: #133
-rw-r--r--NEWS20
-rw-r--r--README.org8
-rw-r--r--lisp/pdf-cache.el6
-rw-r--r--lisp/pdf-util.el24
-rw-r--r--lisp/pdf-view.el8
5 files changed, 45 insertions, 21 deletions
diff --git a/NEWS b/NEWS
index 00d2d5c..1ff8c77 100644
--- a/NEWS
+++ b/NEWS
@@ -2,8 +2,24 @@
* Version 1.0.0 (Under Development)
From this version onward, we will follow Semantic Versioning for new ~pdf-tools~ releases.
-** Raise the minimum supported version of Emacs to 26.1
-Drop support for Emacs 24 and 25. This allows for some code cleanup.
+
+** Breaking changes:
+*** Raise the minimum supported version of Emacs to 26.3 #26
+Drop support for Emacs 24 and 25. This allows for some code cleanup. *This is a major breaking change*.
+*** Change the default value of pdf-view-use-scaling #133
+~pdf-view-use-scaling~ is now true by default, leading to rendering of crisp images on high-resolution screens. This should not cause problems on low-resolution screen (other than taking up more cache space / increasing rendering time), but if it does, please ~(setq pdf-view-use-scaling nil)~ in your configuration.
+
+** Improve overall user experience
+- Set ~pdf-annot-list-highlight-type~ to true by default.
+ + Show annotation color when listing them by default, allow the user to turn them off if need be.
+
+** Make changes required by newer versions of Emacs
+- Emacs 29 introduces ~pixel-scroll-precision-mode~, which interferes with ~pdf-view~ scrolling. This is fixed in #124
+
+** Functionality fixes and improvements
+- Fix ~revert-buffer~ to correctly work over Tramp #128
+- Fix sorting by date in ~pdf-annot-list-mode~ #75
+
* Version 0.91
** Change the keybindings for traversing history
This is a minor but *breaking change*. ~l~ (backward) and ~r~ (forward) are the conventional bindings for history navigation in Emacs, but ~pdf-tools~ uses ~B~ and ~N~. The previous keybindings are kept as-is for people who were used to it, while introducing ~l~ and ~r~ keybindings as well.
diff --git a/README.org b/README.org
index 67d443c..57409fb 100644
--- a/README.org
+++ b/README.org
@@ -521,7 +521,7 @@ L/R scrolling breaks while zoomed into a pdf, with usage of sublimity smooth scr
:ID: C3A4A7C0-6BBB-4923-AD39-3707C8482A76
:END:
-In such PDFs the selected text becomes hidden behind the selection; see [[https://github.com/vedang/pdf-tools/issues/149][this issue]], which also describes the workaround in detail. The following function, which depends on the [[https://github.com/orgtre/qpdf.el][qpdf.el]] package, can be used to convert such a PDF file into one where text selection is transparent:
+In such PDFs the selected text becomes hidden behind the selection; see [[https://github.com/vedang/pdf-tools/issues/149][this issue]], which also describes the workaround in detail. The following function, which depends on the [[https://github.com/orgtre/qpdf.el][qpdf.el]] package, can be used to convert such a PDF file into one where text selection is transparent:
#+begin_src elisp
(defun my-fix-pdf-selection ()
"Replace pdf with one where selection shows transparently."
@@ -605,15 +605,15 @@ To see the list of operating systems where compilation testing is supported, run
:CREATED: [2021-12-30 Thu 22:04]
:ID: 3be6abe7-163e-4c3e-a7df-28e8470fe37f
:END:
-** I'm on a Macbook and PDFs are rendering blurry
+** PDFs are not rendering well!
:PROPERTIES:
:CREATED: [2021-12-30 Thu 22:04]
:ID: 20ef86be-7c92-4cda-97ec-70a22484e689
:END:
-If you are on a Macbook with a Retina display, you may see PDFs as blurry due to the high resolution display. Use:
+~pdf-tools~ version ~1.1.0~ release changed the default value of ~pdf-view-use-scaling~ to ~t~ (previously, it was ~nil~). This has been done keeping in mind that most modern monitors are HiDPI screens, so the default configuration should cater to this user. If you are not using a HiDPI screen, you might have to change this value to ~nil~ in your configuration
#+begin_src elisp
- (setq pdf-view-use-scaling t)
+ (setq pdf-view-use-scaling nil)
#+end_src
to scale the images correctly when rendering them.
diff --git a/lisp/pdf-cache.el b/lisp/pdf-cache.el
index 31073ff..650ff36 100644
--- a/lisp/pdf-cache.el
+++ b/lisp/pdf-cache.el
@@ -429,9 +429,9 @@ WINDOW and IMAGE-WIDTH decide the page and scale of the final image."
(pdf-cache-lookup-image
page
image-width
- (if (not pdf-view-use-scaling)
- image-width
- (* 2 image-width))))
+ (if pdf-view-use-scaling
+ (* 2 image-width)
+ image-width)))
(setq page (pop pdf-cache--prefetch-pages)))
(pdf-util-debug
(when (null page)
diff --git a/lisp/pdf-util.el b/lisp/pdf-util.el
index e17800c..1e3b7be 100644
--- a/lisp/pdf-util.el
+++ b/lisp/pdf-util.el
@@ -856,14 +856,22 @@ See also `regexp-quote'."
(defun pdf-util-frame-ppi ()
"Return the PPI of the current frame."
- (let* ((props (frame-monitor-attributes))
- (px (nthcdr 2 (alist-get 'geometry props)))
- (mm (alist-get 'mm-size props))
- (dp (sqrt (+ (expt (nth 0 px) 2)
- (expt (nth 1 px) 2))))
- (di (sqrt (+ (expt (/ (nth 0 mm) 25.4) 2)
- (expt (/ (nth 1 mm) 25.4) 2)))))
- (/ dp di)))
+ (condition-case nil
+ (let* ((props (frame-monitor-attributes))
+ (px (nthcdr 2 (alist-get 'geometry props)))
+ (mm (alist-get 'mm-size props))
+ (dp (sqrt (+ (expt (nth 0 px) 2)
+ (expt (nth 1 px) 2))))
+ (di (sqrt (+ (expt (/ (nth 0 mm) 25.4) 2)
+ (expt (/ (nth 1 mm) 25.4) 2)))))
+ (/ dp di))
+ ;; Calculating frame-ppi failed, return 0 to indicate unknown.
+ ;; This can happen when (frame-monitor-attributes) does not have
+ ;; the right properties (Emacs 26, 27). It leads to the
+ ;; wrong-type-argument error, which is the only one we are
+ ;; catching here. We will catch more errors only if we see them
+ ;; happening.
+ (wrong-type-argument 0)))
(defvar pdf-view-use-scaling)
diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el
index 981aa1b..849be6a 100644
--- a/lisp/pdf-view.el
+++ b/lisp/pdf-view.el
@@ -86,7 +86,7 @@ FIXME: Explain dis-/advantages of imagemagick and png."
:group 'pdf-view
:type 'boolean)
-(defcustom pdf-view-use-scaling nil
+(defcustom pdf-view-use-scaling t
"Whether images should be allowed to be scaled for rendering.
This variable affects both the reuse of higher-resolution images
@@ -955,9 +955,9 @@ See also `pdf-view-use-imagemagick'."
(let* ((size (pdf-view-desired-image-size page window))
(data (pdf-cache-renderpage
page (car size)
- (if (not pdf-view-use-scaling)
- (car size)
- (* 2 (car size)))))
+ (if pdf-view-use-scaling
+ (* 2 (car size))
+ (car size))))
(hotspots (pdf-view-apply-hotspot-functions
window page size)))
(pdf-view-create-image data