svg-lib icon indicating copy to clipboard operation
svg-lib copied to clipboard

Problem with icon scaling (200%, GTK3 build)

Open dgutov opened this issue 1 year ago • 6 comments

Like discussed in https://github.com/jdtsmith/kind-icon/issues/22#issuecomment-2189593792,

this recipe:

(insert-image (svg-lib-icon  "folder" kind-icon-default-style)) 

leads to the icon being twice as big as it should.

dgutov avatar Jun 25 '24 18:06 dgutov

Any ideas on this one @rougier? Some systems get icons that are roughly twice as large as expected, but I haven't figured out a pattern.

jdtsmith avatar Jul 16 '24 16:07 jdtsmith

Sorry for the long delay. Do you know if your desktop has any kind of software scaling factor ?

rougier avatar Aug 28 '24 11:08 rougier

@jilen is that true in your case? I have HDPI on Mac but have never encountered this. From my recollection, it seems to be with some Linux HDPI systems.

jdtsmith avatar Aug 28 '24 12:08 jdtsmith

Do you know if your desktop has any kind of software scaling factor ?

200%, yes (that's the scaling I'm referring to in the title).

dgutov avatar Aug 30 '24 00:08 dgutov

Very, very late sorry for that. Since your desktop has a 200% factor, I need to have access to this information to compute the right size but I'm not sure how to do that with GTK3. Do you know if it is accessible from within Emacs?

rougier avatar Oct 21 '24 13:10 rougier

Hi!

Since your desktop has a 200% factor, I need to have access to this information to compute the right size but I'm not sure how to do that with GTK3.

There might be a better answer, but the approach I went with in https://github.com/company-mode/company-mode/blob/master/company.el#L2013 is just specifying :width and :height in pixels without accounting for any scaling factors there. Seems to work fine in the cases I've tested (both GNU/Linux and macOS).

Emacs seems to return accurate line/window heights in pixels when you call default-font-height, frame-pixel-height or display-pixel-height, without adjustment for scaling. They return 34, 1990 and 2160 respectively in my current configuration.

dgutov avatar Oct 21 '24 19:10 dgutov