emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Mac port


From: YAMAMOTO Mitsuharu
Subject: Re: Emacs Mac port
Date: Sat, 23 Apr 2016 08:51:45 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

The ninth update of the Mac port based on Emacs 24.5 is available from

  ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-24.5-mac-5.16.tar.gz

and Git repository is also available at

  https://bitbucket.org/mituharu/emacs-mac.git

A bare development branch (no documentation updates yet) based on the
pretest versions of Emacs 25.1 is also available from the "work"
branch of the above repository.


** Fixed bugs

*** M-x tool-bar-mode RET for a fullheight/maximized frame fails on
its first invocation.

*** Wrong size calculations for 2x genuine imagemagick images.  For
example, (image-size (create-image "splash.png" 'imagemagick nil
:max-height 300)) is larger than the one without the :max-height
property if the frame is on a Retina display.

** Improvements

*** For frames on a Retina display, image-io/imagemagick image
descriptors involving non-integral transformations such as shrinking
or rotation are now processed with 2x pixel buffer even if the source
image file/data is for 1x.  For example, (insert-image (create-image
"gnus/gnus.png" 'imagemagick nil :max-height 100)) now looks crisper.

*** Org mode LaTeX fragments preview may also create 2x images.


The patch below is a quick hack (see the "XXX" comment below) for PDF
Tools to display 2x images on Retina display.

                                     YAMAMOTO Mitsuharu
                                address@hidden

diff --git a/lisp/pdf-annot.el b/lisp/pdf-annot.el
index 32cb237..bb63a71 100644
--- a/lisp/pdf-annot.el
+++ b/lisp/pdf-annot.el
@@ -921,6 +921,7 @@ other annotations."
                (pdf-cache-renderpage-highlight
                 page (car size)
                 `("white" "steel blue" 0.35 ,@edges))
+            :width (car size)
              :map (pdf-view-apply-hotspot-functions
                    window page size))))
         (pdf-util-scroll-to-edges
diff --git a/lisp/pdf-info.el b/lisp/pdf-info.el
index 6a5edb8..62da214 100644
--- a/lisp/pdf-info.el
+++ b/lisp/pdf-info.el
@@ -1514,7 +1514,15 @@ Return the data of the corresponding PNG image."
     'renderpage
     (pdf-info--normalize-file-or-buffer file-or-buffer)
     page
-    width
+    (* width
+       ;; XXX This does not give optimal results when you have both
+       ;; Retina and non-Retina displays connected.  For true
+       ;; high-resolution support, one should use either TIFF, "@2x"
+       ;; convention, or resolution-independent formats such as PDF.
+       (or (and (memq (pdf-view-image-type) '(imagemagick image-io))
+               (fboundp 'frame-monitor-attributes)
+               (cdr (assq 'backing-scale-factor (frame-monitor-attributes))))
+          1))
     (let (transformed)
       (while (cdr commands)
         (let ((kw (pop commands))
diff --git a/lisp/pdf-isearch.el b/lisp/pdf-isearch.el
index bffbd3b..674d295 100644
--- a/lisp/pdf-isearch.el
+++ b/lisp/pdf-isearch.el
@@ -728,7 +728,7 @@ MATCH-BG LAZY-FG LAZY-BG\)."
                                  occur-hack-p)
                              (eq page (pdf-view-current-page)))
                     (pdf-view-display-image
-                     (pdf-view-create-image data))))))))
+                     (pdf-view-create-image data :width width))))))))
       (pdf-info-renderpage-text-regions
        page width t nil
        `(,fg1 ,bg1 ,@(pdf-util-scale-pixel-to-relative
diff --git a/lisp/pdf-view.el b/lisp/pdf-view.el
index 555032e..406ab98 100644
--- a/lisp/pdf-view.el
+++ b/lisp/pdf-view.el
@@ -725,7 +725,7 @@ See also `pdf-view-set-slice-from-bounding-box'."
   "Return the image-type which should be used.
 
 The return value is either imagemagick (if available and wanted
-or if png is not available) or png.
+or if png is not available), image-io (on the Mac port), or png.
 
 Signal an error, if neither imagemagick nor png is available.
 
@@ -733,6 +733,8 @@ See also `pdf-view-use-imagemagick'."
   (cond ((and pdf-view-use-imagemagick
               (fboundp 'imagemagick-types))
          'imagemagick)
+        ((image-type-available-p 'image-io)
+         'image-io)
         ((image-type-available-p 'png)
          'png)
         ((fboundp 'imagemagick-types)
@@ -741,8 +743,8 @@ See also `pdf-view-use-imagemagick'."
          (error "PNG image supported not compiled into Emacs"))))
 
 (defun pdf-view-use-scaling-p ()
-  (and (eq 'imagemagick
-           (pdf-view-image-type))
+  (and (memq (pdf-view-image-type)
+            '(imagemagick image-io))
        pdf-view-use-scaling))
 
 (defmacro pdf-view-create-image (data &rest props)
@@ -1195,7 +1197,8 @@ This is more useful for commands like
               `(,(car colors) ,(cdr colors) 0.35 ,@region))
            (pdf-info-renderpage-text-regions
             page width nil nil
-            `(,(car colors) ,(cdr colors) ,@region)))))))
+            `(,(car colors) ,(cdr colors) ,@region)))
+       :width width))))
     
 (defun pdf-view-kill-ring-save ()
   "Copy the region to the `kill-ring'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]