Rescaling text with window size


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.40.02
Platform: Ubuntu 24.04 under Windows WSL
Compiler: gcc 13.3


Hi,

When I open a ROOT window (e.g. TBrowser, FitPanel, …) this window appears rather small with also very small text which is hardly readable (especially when I use it for teaching). The same happened with FireFox, but there I found on the web a method (i.e. export GDK_SCALE=1 export GDK_DPI_SCALE=1.5 export QT_SCALE_FACTOR=1.5) to rescale both the window and the text size in it such that things look o.k. However, this seems not to work for the ROOT produced windows.

Question: Is there a way to have the text size in a ROOT window scale with the window size?

Note that (obviously) I don’t want to reduce the resolution of my display. Also increasing the text size for ROOT in .rootc turned out the pose problems, since when I do that some text becomes only partially displayed (e.g. Set Parameters in the FitPanel).

Cheers,

Nick.

@couet Can you help?

I guess a workaround could be to keep the ROOT window size untouched, and use instead Windows’ Magnifier Use Magnifier to make things on the screen easier to see | Microsoft Support

I found something that kind of works, although the fonts don’t look very nice, depending on the scaling factor (200 seems to look a bit better than 150, for instance, but it may be too big):

Create a file called .wslgconfig in C:\Users\yourusername\ (note the ‘g’ after ‘wsl’; some/most answers online mention .wslconfig, but that doesn’t seem to work, at least for me with WSL2 on Windows 11), and put in it these lines:

[system-distro-env]
WESTON_RDP_HI_DPI_SCALING=true
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=true
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=200

I created the file from a command prompt window with touch, then edited with Notepad++ and finally ran it through dos2unix just to be safe, but it may not be necessary.
Then, in a command prompt, do wsl --shutdown and then open Ubuntu as usual. Now when you run ROOT and create a TBrowser (the root --web=off version; I did not test the Firefox version) it should look bigger. 200 was too big for my screen (HD resolution), but see what works better for you.

Thanks for the advice. I tried it and one has to increase the size a lot (nearly 200%) to get readable text, but then the windows are so big that it is impossible to work in a normal way. With normal Windows11 windows, already an increase of 10% makes a large difference. So, it seems to be related with the fact that the ROOT produced windows have a different resolution. If the scaling could be tuned with the GDK environment variables like with e.g. FireFox, then it would work.

FYI, in WSL, ROOT doesn’t use GDK at all

Thanks! This indeed works, apart from the fact that the fonts look not so nice anymore, but maybe I can select a different font to make it better. Indeed one needs .wslgconfig instead of .wslconfig

Cheers,

Nick.

FYI. If I use a scaling factor of 200 the fonts etc. look fine on my screen. So, for me the problem is hereby solved :wink:

Is there any way this could be activated as an option? Since in that way ROOT could be treated the same way as standard apps like FireFox etc. However, the settings via .wslgconfig work as well, but for some scale factor values the fonts start to look ugly, which is not the case when I use GDK scaling for e.g. FireFox.

No, sorry, that cannot be an option…