GUI dpi scaling?

Hello,

What’s the expected way to do dpi scaling in the ROOT GUI?
I have a high-resolution screen and the GUI is tiny.

Thanks,
Andreas

Hi Andreas,

You can try to increase the font size in $(ROOTSYS)/etc/system.rootrc or in your own custom ~/.rootrc

Cheers, Bertrand.

Hi Bertrand,

This does help! What about radio and checkbox buttons. How do I scale them?

Thanks,
Andreas

Hi Andreas,

You can’t. They are based on pixmaps, and there is no way to scale such components…

Cheers, Bertrand.

Hi Bertrand,

With the wide-spread use of Retina/4K displays in the near future, are there any plans to change this?

Another question: Is there any possibility to change the default font size in the GUI programatically, and not just in .rootrc?

Thanks,
Andreas

[quote=“acz”]With the wide-spread use of Retina/4K displays in the near future, are there any plans to change this?[/quote]Well, yes, but this requires deep, low-level changes in the way gui is rendered, but yes, gui modernization is planned (not only for high resolution display).

[quote=“acz”]Another question: Is there any possibility to change the default font size in the GUI programatically, and not just in .rootrc?[/quote]Yes, you can set the font for each widget (check the SetFont() methogs in the GUI classes). Or by using TEnv::SetValue(). For example:

gEnv->SetValue("Gui.DefaultFont", "-*-helvetica-medium-r-*-*-24-*-*-*-*-*-iso8859-1");
But you have to do it at the very beginning of the application, before creating the TApplication instance.

Cheers, Bertrand.

Great! Thanks a lot!
Andreas

You’re very welcome! :slight_smile:
Cheers, B.

Hi, sorry for necrobumping, but I just installed ROOT on my new Lenovo Carbon X1 and have the same exact issue. It is well known that HiDPI support in Linux is still quite poor, but I managed to fix most of problems with GUI apps by increasing Xorg’s dpi setting as described e.g. here.

I wanted to know if there are any news about this issue. As most modern apps do, ROOT should respect the Xft.dpi setting.

Hi,

This issue will be solved by using the new, Web based ROOT7 GUI like the RBrowser. If you have a recent version of ROOT, you can already try it:

root [0] ROOT::Experimental::RBrowser b

Cheers, Bertrand.

Thanks!

For the record, things get better in the classic GUI by adding the following to .rootrc:

Gui.DefaultFont:            -*-helvetica-medium-r-*-*-24-*-*-*-*-*-iso8859-1
Gui.MenuFont:               -*-helvetica-medium-r-*-*-24-*-*-*-*-*-iso8859-1
Gui.MenuHiFont:             -*-helvetica-bold-r-*-*-24-*-*-*-*-*-iso8859-1
Gui.DocFixedFont:           -*-courier-medium-r-*-*-24-*-*-*-*-*-iso8859-1
Gui.DocPropFont:            -*-helvetica-medium-r-*-*-24-*-*-*-*-*-iso8859-1
Gui.IconFont:               -*-helvetica-medium-r-*-*-20-*-*-*-*-*-iso8859-1
Gui.StatusFont:             -*-helvetica-medium-r-*-*-20-*-*-*-*-*-iso8859-1
Browser.IconStyle:           big

and the following to .rootlogon.C:


    gStyle->SetCanvasDefH(2*gStyle->GetCanvasDefH());
    gStyle->SetCanvasDefW(2*gStyle->GetCanvasDefW());
    gStyle->SetFrameBorderSize(2*gStyle->GetFrameBorderSize());
    gStyle->SetFrameLineWidth(2*gStyle->GetFrameLineWidth());
    gStyle->SetFuncWidth(2*gStyle->GetFuncWidth());
    gStyle->SetGridWidth(2*gStyle->GetGridWidth());
    gStyle->SetHistLineWidth(2*gStyle->GetHistLineWidth());

    // optional
    //gROOT->ForceStyle();
3 Likes

Thanks for sharing, this should probably be a FAQ :slight_smile:

1 Like

Hi all, I’ve recently put my hands on a 2015 Retina MacBook with Intel Iris 6100 graphics card and I’ve been tinkering around the problem on various desktop environments and display servers. Here is what I found:

On Wayland

Interestingly enough, a recent install of Fedora 36 linux with KDE on Wayland provides correct scaling of the old ROOT TBrowser good enough out of the box. Well, window is a little blurry but respects the system wide scaling setting. Please refer to the screenshot below:

I also tried GNOME desktop environment on Wayland. However, it did not work out positively. Not sure what the workaround could be here but something about KWin on Wayland just works better. Looks like KDE on Wayland is a clear winner.

On X.Org

It seems that Xorg’s Xft.dpi setting mentioned above may scale the font size. Only if app developers will explicitly account on it in the code. Xlib libraries, that ROOT graphics depend on, do not account on this setting.

Solution that worked for me on X.org is following:

  1. Install run_scaled script from GitHub with corresponding dependencies xvfb, xpra, xrandr. Copy run_scaled to say ~/.local/bin and make sure it has executable permissions.
  2. Run your ROOT script that utilizes Xlib at 2x scale with your ROOT script with run_scaled root --web=off <your-script.sh>. Same applies to any standalone application, in particular, ROOT-based that uses TCanvas, GUI classes etc.: run_scaled <your-root-based-app>.

Most commonly users may want to run just a TBrowser instance. Standard rootbrowse script unexpectedly quit on me with run_scaled (maybe Python users can comment on that). Therefore, to quickly run an old TBrowser we can create a ROOT script that will launch it:

echo "void browser(){ new TBrowser(); }" > ~/.local/bin/browser.c

And launch it at 2x scale with following command:

run_scaled root --web=off `which browser.c`

Optionally we can create an alias for the above command:

echo "alias rootbrowse2x='run_scaled root --web=off `which browser.c`'" >> ~/.bashrc
source ~/.bashrc

… and simply run it with rootbrowse2x from the Terminal. Attached please find a screenshot that demonstrated the end result.

Hope this is helpful!

2 Likes

It really is helpful! Thanks! A shame that it makes the startup much slower, but still better than trying to hit the controls or read anything in ROOT in 4K.

Cool, thanks! Can you create a FAQ with this content? That would be great! (I can also copy/paste it if you prefer)

I’ll do it

1 Like

Done → GUI on high resolution screens