Scaling issues with HiDPI screens
heroin-moose opened this issue · 5 comments
Hi,
Seems like the console/overlay code needs some adjustments to work on HiDPI output (tested on Wayland):
My system:
- Compositor: sway version 1.5-38571e6a (Jan 17 2021, branch 'master')
- Monitor: Dell P2415Q (DPI ~184)
- Resolution: 3840x2160
My config file:
$ cat .config/imv/config
# Configuration file for imv.
# See imv(5) for details.
[options]
background = #2e3440
overlay_font = Iosevka Extended
overlay_background_color = #2e3440
While there I suggest replacing pango_font_description_set_absolute_size()
with pango_font_description_set_size()
and setting the font scale via pango_attr_scale_new()
. This will allow users to set the font size in a manner most other programs do (My Font:10 instead of My Font:24) and let pango do the conversion based on current scale and the output type).
Setting the device scale via cairo_surface_set_device_scale()
helps with both issues (font and bars positioning), I'll try to create a PR in a day or two.
@heroin-moose This sounds great! Did your idea work? If not, what was the problem?
I'm struggling with the same issue here. I could try to look into fixing it if you tell me about the progress you made.
Damn, I'm sorry. I've stopped using imv so I kinda forgot to finish my changes. I'll publish the branch with my fixes tomorrow.
Indeed, doing cairo_surface_set_device_scale(surface, 10, 10);
after every call to surface = cairo_image_surface_create(…)
will scale all the fonts 10 times (10 is just a constant from the top of my head).
I'm struggling now to figure out how to read Wayland's scaling settings to put the right value instead of 10. It seems that Wayland may ask us to update the scaling factor at runtime.
Yeah, the value can change if the windows is moved to another output with a different scale. Or if scale is changed while imv
is running.