Re: [ROOT] error in <TTF::SetTextFont> with version 3.05.07 and 3.10 of root

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Nov 12 2003 - 18:42:37 MET


Anne-Marie,

This is not a compilation bug, but a bug occuring at execution time.
It looks like you have a partial implementation of ROOT.
Check that the symbol $ROOTSYS is defined and points to your installation of
ROOT. Check that you have the $ROOTSYS/fonts directory in your system.
This directory should contain 35 fonts including arialbd.ttf

Also check your $ROOTSYS/etc/system.rootrc or $HOME/.rootrc files.
The system.rootrc file should contain the following lines:

# Path where to look for TrueType fonts
Unix.*.Root.UseTTFonts:     true
Unix.*.Root.TTFontPath:     $(ROOTSYS)/fonts

Rene Brun

Anne-Marie Magnan wrote:
> 
>         Dear Root People,
> 
> I have a problem while compiling a program with new versions of root. It
> works well with older version (v3.03/06).
> Here is the error I have,
> 
>         Error in <TTF::SetTextFont>: font file arialbd.ttf not found in path
>         Error in <TTF::SetTextSize>: current font index out of bounds
> 
> a lot of times, and this happened at a simple line of my program:
>                 hist1->Draw();
> 
> If I just comment this line but define the histogram in the same way, it
> works well.
> 
>         I hope I am giving enough information, I put my 'detailed' programs here
> below in case you need it.
> 
>                 Thanks a lot for your help,
> 
>                         Best regards,
> 
>                                         Anne-Marie.
> 
> My program around the bug is: ("........" means a lot of things done with
> nothing to do with the problem)
> 
> ****************************************************************************
> *****
> ****************************************************************************
> *****
> *********** main.C file *******************
> 
> #include <TROOT.h>
> .........
>   p_masse      = new TH1F("masse","masse",200,0,200);
> .........masse = .........
>  p_masse->Fill(masse);
> .........
> gStyle->SetOptStat(111111);
> gStyle->SetOptFit(1111);
> 
> TCanvas *myc = new TCanvas("myc","myc_titre",0,0,360,520);
> 
> Plot1(myc,p_masse,0,"masse (GeV.c^{-2})","","output/masse.eps","nofit");
> 
> *********** Plot method **************
> 
> #include "iostream.h"
> #include "TCanvas.h"
> #include "TPad.h"
> #include "TH1.h"
> #include "TH2.h"
> #include "TStyle.h"
> #include "TFile.h"
> 
> // =====================================================================
> //                          Plot 1 histo
> // =====================================================================
> 
> void Plot1(TCanvas *c1, TH1* hist1, Bool_t log1,
>            const TString &absc = "", const TString &ordo = "",
>            const TString &file = "", const TString &fit = "")
> {
>   if (c1)
>     {
>       c1->Clear();
>     }
>   else
>     {
>       c1 = (TCanvas*)gROOT->FindObject("c1");
>     }
> 
>   TPad* pad1 = new TPad("pad1","pad",0.02,0.02,0.98,0.98);
>   pad1->Draw();
> 
>   pad1->cd();
> 
>   if (log1) pad1->SetLogy(1); else pad1->SetLogy(0);
>   pad1->SetGrid();
>   if(fit=="fit")  hist1->Fit("gaus");
>   hist1->Draw();
>   hist1->GetXaxis()->SetTitle(absc);
>   hist1->GetYaxis()->SetTitle(ordo);
>   c1->Update();
> 
>   if(file!="none") c1->Print(file);
> }
> 
> ************** main.h file (obtain with a MakeClass method)  **************
> 
> #include <TROOT.h>
> #include <TChain.h>
> #include <TFile.h>
> #include "TMatrix.h"
> #include "TObject.h"
> #include "TObjArray.h"
> #include "iostream.h"
> #include <TMath.h>
> 
> #include "TH1.h"
> #include "TH2.h"
> #include "TProfile.h"
> #include "TF1.h"
> //#include "TPostScript.h"
> #include "TStyle.h"
> #include "TCanvas.h"
> 
> #include "PlotUtil.C"
> #include "itoa.C"
> 
> ........
> 
>   TH1F *p_masse;
> 
> ........
> 
>  delete p_masse;
> 
> ........
> 
> ***************************************************************************
> ***************************************************************************
> 
> I execute the program with that line:
> 
> g++ -g `root-config --cflags` -o $1 $1.C `root-config --glibs`
> 
> ********************************************
> MAGNAN Anne-Marie
> Groupe D0, piece 123
> LPSC 53 av. des Martyrs
> F-38026 Grenoble Cedex
> Tel:(33) (0) 4 76 28 40 72
> Fax:(33) (0) 4 76 28 40 04
> e-mail: magnan@lpsc.in2p3.fr
> ********************************************



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET