24#include "ROOT/RText.hxx"
31 auto canvas = RCanvas::Create(
"RText fonts example");
35 auto drawText = [&canvas, &posy](
RAttrFont::EFont font,
bool is_comic =
false) {
36 auto text = canvas->Add<RText>(
RPadPos(0.35, posy),
"ABCDEFGH abcdefgh 0123456789 @#$");
37 text->text.size = 0.04;
38 text->text.align = RAttrText::kLeftCenter;
40 text->text.font.family =
"Comic";
42 text->text.font = font;
44 auto name = canvas->Add<RText>(
RPadPos(0.33, posy),
text->text.font.GetFullName());
45 name->text.size = 0.03;
46 name->text.align = RAttrText::kRightCenter;
51 drawText(RAttrFont::kTimes);
52 drawText(RAttrFont::kTimesItalic);
53 drawText(RAttrFont::kTimesBold);
54 drawText(RAttrFont::kTimesBoldItalic);
56 drawText(RAttrFont::kArial);
57 drawText(RAttrFont::kArialOblique);
58 drawText(RAttrFont::kArialBold);
59 drawText(RAttrFont::kArialBoldOblique);
61 drawText(RAttrFont::kCourier);
62 drawText(RAttrFont::kCourierOblique);
63 drawText(RAttrFont::kCourierBold);
64 drawText(RAttrFont::kCourierBoldOblique);
66 drawText(RAttrFont::kVerdana);
67 drawText(RAttrFont::kVerdanaItalic);
68 drawText(RAttrFont::kVerdanaBold);
69 drawText(RAttrFont::kVerdanaBoldItalic);
74 std::string fname = __FILE__;
75 auto pos = fname.find(
"rtext_font.cxx");
76 if (pos > 0) { fname.resize(pos); fname.append(
"comic.woff2"); }
77 else fname =
"comic.woff2";
78 canvas->Draw<RFont>(
"Comic", fname);
79 drawText(RAttrFont::kTimes,
true);
Option_t Option_t TPoint TPoint const char text
A position (horizontal and vertical) in a RPad.