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 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/text_style (Version 11.3.0) and /externals/g4tools/include/tools/sg/text_style (Version 11.0.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_sg_text_style                         4 #ifndef tools_sg_text_style
  5 #define tools_sg_text_style                         5 #define tools_sg_text_style
  6                                                     6 
  7 #include "../lina/vec3f"                            7 #include "../lina/vec3f"
  8                                                     8 
  9 #include "sf_vec3f"                                 9 #include "sf_vec3f"
 10 #include "sf_string"                               10 #include "sf_string"
 11 #include "sf_enum"                                 11 #include "sf_enum"
 12 #include "node"                                    12 #include "node"
 13 #include "enums"                                   13 #include "enums"
 14 #include "style_parser"                            14 #include "style_parser"
 15                                                    15 
 16 namespace tools {                                  16 namespace tools {
 17 namespace sg {                                     17 namespace sg {
 18                                                    18 
 19 class text_style : public node {                   19 class text_style : public node {
 20   TOOLS_NODE(text_style,tools::sg::text_style,     20   TOOLS_NODE(text_style,tools::sg::text_style,node)
 21 public:                                            21 public:
 22   sf<bool> visible;                                22   sf<bool> visible;
 23   sf_vec<colorf,float> color;                      23   sf_vec<colorf,float> color;
 24   sf_vec<colorf,float> back_color;                 24   sf_vec<colorf,float> back_color;
 25   sf<float> back_shadow;                           25   sf<float> back_shadow;
 26                                                    26 
 27   sf_string modeling;                              27   sf_string modeling;
 28   sf_string font;                                  28   sf_string font;
 29   sf<float> font_size;                             29   sf<float> font_size;
 30   sf_enum<sg::font_modeling> font_modeling;        30   sf_enum<sg::font_modeling> font_modeling;
 31   sf_string encoding;                              31   sf_string encoding;
 32   sf<bool> smoothing;                              32   sf<bool> smoothing;
 33   sf<bool> hinting;                                33   sf<bool> hinting;
 34   sf_enum<sg::hjust> hjust;                        34   sf_enum<sg::hjust> hjust;
 35   sf_enum<sg::vjust> vjust;                        35   sf_enum<sg::vjust> vjust;
 36   sf<float> scale;                                 36   sf<float> scale;
 37   // For 3D text :                                 37   // For 3D text :
 38   sf_vec3f x_orientation;                          38   sf_vec3f x_orientation;
 39   sf_vec3f y_orientation;                          39   sf_vec3f y_orientation;
 40   // For bitmap text :                             40   // For bitmap text :
 41   sf<bool> rotated;                                41   sf<bool> rotated;
 42                                                    42 
 43   // for text_hershey :                            43   // for text_hershey :
 44   sf<float> line_width;                            44   sf<float> line_width;
 45   sf<lpat> line_pattern;                           45   sf<lpat> line_pattern;
 46   sf<bool> enforced;                               46   sf<bool> enforced;
 47   sf_vec3f translation;                            47   sf_vec3f translation;
 48                                                    48 
 49   // for text_freetype tessellation :              49   // for text_freetype tessellation :
 50   sf_enum<winding_type> front_face;                50   sf_enum<winding_type> front_face;
 51                                                    51 
 52   sf_string options; //for gopaw.                  52   sf_string options; //for gopaw.
 53 public:                                            53 public:
 54   virtual const desc_fields& node_desc_fields(     54   virtual const desc_fields& node_desc_fields() const {
 55     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::tex     55     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::text_style)
 56     static const desc_fields s_v(parent::node_     56     static const desc_fields s_v(parent::node_desc_fields(),21, //WARNING : take care of count.
 57       TOOLS_ARG_FIELD_DESC(visible),               57       TOOLS_ARG_FIELD_DESC(visible),
 58       TOOLS_ARG_FIELD_DESC(color),                 58       TOOLS_ARG_FIELD_DESC(color),
 59                                                    59 
 60       TOOLS_ARG_FIELD_DESC(modeling),              60       TOOLS_ARG_FIELD_DESC(modeling),
 61       TOOLS_ARG_FIELD_DESC(font),                  61       TOOLS_ARG_FIELD_DESC(font),
 62       TOOLS_ARG_FIELD_DESC(font_size),             62       TOOLS_ARG_FIELD_DESC(font_size),
 63       TOOLS_ARG_FIELD_DESC(font_modeling),         63       TOOLS_ARG_FIELD_DESC(font_modeling),
 64       TOOLS_ARG_FIELD_DESC(encoding),              64       TOOLS_ARG_FIELD_DESC(encoding),
 65       TOOLS_ARG_FIELD_DESC(smoothing),             65       TOOLS_ARG_FIELD_DESC(smoothing),
 66       TOOLS_ARG_FIELD_DESC(hinting),               66       TOOLS_ARG_FIELD_DESC(hinting),
 67       TOOLS_ARG_FIELD_DESC(hjust),                 67       TOOLS_ARG_FIELD_DESC(hjust),
 68       TOOLS_ARG_FIELD_DESC(vjust),                 68       TOOLS_ARG_FIELD_DESC(vjust),
 69       TOOLS_ARG_FIELD_DESC(scale),                 69       TOOLS_ARG_FIELD_DESC(scale),
 70       TOOLS_ARG_FIELD_DESC(x_orientation),         70       TOOLS_ARG_FIELD_DESC(x_orientation),
 71       TOOLS_ARG_FIELD_DESC(y_orientation),         71       TOOLS_ARG_FIELD_DESC(y_orientation),
 72       TOOLS_ARG_FIELD_DESC(rotated),               72       TOOLS_ARG_FIELD_DESC(rotated),
 73                                                    73 
 74       TOOLS_ARG_FIELD_DESC(line_width),            74       TOOLS_ARG_FIELD_DESC(line_width),
 75       TOOLS_ARG_FIELD_DESC(line_pattern),          75       TOOLS_ARG_FIELD_DESC(line_pattern),
 76       TOOLS_ARG_FIELD_DESC(enforced),              76       TOOLS_ARG_FIELD_DESC(enforced),
 77       TOOLS_ARG_FIELD_DESC(translation),           77       TOOLS_ARG_FIELD_DESC(translation),
 78                                                    78 
 79       TOOLS_ARG_FIELD_DESC(front_face),            79       TOOLS_ARG_FIELD_DESC(front_face),
 80       TOOLS_ARG_FIELD_DESC(options)                80       TOOLS_ARG_FIELD_DESC(options)
 81     );                                             81     );
 82     return s_v;                                    82     return s_v;
 83   }                                                83   }
 84 private:                                           84 private:
 85   void add_fields(){                               85   void add_fields(){
 86     add_field(&visible);                           86     add_field(&visible);
 87     add_field(&color);                             87     add_field(&color);
 88                                                    88 
 89     add_field(&modeling);                          89     add_field(&modeling);
 90     add_field(&font);                              90     add_field(&font);
 91     add_field(&font_size);                         91     add_field(&font_size);
 92     add_field(&font_modeling);                     92     add_field(&font_modeling);
 93     add_field(&encoding);                          93     add_field(&encoding);
 94     add_field(&smoothing);                         94     add_field(&smoothing);
 95     add_field(&hinting);                           95     add_field(&hinting);
 96     add_field(&hjust);                             96     add_field(&hjust);
 97     add_field(&vjust);                             97     add_field(&vjust);
 98     add_field(&scale);                             98     add_field(&scale);
 99     add_field(&x_orientation);                     99     add_field(&x_orientation);
100     add_field(&y_orientation);                    100     add_field(&y_orientation);
101     add_field(&rotated);                          101     add_field(&rotated);
102                                                   102 
103     add_field(&line_width);                       103     add_field(&line_width);
104     add_field(&line_pattern);                     104     add_field(&line_pattern);
105     add_field(&enforced);                         105     add_field(&enforced);
106     add_field(&translation);                      106     add_field(&translation);
107                                                   107 
108     add_field(&front_face);                       108     add_field(&front_face);
109     add_field(&options);                          109     add_field(&options);
110   }                                               110   }
111 public:                                           111 public:
112   text_style()                                    112   text_style()
113   :parent()                                       113   :parent()
114   ,visible(true)                                  114   ,visible(true)
115   ,color(colorf_black())                          115   ,color(colorf_black())
116   ,back_color(colorf_white())                     116   ,back_color(colorf_white())
117   ,back_shadow(0)                                 117   ,back_shadow(0)
118   ,modeling()                                     118   ,modeling()
119   ,font(font_hershey())                           119   ,font(font_hershey())
120   ,font_size(10)                                  120   ,font_size(10)
121   ,font_modeling(font_filled)                     121   ,font_modeling(font_filled)
122   ,encoding(encoding_none())                      122   ,encoding(encoding_none())
123   ,smoothing(false)                               123   ,smoothing(false)
124   ,hinting(false)                                 124   ,hinting(false)
125   ,hjust(left)                                    125   ,hjust(left)
126   ,vjust(bottom)                                  126   ,vjust(bottom)
127   ,scale(1)                                       127   ,scale(1)
128   ,x_orientation(vec3f(1,0,0))                    128   ,x_orientation(vec3f(1,0,0))
129   ,y_orientation(vec3f(0,1,0))                    129   ,y_orientation(vec3f(0,1,0))
130   ,rotated(false)                                 130   ,rotated(false)
131   ,line_width(1)                                  131   ,line_width(1)
132   ,line_pattern(line_solid)                       132   ,line_pattern(line_solid)
133   ,enforced(false)                                133   ,enforced(false)
134   ,translation(vec3f(0,0,0))                      134   ,translation(vec3f(0,0,0))
135   ,front_face(winding_ccw)                        135   ,front_face(winding_ccw)
136   ,options("")                                    136   ,options("")
137   {                                               137   {
138     add_fields();                                 138     add_fields();
139   }                                               139   }
140   virtual ~text_style(){}                         140   virtual ~text_style(){}
141 public:                                           141 public:
142   text_style(const text_style& a_from)            142   text_style(const text_style& a_from)
143   :parent(a_from),visible(a_from.visible)         143   :parent(a_from),visible(a_from.visible)
144   ,color(a_from.color)                            144   ,color(a_from.color)
145   ,back_color(a_from.back_color)                  145   ,back_color(a_from.back_color)
146   ,back_shadow(a_from.back_shadow)                146   ,back_shadow(a_from.back_shadow)
147   ,modeling(a_from.modeling)                      147   ,modeling(a_from.modeling)
148   ,font(a_from.font)                              148   ,font(a_from.font)
149   ,font_size(a_from.font_size)                    149   ,font_size(a_from.font_size)
150   ,font_modeling(a_from.font_modeling)            150   ,font_modeling(a_from.font_modeling)
151   ,encoding(a_from.encoding)                      151   ,encoding(a_from.encoding)
152   ,smoothing(a_from.smoothing)                    152   ,smoothing(a_from.smoothing)
153   ,hinting(a_from.hinting)                        153   ,hinting(a_from.hinting)
154   ,hjust(a_from.hjust)                            154   ,hjust(a_from.hjust)
155   ,vjust(a_from.vjust)                            155   ,vjust(a_from.vjust)
156   ,scale(a_from.scale)                            156   ,scale(a_from.scale)
157   ,x_orientation(a_from.x_orientation)            157   ,x_orientation(a_from.x_orientation)
158   ,y_orientation(a_from.y_orientation)            158   ,y_orientation(a_from.y_orientation)
159   ,rotated(a_from.rotated)                        159   ,rotated(a_from.rotated)
160   ,line_width(a_from.line_width)                  160   ,line_width(a_from.line_width)
161   ,line_pattern(a_from.line_pattern)              161   ,line_pattern(a_from.line_pattern)
162   ,enforced(a_from.enforced)                      162   ,enforced(a_from.enforced)
163   ,translation(a_from.translation)                163   ,translation(a_from.translation)
164   ,front_face(a_from.front_face)                  164   ,front_face(a_from.front_face)
165   ,options(a_from.options)                        165   ,options(a_from.options)
166   {                                               166   {
167     add_fields();                                 167     add_fields();
168   }                                               168   }
169   text_style& operator=(const text_style& a_fr    169   text_style& operator=(const text_style& a_from){
170     parent::operator=(a_from);                    170     parent::operator=(a_from);
171     visible = a_from.visible;                     171     visible = a_from.visible;
172     color = a_from.color;                         172     color = a_from.color;
173     back_color = a_from.back_color;               173     back_color = a_from.back_color;
174     back_shadow = a_from.back_shadow;             174     back_shadow = a_from.back_shadow;
175     modeling = a_from.modeling;                   175     modeling = a_from.modeling;
176     font = a_from.font;                           176     font = a_from.font;
177     font_size = a_from.font_size;                 177     font_size = a_from.font_size;
178     font_modeling = a_from.font_modeling;         178     font_modeling = a_from.font_modeling;
179     encoding = a_from.encoding;                   179     encoding = a_from.encoding;
180     smoothing = a_from.smoothing;                 180     smoothing = a_from.smoothing;
181     hinting = a_from.hinting;                     181     hinting = a_from.hinting;
182     hjust = a_from.hjust;                         182     hjust = a_from.hjust;
183     vjust = a_from.vjust;                         183     vjust = a_from.vjust;
184     scale = a_from.scale;                         184     scale = a_from.scale;
185     x_orientation = a_from.x_orientation;         185     x_orientation = a_from.x_orientation;
186     y_orientation = a_from.y_orientation;         186     y_orientation = a_from.y_orientation;
187     rotated = a_from.rotated;                     187     rotated = a_from.rotated;
188     line_width = a_from.line_width;               188     line_width = a_from.line_width;
189     line_pattern = a_from.line_pattern;           189     line_pattern = a_from.line_pattern;
190     enforced = a_from.enforced;                   190     enforced = a_from.enforced;
191     translation = a_from.translation;             191     translation = a_from.translation;
192     front_face = a_from.front_face;               192     front_face = a_from.front_face;
193     options = a_from.options;                     193     options = a_from.options;
194     return *this;                                 194     return *this;
195   }                                               195   }
196 public:                                           196 public:
197   bool from_string(std::ostream& a_out,const c    197   bool from_string(std::ostream& a_out,const cmaps_t& a_cmaps,const std::string& a_s){
198     style_parser sp;                              198     style_parser sp;
199                                                   199 
200     sp.visible(visible.value());                  200     sp.visible(visible.value());
201     sp.color(color.value());                      201     sp.color(color.value());
202   //sp.transparency(transparency.value());        202   //sp.transparency(transparency.value());
203     sp.back_color(back_color.value());            203     sp.back_color(back_color.value());
204   //sp.back_transparency(back_transparency.val    204   //sp.back_transparency(back_transparency.value());
205     sp.back_shadow(back_shadow.value());          205     sp.back_shadow(back_shadow.value());
206     sp.modeling(modeling.value());                206     sp.modeling(modeling.value());
207     sp.font(font.value());                        207     sp.font(font.value());
208     sp.font_size(font_size.value());              208     sp.font_size(font_size.value());
209     sp.font_modeling(font_modeling.value());      209     sp.font_modeling(font_modeling.value());
210     sp.encoding(encoding.value());                210     sp.encoding(encoding.value());
211     sp.smoothing(smoothing.value());              211     sp.smoothing(smoothing.value());
212     sp.hinting(hinting.value());                  212     sp.hinting(hinting.value());
213     sp.scale(scale.value());                      213     sp.scale(scale.value());
214     //sp.angle(angle.value());                    214     //sp.angle(angle.value());
215     //sp.x_orientation(x_orientation.value());    215     //sp.x_orientation(x_orientation.value());
216     //sp.y_orientation(y_orientation.value());    216     //sp.y_orientation(y_orientation.value());
217     //sp.rotated(rotated.value());                217     //sp.rotated(rotated.value());
218     sp.line_width(line_width.value());            218     sp.line_width(line_width.value());
219     sp.line_pattern(line_pattern.value());        219     sp.line_pattern(line_pattern.value());
220     sp.enforced(enforced.value());                220     sp.enforced(enforced.value());
221     sp.translation(translation.value());          221     sp.translation(translation.value());
222     sp.front_face(front_face.value());            222     sp.front_face(front_face.value());
223     sp.options(options.value());                  223     sp.options(options.value());
224                                                   224 
225     if(!sp.parse(a_out,a_cmaps,a_s)) {            225     if(!sp.parse(a_out,a_cmaps,a_s)) {
226       a_out << "tools::sg::text_style::from_st    226       a_out << "tools::sg::text_style::from_string :"
227             << " parse failed."                   227             << " parse failed."
228             << std::endl;                         228             << std::endl;
229       return false;                               229       return false;
230     }                                             230     }
231                                                   231 
232     visible.value(sp.visible());                  232     visible.value(sp.visible());
233     color.value(sp.color());                      233     color.value(sp.color());
234   //transparency.value(sp.transparency());        234   //transparency.value(sp.transparency());
235     back_color.value(sp.back_color());            235     back_color.value(sp.back_color());
236   //back_transparency.value(sp.back_transparen    236   //back_transparency.value(sp.back_transparency());
237     back_shadow.value(sp.back_shadow());          237     back_shadow.value(sp.back_shadow());
238     modeling.value(sp.modeling());                238     modeling.value(sp.modeling());
239     font.value(sp.font());                        239     font.value(sp.font());
240     font_size.value(sp.font_size());              240     font_size.value(sp.font_size());
241     font_modeling.value(sp.font_modeling());      241     font_modeling.value(sp.font_modeling());
242     encoding.value(sp.encoding());                242     encoding.value(sp.encoding());
243     smoothing.value(sp.smoothing());              243     smoothing.value(sp.smoothing());
244     hinting.value(sp.hinting());                  244     hinting.value(sp.hinting());
245     scale.value(sp.scale());                      245     scale.value(sp.scale());
246     //angle.value(sp.angle());                    246     //angle.value(sp.angle());
247     //x_orientation.value(sp.x_orientation());    247     //x_orientation.value(sp.x_orientation());
248     //y_orientation.value(sp.y_orientation());    248     //y_orientation.value(sp.y_orientation());
249     //rotated.value(sp.rotated());                249     //rotated.value(sp.rotated());
250     line_width.value(sp.line_width());            250     line_width.value(sp.line_width());
251     line_pattern.value(sp.line_pattern());        251     line_pattern.value(sp.line_pattern());
252     enforced.value(sp.enforced());                252     enforced.value(sp.enforced());
253     translation.value(sp.translation());          253     translation.value(sp.translation());
254     front_face = sp.front_face();                 254     front_face = sp.front_face();
255     options = sp.options();                       255     options = sp.options();
256                                                   256 
257     return true;                                  257     return true;
258   }                                               258   }
259 };                                                259 };
260                                                   260 
261 }}                                                261 }}
262                                                   262 
263 #endif                                            263 #endif