How to use fonts in GUI?

I make a code based at ROOT GUI. I could not found an example how to increase the font size in the TGStatusBar or in any other TGObjects. I checked your PDF manual and examples in the ROOT/test directory. Can you advise where it can be found or demonstrate the simple example.

Thanking you in anticipation,
Andrei Daniel

Hi Andrei,

To increase the font size in the TGStatusBar just change the default setting in .rootrc fileGui.StatusFont: -adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-iso8859-1 to one you want. For example:Gui.StatusFont: -adobe-helvetica-medium-r-*-*-14-*-*-*-*-*-iso8859-1
You are right, the information about how to set different font size or color is missing in the User’s Guide. I hope to be able (i.e. to have time) to include this important information for the next edition. As an example you can use the following:[code] TGFont ufont; // will reflect user font changes
ufont = gClient->GetFont("-
-times-bold-r---24-------*");

TGGC *uGC; // will reflect user Graphics Context changes
GCValues_t val52;
val52.fMask = kGCForeground | kGCFont; //defines which fields of GC will be changed
gClient->GetColorByName("#ff0000",val52.fForeground);
val52.fFont = ufont->GetFontHandle();
uGC = gClient->GetGC(&val52, kTRUE);
TGLabel *label = new TGLabel(parent,“ROOT”,uGC->GetGC(),ufont->GetFontStruct());
[/code]
Best regards, Ilka

Many thanks.
I used .rootrc file successfully. The second example I will try to use afterwards.
Check me please. The file .rootrc must exist during the translation and during the code execution. I work with Windows XP and tested 3 variants.

  1. File .rootrc was putted in the directory with the code.
  2. It is the same as one but code was retranslated.
  3. It is the same as two but after the translation file .rootrc was deleted.
    Only the second variant works. Is it correct?

Sincerely Yours,
Andrei

Hi Andrei,

Please see the chapter “Environment Setup” of the User’s Guide at: ftp://root.cern.ch/root/doc/chapter2.pdf (page21).

Best regards, Ilka