This macro demonstrate usage of existing ROOT fonts for RText.
Also load of custom font is shown
#include "ROOT/RText.hxx"
void rtext_font()
{
double posy = 0.93;
auto drawText = [&canvas, &posy](
RAttrFont::EFont font,
bool is_comic =
false) {
auto text = canvas->Add<RText>(
RPadPos(0.35, posy),
"ABCDEFGH abcdefgh 0123456789 @#$");
if (is_comic)
text->text.font.family =
"Comic";
else
auto name = canvas->Add<RText>(
RPadPos(0.33, posy),
text->text.font.GetFullName());
posy -= 0.05;
};
posy -= 0.03;
std::string fname = __FILE__;
auto pos = fname.find(
"rtext_font.cxx");
fname.append("comic.woff2");
} else
fname = "comic.woff2";
canvas->Draw<RFont>("Comic", fname);
canvas->Show();
}
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
A position (horizontal and vertical) in a RPad.
Namespace for ROOT features in testing.
- Date
- 2021-07-07
- Warning
- This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
- Author
- Sergey Linev s.lin.nosp@m.ev@g.nosp@m.si.de
Definition in file rtext_font.cxx.