How to set default font for paves/axes etc

I am trying to obtain proper national (polish) characters in root. No luck so far, but I guess this may be because ROOT by default uses iso8859-2 fonts. However, I cannot find a way to change the font of, for example, TGraph title. Setting

Gui.DefaultFont: --courier-medium-r---12------iso8859-1

does not make it courier, so the option apparently does not affect the title. Could you please tell me, how to change fonts of paves/axes etc., to support national characters?

In principal there is nothing to do. You simply enter the characters. Here is a macro showing some special characters:

{
   TCanvas *c1 = new TCanvas("c1", "c1",8,28,699,535);
   c1->Range(0,0,1,1);
   c1->SetBorderSize(2);
   c1->SetFrameFillColor(0);
   TLatex *   tex = new TLatex(0.2207131,0.6792929,"àéñïÑç...");
   tex->Draw();
}



I’ve read the original post regarding this macro. The problem is, that these characters are available in iso8859-1 encoding. So they write them down, convert to iso8859-1 and have them. Mine characters are not in this encoding - they are in, for example, iso8859-2. Therefore after properly typing in my macro national character in iso8859-2, I get, for example, plusminus sign. So I need to change font somehow.

Pepe: you have to convert macro to iso8859-1 with, for example, iconv. Default root fonts, or root in general does not support utf8.

I attach a sample macro. What I should get is “aą” in the graph title, the second character being “a” with a tail. What I get is “a\pm”. The macro is in iso8859-2 encoding. It cannot be converted to iso8859-1.
test1.C (91 Bytes)

Yes I see that.
Note that also in Vi on my mac and with xed I see the same as what is drawn on the canvas.
The problem seems to be more general.

So, we all agree that … in principle there is A LOT to do.

The TLatex class defines several kinds of “accents”: http://root.cern.ch/root/html/TLatex.html

The problem for Latin-based Slavic languages is that some accents are missing.
In your case, the “stroke” and the “ogonek” are missing for the Polish language.

Try:

{ new TCanvas(); (new TLatex(0.1, 0.9, "dot above ... #dot{z} #dot{Z}"))->Draw(); (new TLatex(0.1, 0.8, "acute ... #acute{z} #acute{Z} #acute{s} #acute{S} #acute{o} #acute{O} #acute{n} #acute{N} #acute{c} #acute{C}"))->Draw(); (new TLatex(0.1, 0.7, "stroke ... #stroke{l} #stroke{L}"))->Draw(); (new TLatex(0.1, 0.6, "slash instead of stroke ... #slash{l} #slash{L}"))->Draw(); (new TLatex(0.1, 0.5, "ogonek ... #ogonek{e} #ogonek{E} #ogonek{a} #ogonek{A}"))->Draw(); }

There are two problems with TLatex:

  1. stroke and ogonek do not work here…
  2. acute is bad… I mean the upper coma is not high enough etc. Everyone seeing that knows what it should be, but it looks like 20 or more years ago, when many tricks had to be used to get “national looking” characters. Definitely does not look professional :slight_smile:

Couet: This is normal behaviour when viewing test in encoding different than the viewing program’s. On other platforms you just change the encoding of the programm if possible. On linux, I am not sure what exactly should be done, but since fonts have encoding in their name, I expect that changing font to the one with iso8859-2 in its name should help…

However, no way to change the TPave etc. font in root :slight_smile:

Agreed.

do not use TLatex for that see the image I sent the accent are good (produce the the US international keyboard layout)

So… what should I use? :slight_smile: Is there any solution?

for accents just enter the characters with keyboard in a TText of TLatex.

      à á é è Ä ä É Ë È í Í Ì Ì ù ú Ñ Ñ ç Ç ô â î  ......

as explain here: en.wikipedia.org/wiki/British_an … _keyboards :

I see no way to make thaT “ogonek” using this technique.

I believe the goal should be to introduce UTF-8 to ROOT.
(BTW. It seems to me that the Polish language needs “acute” on some characters which are NOT available in the “US international keyboard layout” - that’s why you cannot simply use “nice-looking” characters that are shown in the first image in this thread.)
On Linux, one can simply input any accented character using the standard US keyboard. One just needs to set X11 to use USA “International (AltGr dead keys)” keyboard.

like ?

For “special” Polish characters, see the source code in my second post here (I hope I listed all of them there).

What concerns the USA “International (AltGr dead keys)” keyboard … I’ve just found this link: http://dry.sailingissues.com/us-international-keyboard-layout.html

yes I see on Z it does not work … ok …

Well, anyway, I need all polish characters, not just part of them…

The truth is that like most ROOT users I produce english language plots 99% of my time. But sometimes I have to produce something national and… what then? I need to use a completely different tool and that’s really bad.

I haven’t looked into sources, but printing on screen a character that is available in the operating system and nearly all apps have access to it, should not be that hard…

Keep in mind that it’s not all about Latin-based alphabets only.
I believe UTF-8 support in ROOT should solve all problems.
(BTW. For the Polish language, it’s not only “z” that is missing “acute”. Also “c”, “n” and “s” are missing it.)

You might try to edit the “${ROOTSYS}/etc/system.rootrc” file (and/or you can simply create your own “.rootrc” file). There are entries which explicitly define used fonts (with encoding).
Try to replace “…-iso8859-1” with “…-iso8859-2” in all entries with names “Gui.*Font”.

Yes, I know that there are many languages which are not supported by root, but are supported by the operating system. I guess support for utf8 is important. For example, students from many countries have to do some plots with national characters often and they may be forced to choose another package instead of ROOT, which would not simply fulfill this very basic requirement.