emacs-devel
[Top][All Lists]
Advanced

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

Re: "Fix" sag scaling for hidpi


From: Alan Third
Subject: Re: "Fix" sag scaling for hidpi
Date: Sun, 7 Feb 2021 21:58:43 +0000

On Thu, Feb 04, 2021 at 06:10:15PM -0500, Yuan Fu wrote:
> 
> 
> > On Feb 4, 2021, at 5:07 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> > 
> >> And Emacs will display a crisp 100x100 image in the buffer. However, this 
> >> doesn’t work for sag images. If I do
> >> 
> >> (progn
> >>  (require 'svg)
> >>  (let ((svg (svg-create 200 200)))
> >>    (svg-text svg "test"
> >>              :font-size 100
> >>              :y 150)
> >>    (insert-image (svg-image svg :scale 0.5))))
> >> 
> >> The image is still blurry:
> > 
> > I think it's a bug, and that even
> > 
> >    (progn
> >      (require 'svg)
> >      (let ((svg (svg-create 100 100)))
> >        (svg-text svg "test"
> >                  :font-size 100
> >                  :y 150)
> >        (insert-image (svg-image svg :scale 1.0))))
> > 
> > should insert a crisp image.
> 
> Sorry, I should be more specific. This blurry problem only occurs on
> nsterm with hidpi screens. (That’s because cocoa reports logical
> pixel sizes instead of physical ones.)

At one time I had a patch that fixed this for SVGs on NS, but I wasn't
sure if it was "available" on other platforms (GTK is the only place I
know of that lets you set default scaling) and it wasn't generalised
to all images.

The best solution I could find is to set the SVG dpi and size
according to the real screen DPI, then when it comes to generating the
transform matrix allow divide the sizes by the scale factor.

It also wasn't clear to me what we should do about dpi on macOS.
Apparently macOS pretends the dpi is 72 no matter what the real value
is, and that meant keeping track of both the fake dpi and the real
dpi.

I wish I could find that patch now, but I guess it was deleted in a
clean-up.
-- 
Alan Third



reply via email to

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