16#include <nlohmann/json.hpp>
57 fRenderData = std::make_unique<REveRenderData>(
"makeZText");
89 static const char* tpfx =
"REveText::SetSdfFontDir";
91 if (
gEve ==
nullptr) {
92 ::Error(tpfx,
"REveManager needs to be initialized before font setup can begin.");
96 std::string sanitized_dir(dir);
97 if (sanitized_dir.back() !=
'/')
101 ::Error(tpfx,
"Directory does not exist and mkdir failed for '%s", dir.data());
122 static const char* tpfx =
"REveText::SetDefaultSdfFontDir";
124 static bool s_font_init_failed =
false;
126 if (s_font_init_failed) {
131 s_font_init_failed =
true;
133 ::Info(tpfx,
"Using install-wide SDF font dir $ROOTSYS/ui5/eve7/sdf-fonts");
135 ::Info(tpfx,
"Using SDF font dir sdf_fonts/ in current directory");
137 ::Error(tpfx,
"Error setting up default SDF font dir. "
138 "Please set it manually through REveText::SetSdfFontDir(<dir-name>)");
141 s_font_init_failed =
false;
155 static const char* tpfx =
"REveText::AssertSdfFont";
162 std::string png = base +
".png";
163 std::string js = base +
".js.gz";
167 ::Warning(tpfx,
"Source TTF font '%s' not found.", ttf_font.data());
172 int cl =
snprintf(command, 8192,
"TGLSdfFontMaker::MakeFont(\"%s\", \"%s\");",
173 ttf_font.data(), base.data());
175 ::Warning(tpfx,
"Error generating interpreter command for TGLSdfFontMaker::MakeFont(), ret=%d.", cl);
179 while (--cl >= 0)
if (command[cl] ==
'\\') command[cl] =
'/';
181 gROOT->ProcessLine(command);
183 ::Warning(tpfx,
"Creation of font '%s' failed.", font_name.data());
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
R__EXTERN TSystem * gSystem
std::unique_ptr< REveRenderData > fRenderData
Externally assigned and controlled user data.
virtual void BuildRenderData()
Write transformation Matrix to render data.
void AddLocation(const std::string &name, const std::string &path)
Register new directory to THttpServer.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
static bool AssertSdfFont(std::string_view font_name, std::string_view ttf_font)
Check if font exists, otherwise try to create it.
static std::string sSdfFontDir
REveText(const REveText &)=delete
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void ComputeBBox() override
Compute bounding-box of the data.
static bool SetDefaultSdfFontDir()
Set default SDF font directory based on write permissions in $ROOTSYS and in the current working dire...
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...
void BuildRenderData() override
Crates 3D point array for rendering.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
R__EXTERN REveManager * gEve