How can the font be set in TGHtml?


I can’t figure out how to set the font for text shown in a TGHtml.
My first guess was to use the standard HTML field “font”, say: <font face=Arial size=5 color=550044>. This sets the size and color, but the font “face” has no effect. I also tried other values instead of “Arial”, such as Verdana, helvetica, 1, etc.

Maybe I’m just failing to guess the right (undocumented) format in which to specify the font?
Unfortunately I can’t find any example of selecting a font in a TGHtml (so far looked at user guide, tutorials, forums, various bug reports).

BTW: when I run the examples of … _test.html in a TGHtml object, e.g., from python by b=ROOT.TGHtmlBrowser(""), the examples showing different fonts (which actually use the “style” field), do not work.

Any ideas?

BTW2: I’m running on Linux, ROOT v5.34.32, and while the font of the TGHtml is impressively ugly, in other places in the ROOT GUI has decent-looking fonts.


Hi Amnon,

You could try to use Xft by setting X11.UseXft to yes in $ROOTSYS/etc/system.rootrc or in your custom ~/.rootrc. For example:

# Settings for X11 behaviour. X11.Sync: no X11.FindBestVisual: yes X11.UseXft: yes X11.XInitThread: yes
Cheers, Bertrand