Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
RFont.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_RFont
10#define ROOT7_RFont
11
12#include "ROOT/RDrawable.hxx"
13
14#include <string>
15
16namespace ROOT {
17namespace Experimental {
18
19
20/** \class RFont
21\ingroup GpadROOT7
22\brief Custom font configuration for the RCanvas
23\author Sergey Linev <s.linev@gsi.de>
24\date 2021-07-02
25\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
26*/
27
28class RFont : public RDrawable {
29
30 std::string fFamily; ///< font family, assigned as "font-family" attribute
31 std::string fStyle; ///< font style, assigned as "font-style" attribute, normal by default
32 std::string fWeight; ///< font weight, assigned as "font-weight" attribute, normal by default
33 std::string fSrc; ///< font source, assigned as "src" attribute
34 bool fDefault{false}; ///< is font set as default for the pad
35
36public:
37
38 RFont() : RDrawable("font") {}
39
40 RFont(const std::string &family, const std::string &fname = "", const std::string &fmt = "woff2") : RFont()
41 {
42 SetFamily(family);
43 SetFile(fname, fmt);
44 }
45
46 void SetFamily(const std::string &family) { fFamily = family; }
47 const std::string &GetFamily() const { return fFamily; }
48
49 void SetStyle(const std::string &style) { fStyle = style; }
50 const std::string &GetStyle() const { return fStyle; }
51
52 void SetWeight(const std::string &weight) { fWeight = weight; }
53 const std::string &GetWeight() const { return fWeight; }
54
55 void SetDefault(bool dflt = true) { fDefault = dflt; }
56 bool GetDefault() const { return fDefault; }
57
58 void SetUrl(const std::string &url, const std::string &fmt = "woff2");
59 void SetFile(const std::string &fname, const std::string &fmt = "woff2");
60 void SetSrc(const std::string &src);
61
62 const std::string &GetSrc() const { return fSrc; }
63};
64
65} // namespace Experimental
66} // namespace ROOT
67
68#endif
RDrawable(const RDrawable &)=delete
RFont(const std::string &family, const std::string &fname="", const std::string &fmt="woff2")
Definition RFont.hxx:40
void SetDefault(bool dflt=true)
Definition RFont.hxx:55
void SetSrc(const std::string &src)
Set src attribute of font-face directly Only for expert use.
Definition RFont.cxx:73
void SetWeight(const std::string &weight)
Definition RFont.hxx:52
void SetFamily(const std::string &family)
Definition RFont.hxx:46
void SetFile(const std::string &fname, const std::string &fmt="woff2")
Set font source as file content.
Definition RFont.cxx:40
const std::string & GetSrc() const
Definition RFont.hxx:62
const std::string & GetFamily() const
Definition RFont.hxx:47
std::string fFamily
font family, assigned as "font-family" attribute
Definition RFont.hxx:30
const std::string & GetStyle() const
Definition RFont.hxx:50
bool GetDefault() const
Definition RFont.hxx:56
void SetUrl(const std::string &url, const std::string &fmt="woff2")
Set font source as URL.
Definition RFont.cxx:27
std::string fWeight
font weight, assigned as "font-weight" attribute, normal by default
Definition RFont.hxx:32
const std::string & GetWeight() const
Definition RFont.hxx:53
bool fDefault
is font set as default for the pad
Definition RFont.hxx:34
std::string fSrc
font source, assigned as "src" attribute
Definition RFont.hxx:33
void SetStyle(const std::string &style)
Definition RFont.hxx:49
std::string fStyle
font style, assigned as "font-style" attribute, normal by default
Definition RFont.hxx:31
Namespace for ROOT features in testing.
Definition TROOT.h:100
Small utility to parse cmdline options.
Definition RExports.h:71
TCanvas * style()
Definition style.C:1