File indexing completed on 2025-01-30 10:22:25
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT7_RAttrFont
0010 #define ROOT7_RAttrFont
0011
0012 #include <ROOT/RAttrAggregation.hxx>
0013 #include <ROOT/RAttrValue.hxx>
0014
0015 namespace ROOT {
0016 namespace Experimental {
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 class RAttrFont : public RAttrAggregation {
0027
0028 R__ATTR_CLASS(RAttrFont, "font");
0029
0030 public:
0031
0032 RAttrValue<std::string> family{this, "family"};
0033 RAttrValue<std::string> style{this, "style"};
0034 RAttrValue<std::string> weight{this, "weight"};
0035
0036 enum EFont {
0037 kTimesItalic = 1,
0038 kTimesBold = 2,
0039 kTimesBoldItalic = 3,
0040 kArial = 4,
0041 kArialOblique = 5,
0042 kArialBold = 6,
0043 kArialBoldOblique = 7,
0044 kCourier = 8,
0045 kCourierOblique = 9,
0046 kCourierBold = 10,
0047 kCourierBoldOblique = 11,
0048
0049 kTimes = 13,
0050
0051
0052 kVerdana = 16,
0053 kVerdanaItalic = 17,
0054 kVerdanaBold = 18,
0055 kVerdanaBoldItalic = 19
0056 };
0057
0058
0059 RAttrFont &SetFont(EFont font)
0060 {
0061 switch(font) {
0062 case kTimesItalic: family = "Times New Roman"; style = "italic"; break;
0063 case kTimesBold: family = "Times New Roman"; weight = "bold"; break;
0064 case kTimesBoldItalic: family = "Times New Roman"; style = "italic"; weight = "bold"; break;
0065 case kArial: family = "Arial"; break;
0066 case kArialOblique: family = "Arial"; style = "oblique"; break;
0067 case kArialBold: family = "Arial"; weight = "bold"; break;
0068 case kArialBoldOblique: family = "Arial"; style = "oblique"; weight = "bold"; break;
0069 case kCourier: family = "Courier New"; break;
0070 case kCourierOblique: family = "Courier New"; style = "oblique"; break;
0071 case kCourierBold: family = "Courier New"; weight = "bold"; break;
0072 case kCourierBoldOblique: family = "Courier New"; style = "oblique"; weight = "bold"; break;
0073
0074 case kTimes: family = "Times New Roman"; break;
0075
0076
0077 case kVerdana: family = "Verdana"; break;
0078 case kVerdanaItalic: family = "Verdana"; style = "italic"; break;
0079 case kVerdanaBold: family = "Verdana"; weight = "bold"; break;
0080 case kVerdanaBoldItalic: family = "Verdana"; weight = "bold"; style = "italic"; break;
0081 }
0082 return *this;
0083 }
0084
0085
0086 RAttrFont &operator=(EFont id) { SetFont(id); return *this; }
0087
0088 friend bool operator==(const RAttrFont &font, EFont id) { RAttrFont font2; font2.SetFont(id); return font == font2; }
0089
0090
0091 std::string GetFullName() const
0092 {
0093 std::string name = family, s = style, w = weight;
0094 if (!w.empty()) {
0095 name += " ";
0096 name += w;
0097 }
0098 if (!s.empty()) {
0099 name += " ";
0100 name += s;
0101 }
0102 return name;
0103 }
0104
0105 };
0106
0107 }
0108 }
0109
0110 #endif