Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveText.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Author: Waad Alshehri, 2023
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_REveText
13#define ROOT7_REveText
14
15#include <ROOT/REveShape.hxx>
16#include <ROOT/REveVector.hxx>
17
18namespace ROOT {
19namespace Experimental {
20
21//------------------------------------------------------------------------------
22// REveText
23//------------------------------------------------------------------------------
24
25class REveText : public REveShape
26{
27private:
28 REveText(const REveText &) = delete;
29 REveText &operator=(const REveText &) = delete;
30
31protected:
32 std::string fText {"<no-text>"};
33 std::string fFont {"LiberationSans-Regular"};
37 Float_t fExtraBorder {0.2}; // border around text in font-size units
38 Int_t fMode {1}; // default mode is in relative screen coordinates [0,1]
40 // UChar_t fTextAlpha {255}; // Better than main transparency -- to be fixed.
41
42 static std::string sSdfFontDir;
43
44 static bool SetDefaultSdfFontDir();
45
46public:
47 REveText(const Text_t *n = "REveText", const Text_t *t = "");
48 virtual ~REveText() {}
49
50 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
51 void BuildRenderData() override;
52
53 void ComputeBBox() override;
54
55 std::string GetText() const { return fText; }
56 void SetText(std::string_view text) { fText = text; StampObjProps(); }
57
58 std::string GetFont() const { return fFont; }
59 void SetFont(std::string_view font) { fFont = font; StampObjProps();}
60
61 Float_t GetFontSize() const { return fFontSize; }
63
64 Int_t GetMode() const { return fMode; }
66
68 void SetFontHinting(Float_t fontHinting) { fFontHinting = fontHinting; StampObjProps();}
69
72
73 REveVector GetPosition() const { return fPosition; }
74 const REveVector& RefPosition() const { return fPosition; }
75 void SetPosition(const REveVector& position) { fPosition = position;}
76 void SetPosX(float x) { fPosition.fX = x; StampObjProps(); }
77 void SetPosY(float y) { fPosition.fY = y; StampObjProps(); }
78
79 Color_t GetTextColor() const { return fTextColor; }
80 void SetTextColor(Color_t color) { fTextColor = color; StampObjProps();}
81
82 // UChar_t GetTextAlpha() const { return fTextAlpha; }
83 // void SetTextAlpha(UChar_t c) { fTextAlpha = c; StampObjProps(); }
84
85 static bool SetSdfFontDir(std::string_view dir, bool require_write_access = true);
86 static bool AssertSdfFont(std::string_view font_name, std::string_view ttf_font);
87};
88
89} // namespace Experimental
90} // namespace ROOT
91
92#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Color_t
Definition RtypesCore.h:85
char Text_t
Definition RtypesCore.h:62
float Float_t
Definition RtypesCore.h:57
@ kMagenta
Definition Rtypes.h:66
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char text
void SetExtraBorder(float size)
Definition REveText.hxx:71
static bool AssertSdfFont(std::string_view font_name, std::string_view ttf_font)
Check if font exists, otherwise try to create it.
Definition REveText.cxx:153
static std::string sSdfFontDir
Definition REveText.hxx:42
void SetMode(Int_t mode)
Definition REveText.hxx:65
void SetFontHinting(Float_t fontHinting)
Definition REveText.hxx:68
Float_t GetFontHinting() const
Definition REveText.hxx:67
Color_t GetTextColor() const
Definition REveText.hxx:79
void SetPosition(const REveVector &position)
Definition REveText.hxx:75
REveText(const REveText &)=delete
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition REveText.cxx:34
const REveVector & RefPosition() const
Definition REveText.hxx:74
Float_t GetFontSize() const
Definition REveText.hxx:61
void ComputeBBox() override
Compute bounding-box of the data.
Definition REveText.cxx:66
void SetTextColor(Color_t color)
Definition REveText.hxx:80
std::string GetFont() const
Definition REveText.hxx:58
static bool SetDefaultSdfFontDir()
Set default SDF font directory based on write permissions in $ROOTSYS and in the current working dire...
Definition REveText.cxx:120
REveText & operator=(const REveText &)=delete
void SetFont(std::string_view font)
Definition REveText.hxx:59
REveVector GetPosition() const
Definition REveText.hxx:73
std::string GetText() const
Definition REveText.hxx:55
void SetFontSize(float size)
Definition REveText.hxx:62
static bool SetSdfFontDir(std::string_view dir, bool require_write_access=true)
Set location where SDF fonts and their metrics data are stored or are to be created via the AssertSdf...
Definition REveText.cxx:87
Float_t GetExtraBorder() const
Definition REveText.hxx:70
void SetText(std::string_view text)
Definition REveText.hxx:56
void BuildRenderData() override
Crates 3D point array for rendering.
Definition REveText.cxx:55
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...