Fractional scale factor in GTK ... again

Hello guys!

First of all, I’ve made some researches and I know that new version of GNOME on wayland support fractional scale factor but that is another layer, I just curious about the GTK (or GDK?) layer particular.

I’m new to GTK library but I have been working with OpenGL/DirectX and Cairo (which is dependencies of GTK), all those use floating point values for position/size. That surprised me when I see that GTK (or GDK?) did not support floating point scale factor (like when setting GDK_SCALE to 1.5, the library use atol to convert to integer value). So my question is what is the reason that prevent us from using a fractional scale factor for GTK?

Thank you for reading my post!

1 Like

Everything, from the fact that Wayland has an integer scaling factor, to the fact that non-integer scaling factors will result in fractional pixel values that will either make no sense—a window cannot be 200.6×300.2 pixels in size—or will result in rendering that is not aligned to the pixel grid, like blurry text or blurry images.

The only way to allow non-integer scaling factor at the toolkit level is for the toolkit to decide the fractions, so it can choose factors that will result in (mostly) aligned results. The other option, which is what every other platform does, is to render at an integer scaling factor and then have the compositor do the scaling, using its own factors.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.