Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:43

0001 /*************************************************************************
0002  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 #ifndef ROOT7_RFont
0010 #define ROOT7_RFont
0011 
0012 #include "ROOT/RDrawable.hxx"
0013 
0014 #include <string>
0015 
0016 namespace ROOT {
0017 namespace Experimental {
0018 
0019 
0020 /** \class RFont
0021 \ingroup GpadROOT7
0022 \brief Custom font configuration for the RCanvas
0023 \author Sergey Linev <s.linev@gsi.de>
0024 \date 2021-07-02
0025 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0026 */
0027 
0028 class RFont : public RDrawable  {
0029 
0030    std::string fFamily;   ///< font family, assigned as "font-family" attribute
0031    std::string fStyle;    ///< font style, assigned as "font-style" attribute, normal by default
0032    std::string fWeight;   ///< font weight, assigned as "font-weight" attribute, normal by default
0033    std::string fSrc;      ///< font source, assigned as "src" attribute
0034    bool fDefault{false};  ///< is font set as default for the pad
0035 
0036 public:
0037 
0038    RFont() : RDrawable("font") {}
0039 
0040    RFont(const std::string &family, const std::string &fname = "", const std::string &fmt = "woff2") : RFont()
0041    {
0042      SetFamily(family);
0043      SetFile(fname, fmt);
0044    }
0045 
0046    void SetFamily(const std::string &family) { fFamily = family; }
0047    const std::string &GetFamily() const { return fFamily; }
0048 
0049    void SetStyle(const std::string &style) { fStyle = style; }
0050    const std::string &GetStyle() const { return fStyle; }
0051 
0052    void SetWeight(const std::string &weight) { fWeight = weight; }
0053    const std::string &GetWeight() const { return fWeight; }
0054 
0055    void SetDefault(bool dflt = true) { fDefault = dflt; }
0056    bool GetDefault() const { return fDefault; }
0057 
0058    void SetUrl(const std::string &url, const std::string &fmt = "woff2");
0059    void SetFile(const std::string &fname, const std::string &fmt = "woff2");
0060    void SetSrc(const std::string &src);
0061 
0062    const std::string &GetSrc() const { return fSrc; }
0063 };
0064 
0065 } // namespace Experimental
0066 } // namespace ROOT
0067 
0068 #endif