25 if ((fontid < 0) || (fontid_bold < 0) || (fontid_bold_italic < 0) || (fontid_italic < 0))
26 ::Error(
"fonts_ttf.cxx",
"fail to load ttf fonts from %s", fontdir.
Data());
28 auto c1 =
new TCanvas(
"c1",
"c1", 1000, 600);
30 if (!
gROOT->IsBatch() && !
c1->IsWeb())
31 ::Warning(
"fonts_ttf.cxx",
"macro will not work without enabling web-based canvas");
33 auto l1 =
new TLatex(0.5, 0.8,
"Custom font from trebuc.ttf");
34 l1->SetTextFont(fontid);
39 auto l2 =
new TLatex(0.5, 0.6,
"Custom bold font from trebucbd.ttf");
40 l2->SetTextFont(fontid_bold);
45 auto l3 =
new TLatex(0.5, 0.4,
"Custom bold italic font from trebucbi.ttf");
46 l3->SetTextFont(fontid_bold_italic);
51 auto l4 =
new TLatex(0.5, 0.2,
"Custom italic font from trebucit.ttf");
52 l4->SetTextFont(fontid_italic);
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
To draw Mathematical Formula.
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
const char * Data() const
static Font_t AddFont(const char *name, const char *ttffile, Int_t precision=2)
Add font to static list of fonts supported by the canvas Name specifies name of the font,...