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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 8.3.p1)


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