Font error on mac os


I am developping a gui tool in which I am using a TGListBox for printing some text. It was working perfectly on my ubuntu computer, but when I tried it on a mac os computer, I got this error message when trying to write text entries in the TGListBox

Error in <DrawTextLineNoKerning>: Font could not encode all Unicode characters in a text

Here is the way I print my text in the TGListBox:

void CXHist1DPlayer::PrintInListBox(TString mess, Int_t Type)
    TGGC   *uGC;           // will reflect user GC changes
    // graphics context changes
    GCValues_t val;
    val.fMask = kGCFont;
    uGC = gClient->GetGC(&val, kTRUE);

    TGTextLBEntry *entry = new TGTextLBEntry(fFitResultsBox->GetContainer(), new TGString(mess), -1, uGC->GetGC());
    if(Type == kError)
    else if(Type == kInfo)
    else if(Type == kWarning)
    else if(Type == kPrint)

    fFitResultsBox->AddEntry((TGLBEntry *)entry, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX));

Any idea why ?

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Can you provide a small reproducer we can run ?

Sorry but it’s not so easy, I don’t have the mac os laptop with me so I cannot test it. But for information, when installing root on the concerned laptop, we get an error with the libxml2 library refering to “unicode/ucnv.h”. So we have deactivated the xml library in root compilation. Could it be linked ?


No … I do not think so. Your initial problem seems related to the GUI fonts. May be @bellenot has an idea about it. But in any case a reproducer would help.

By the way do you pass some special characters to the TGListBox ? like French accents ?


This error is specific to Mac, and Unicode is not supported in the ROOT GUI anyway…

As you can see on the attached screen-shot (bottom left corner), there is no specitic character (from my linux laptop). Does it means that I cannot write anything in a TGListBox on mac ???

No, it should work on Mac the same way than on Linux. You can try $(ROOTSYS)/tutorials/listBox.C

Can you try the following macro and let me know if it works for you?
testListBox.C (4.2 KB)

FYI: I just tried on Mac the test Bertrand posted and it works fine for me on Mac with ROOT master

1 Like

And the fact that as I said, when trying to install the xml library, we had an error also concerning unicode "unicode/ucnv.h”, cannot be the source of the problem ? A missing package on its mac ?

AFAIK, the GUI has nothing to do with xml…

With xml I agree, but the error was related to a unicode stuff that I never seen before…

Can you try the example Bertrand posted ?

1 Like

Cool, I could test it on the mac of my colleague and it works. The error was comming from the lines “uGC->GetGC())” that I used for an unknown reason…
Thanks a lot !

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.