16#include <nlohmann/json.hpp>
103 fRenderData = std::make_unique<REveRenderData>(
"makeZText");
135 static const char* tpfx =
"REveText::SetSdfFontDir";
137 if (
gEve ==
nullptr) {
138 ::Error(tpfx,
"REveManager needs to be initialized before font setup can begin.");
142 std::string sanitized_dir(dir);
143 if (sanitized_dir.back() !=
'/')
144 sanitized_dir +=
'/';
147 ::Error(tpfx,
"Directory does not exist and mkdir failed for '%s", dir.data());
170 static const char* tpfx =
"REveText::SetDefaultSdfFontDir";
172 static bool s_font_init_failed =
false;
174 if (s_font_init_failed) {
180 if (
gEve ==
nullptr) {
181 static bool s_have_warned =
false;
182 if (!s_have_warned) {
183 ::Error(tpfx,
"REveManager needs to be initialized before font setup can begin.");
184 s_have_warned =
true;
190 dir +=
"/eve7/sdf-fonts/";
191 s_font_init_failed =
true;
193 ::Info(tpfx,
"Using SDF font dir %s", dir.c_str());
195 ::Info(tpfx,
"Using SDF font dir sdf_fonts/ in current directory");
197 ::Error(tpfx,
"Error setting up default SDF font dir. "
198 "Please set it manually through REveText::SetSdfFontDir(<dir-name>)");
201 s_font_init_failed =
false;
215 static const char* tpfx =
"REveText::AssertSdfFont";
222 std::string png = base +
".png";
223 std::string js = base +
".js.gz";
227 ::Warning(tpfx,
"Source TTF font '%s' not found.", ttf_font.data());
232 int cl = snprintf(command, 8192,
"TGLSdfFontMaker::MakeFont(\"%s\", \"%s\");",
233 ttf_font.data(), base.data());
235 ::Warning(tpfx,
"Error generating interpreter command for TGLSdfFontMaker::MakeFont(), ret=%d.", cl);
239 while (--cl >= 0)
if (command[cl] ==
'\\') command[cl] =
'/';
241 gROOT->ProcessLine(command);
243 ::Warning(tpfx,
"Creation of font '%s' failed.", font_name.data());
char Text_t
General string (char)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
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.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
R__EXTERN TSystem * gSystem
virtual void RemoveNiece(REveElement *el)
virtual void RemoveAunt(REveAunt *au)
Remove el from the list of aunts.
std::unique_ptr< REveRenderData > fRenderData
! Vertex / normal / triangle index information for rendering.
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 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.
std::string fFont
Default must be a face ROOT ships: only Liberation Mono and Serif are in $ROOTSYS/fonts,...
static bool SetDefaultSdfFontDir()
Set default SDF font directory based on write permissions in the ui5 directory, WebGui....
void SetClickAction(const std::string &mir, REveElement *target=nullptr)
Fill core part of JSON representation.
ElementId_t fClickTargetId
void RemoveAunt(REveAunt *au) override
Clear the click action when the click target is destroyed, so the button does not keep an id that may...
static bool AssertSdfFont(const std::string &font_name, const std::string &ttf_font)
Check if font exists, otherwise try to create it.
Color_t fTextColor
target held as an aunt, so its death is noticed
static bool SetSdfFontDir(const std::string &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.
Namespace for ROOT features in testing.
R__EXTERN REveManager * gEve