Usage of TTF fonts in web canvas.
One can load TTF font file and specify it for usage in the web canvas Produced drawing also can be saved in PDF files.
Functionality available only in web-based graphics
{
::Error(
"fonts_ttf.cxx",
"fail to load ttf fonts from %s",
fontdir.Data());
auto c1 =
new TCanvas(
"c1",
"c1", 1000, 600);
if (!
gROOT->IsBatch() && !
c1->IsWeb())
::Warning(
"fonts_ttf.cxx",
"macro will not work without enabling web-based canvas");
auto l1 =
new TLatex(0.5, 0.8,
"Custom font from trebuc.ttf");
auto l2 =
new TLatex(0.5, 0.6,
"Custom bold font from trebucbd.ttf");
auto l3 =
new TLatex(0.5, 0.4,
"Custom bold italic font from trebucbi.ttf");
auto l4 =
new TLatex(0.5, 0.2,
"Custom italic font from trebucit.ttf");
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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.
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,...
- Author
- Sergey Linev
Definition in file fonts_ttf.cxx.