Essentially it’s about 1 px error mean when doing pango layouts under 2x desktop scaling. Which gives most of the text GTK draws look wanky.
I was hoping to dive in and try to do my best at fixing it but honestly had no idea where to start yet. I did some digging through codebase but to no luck yet.
Is it worth fixing? Would be great if someone gave me some suggestions then.
Shouldn’t the issue be remedied by coming subpixel font rendering support in cairo?
Or maybe my best bet is just to patiently wait for the advent of GTK4?
Hi! I was able to proceed further on this. You can take a look at this small C sample based only on pangocairo that exhibits the problem. This code shows what Gtk3 does internally. The integer scaling factor (gdk_scale) is set on the CairoSurface with cairo_surface_set_device_scale. The text scaling factor (gdk_dpi_scale) instead is set on the PangoCairoContext using pango_cairo_context_set_resolution. You can compile and run the following snippet and see the output.png file:
Using both cairo_surface_set_device_scale and pango_cairo_context_set_resolution causes a bad interaction. I don’t know if it is a sign of a problem in Pango or if we are instead ‘abusing’ the APIs (and asking for troubles)
Wow, great insight, I’m sure that you’re onto something here!
Good question. Personally I’m inclined to think of it as a bug more than as an abuse, because there seem to be a loss of precision every time a cairo_surface_set_device_scale is used apparently, at least when dealing with pango. But in order to be sure to call it a bug I need some free time to look closely into gtk innards.