33 #if defined(TOOLS_USE_FREETYPE)
34 #include <tools/sg/text_freetype>
35 #include <tools/xml/xml_style>
36 #include <tools/xml/wrap_viewplot_fonts_google_style>
43 void HD_style(tools::sg::plots& a_plots,
float a_line_width) {
44 std::vector<tools::sg::plotter*> plotters;
45 a_plots.plotters(plotters);
46 tools_vforcit(tools::sg::plotter*,plotters,
it) {
47 tools::sg::plotter* _plotter = *
it;
48 _plotter->bins_style(0).line_width = a_line_width;
49 _plotter->inner_frame_style().line_width = a_line_width;
50 _plotter->grid_style().line_width = a_line_width;
51 _plotter->x_axis().line_style().width = a_line_width;
52 _plotter->x_axis().ticks_style().width = a_line_width;
53 _plotter->y_axis().line_style().width = a_line_width;
54 _plotter->y_axis().ticks_style().width = a_line_width;
55 _plotter->z_axis().line_style().width = a_line_width;
56 _plotter->z_axis().ticks_style().width = a_line_width;
59 _plotter->title_style().line_width = a_line_width;
60 _plotter->infos_style().line_width = a_line_width;
61 _plotter->title_box_style().line_width = a_line_width;
63 _plotter->x_axis().labels_style().line_width = a_line_width;
64 _plotter->x_axis().mag_style().line_width = a_line_width;
65 _plotter->x_axis().title_style().line_width = a_line_width;
67 _plotter->y_axis().labels_style().line_width = a_line_width;
68 _plotter->y_axis().mag_style().line_width = a_line_width;
69 _plotter->y_axis().title_style().line_width = a_line_width;
71 _plotter->z_axis().labels_style().line_width = a_line_width;
72 _plotter->z_axis().mag_style().line_width = a_line_width;
73 _plotter->z_axis().title_style().line_width = a_line_width;
79 void regions_style(tools::sg::plots& a_plots,
float a_plotter_scale = 1) {
85 float ww_wc = a_plots.width;
86 float wh_wc = a_plots.height;
87 float rw_wc = ww_wc/a_plots.cols;
88 float rh_wc = wh_wc/a_plots.rows;
92 float wfac = (rw_wc/ww_wc)*cooking;
93 float hfac = (rh_wc/wh_wc)*cooking;
95 float label_cooking = 1.6f;
97 if((a_plots.cols.value()>=4)&&(a_plots.cols.value()>a_plots.rows.value())) label_cooking = 0.9f;
99 float title_cooking = 1.1f;
101 a_plots.plotter_scale = a_plotter_scale;
103 std::vector<tools::sg::plotter*> plotters;
104 a_plots.plotters(plotters);
105 tools_vforcit(tools::sg::plotter*,plotters,
it) {
106 tools::sg::plotter* _plotter = *
it;
108 _plotter->left_margin = _plotter->left_margin * wfac;
109 _plotter->right_margin = _plotter->right_margin * wfac;
110 _plotter->bottom_margin = _plotter->bottom_margin * hfac;
111 _plotter->top_margin = _plotter->top_margin * hfac;
113 _plotter->x_axis().tick_length = _plotter->x_axis().tick_length * wfac;
114 _plotter->y_axis().tick_length = _plotter->y_axis().tick_length * hfac;
116 _plotter->title_to_axis = _plotter->title_to_axis * hfac;
117 _plotter->title_height = _plotter->title_height * hfac * title_cooking;
119 _plotter->x_axis().label_height = _plotter->x_axis().label_height * hfac * label_cooking;
120 _plotter->y_axis().label_height = _plotter->y_axis().label_height * hfac * label_cooking;
127 bool load_embeded_styles(tools::xml::styles& a_styles) {
130 const char** lines = viewplot_fonts_google_style(linen);
131 for(
unsigned int index=0;index<linen;index++) {
132 std::string
s = lines[index];
133 tools::replace(s,
"@@double_quote@@",
"\"");
134 tools::replace(s,
"@@back_slash@@",
"\\");
137 return tools::xml::load_style_string(a_styles,ss);
158 #if defined(TOOLS_USE_FREETYPE)
164 G4cout <<
"... using high resolution with Freetype fonts" <<
G4endl;
170 static tools::sg::text_freetype ttf;
176 fViewer->plots().view_border =
false;
177 load_embeded_styles(
fViewer->styles());
178 fViewer->styles().add_colormap(
"default",tools::sg::style_default_colormap());
179 fViewer->styles().add_colormap(
"ROOT",tools::sg::style_ROOT_colormap());
184 G4cout <<
"... using low resolution with Hershey fonts" <<
G4endl;
191 fViewer->plots().view_border =
false;
211 #if defined(TOOLS_USE_FREETYPE)
219 description <<
" " <<
"Cannot write a page in the plot file " <<
fFileName;
254 description <<
" " <<
"Cannot open plot file " << fileName;
278 description <<
" " <<
"Cannot close the plot file.";