Evgeny Zajcev <lg.zevlg@gmail.com> writes:
> Lars, could you please elaborate the logic in the
> `image-compute-scaling-factor'. As I understand, it means "the larger
> font you have, the larger image you get"? But why? I use large fonts
> (say 30 pixels in width), in 1920x1080 screen,
(/ 1920.0 30) => 64.0
You only have 64 characters in width?
> and I'm totally ok with scale factor 1 for images, but `auto'
> image-scaling-factor gives me 3 as default scale. This results in
> very large images.
The idea is that images scale somewhat along the lines of your
characters, so if you're reading text with interspersed images (for
instance, math equations), they'll be approximately the same size,
whether you're using a HiDPI display or not. As a heuristic, that seems
to work surprisingly well.
But the problem is that this scaling logic is applied globally to all the images used inside Emacs, not only to some math equations.
For me, this looks surprisingly bad
(This is based on the assumption that your image resources come from a
non-HiDPI world, though.)
If you don't want that, then set the scaling factor to whatever you
want.
> For better `auto' scaling we should consider the physical size of the
> display and its resolution (that is called DPI I think?) not the size
> of the font. But probably this info is not always available. If we
> have that DPI info, we can then calculate `auto' scale factor using
> "typical DPI" (where images looks ok). Something like:
The problem is that the functions that say how big a screen are are
often incorrect. I've got a 14" 3840x2160 screen:
(display-mm-height)
=> 571
It's not half a meter high, I can assure you.
So, what the value you have now as return for (image-compute-scaling-factor 'auto) ?
With code I've provided you hit into typical DPI (your DPI=96 < 100) and get scaling factor 1.