Issue #15 resolved

Poor display on Macbook Pro with retina screen

Anonymous created an issue

The current version of sage-view yields very pixel-mated output on Macbook Pro with a Retina display. Since Emacs 24 is retina ready, this feels very uncomfortable when making sage calculations within Emacs.

I suppose the poor display problem may stem from the conversion from PDF to png images. However, having practiced with various combinations of gs parameters, I have got no satisfactory resolution. A command line test indicates that using pngalpha instead of png16m as output device and adding -r144 as instruction for resolution gives must better output. But I don't know how to pass the -r144 parameter from inside sage-view.

Comments (8)

  1. Ivan Andrus repo owner

    Sadly, I don't (yet) have a retina display to try and tweak it myself.

    There is a function sage-view-compute-resolution which computes what it thinks the -r parameter should be. You could try changing that. I wonder what display-pixel-width and display-pixel-height return.

  2. l_zhao

    I don't now how display-pixel-width and display-pixel-height could be returned to users. However, messing with the function sage-view-compute-resolution by explicitly specifying h and w parameters to be equal to 120 yields exactly the same effect as the default setup. So, I guess the computed values for sage-view-compute-resolution should be both 120.

  3. l_zhao

    Finally I managed to improve the display on Retina screen some how. The trick is to modify sage-view-gs-options in sage-view-pdf->png. The codes are as follows (including commented original code)

            sage-view-gs-options
            (list 
    ;       (concat "-dTextAlphaBits=" level)
    ;            (concat "-dGraphicsAlphaBits=" level)
           (concat "-dTextAlphaBits=4")
           (concat "-dGraphicsAlphaBits=4")
                 (concat "-sOutputFile=" png)
    ;       (concat "-r" (sage-view-compute-resolution scale))
           (concat "-r 120x120")
                 pdf)))
    
  4. Ivan Andrus repo owner

    l_zhao Does simply changing the variable sage-view-anti-aliasing-level to 4 produce good results? Or do you need to change the resolution as well? Also, what does M-: (sage-view-compute-resolution 1) RET return?

  5. l_zhao

    Simply changing sage-view-anti-aliasing-level to 4 produces better results than the default setting. Changing the resolution makes the output a little bigger and clearer. M-: (sage-view-compute-resolution 1) gives "92.1309823677582x92.1774193548387"

  6. Ivan Andrus repo owner

    The truth is, the default doesn't look so great on my machine which isn't retina. I think I'll up both sage-view-anti-aliasing-level and sage-view-scale. That fixes the ugliness for me, and I think should do basically what your patch does.

  7. Log in to comment