Set default font for GUI without using .rootrc

Dear rooters,

is it possible to set the default font for all elements in a GUI in the code? I know I can use .rootrc to set the default font. But I cannot tell every user of the GUI to change his .rootrc. Besides, settings in .rootrc will also affect other ROOT windows, for example, the TBrowser, which is not what I want.

Cheers, Jing

Hi Jing,

If you don’t want to use the global font settings (via .rootrc), then you have to set the for each GUI element with their SetFont() method.
But note that if you have a stand-alone ROOT application, you can specify the font like this:

int main(int argc, char **argv)
{
   gEnv->SetValue("Gui.DefaultFont", "-adobe-segoe UI-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
   TApplication theApp("App", &argc, argv);
   ....

Cheers, Bertrand.

Dear Bertrand,

exactly the solution I am looking for. Thanks a lot!

Cheers, Jing