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() !=
'/')
99 if (
gSystem->AccessPathName(sanitized_dir.data())) {
100 if (
gSystem->mkdir(sanitized_dir.data(),
true)) {
101 ::Error(tpfx,
"Directory does not exist and mkdir failed for '%s", dir.data());
106 if (
gSystem->AccessPathName(sanitized_dir.data(), dir_perms) ==
false) {
122 static const char* tpfx =
"REveText::SetDefaultSdfFontDir";
124 static bool s_font_init_failed =
false;
126 if (s_font_init_failed) {
130 std::string dir(
gEnv->GetValue(
"WebGui.RootUi5Path",
gSystem->ExpandPathName(
"${ROOTSYS}/ui5")) );
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";
165 if (
gSystem->AccessPathName(png.data()) ||
gSystem->AccessPathName(js.data())) {
166 if (
gSystem->AccessPathName(ttf_font.data())) {
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);
182 if (
gSystem->AccessPathName(png.data()) ||
gSystem->AccessPathName(js.data())) {
183 ::Warning(tpfx,
"Creation of font '%s' failed.", font_name.data());
int Int_t
Signed integer 4 bytes (int).
char Text_t
General string (char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
std::unique_ptr< REveRenderData > fRenderData
! Vertex / normal / triangle index information for rendering.
virtual void BuildRenderData()
Write transformation Matrix to render data.
REveShape(const REveShape &)=delete
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.
Namespace for ROOT features in testing.