Conversion to Apache 2.0 license
[platform/core/uifw/dali-core.git] / dali / public-api / text / text-style.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19
20 #include <dali/public-api/text/text-style.h>
21
22 // INTERNAL INCLUDES
23
24 #include <dali/public-api/common/constants.h>
25 #include <dali/public-api/text/font.h>
26
27 namespace Dali
28 {
29
30 const Degree  TextStyle::DEFAULT_ITALICS_ANGLE( 20.0f );
31 const float   TextStyle::DEFAULT_UNDERLINE_THICKNESS( 0.f );
32 const float   TextStyle::DEFAULT_UNDERLINE_POSITION( 0.f );
33 const Vector4 TextStyle::DEFAULT_TEXT_COLOR( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // cannot use Color::WHITE because it may or may not be initialized yet
34 const Vector4 TextStyle::DEFAULT_SHADOW_COLOR( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) ); // cannot use Color::BLACK because it may or may not be initialized yet
35 const Vector2 TextStyle::DEFAULT_SHADOW_OFFSET( 1.0f, 1.0f );
36 const float   TextStyle::DEFAULT_SHADOW_SIZE( 0.0f );
37 const Vector4 TextStyle::DEFAULT_GLOW_COLOR( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); // cannot use Color::YELLOW because it may or may not be initialized yet
38 const float   TextStyle::DEFAULT_GLOW_INTENSITY( 0.05f );
39 const float   TextStyle::DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD( 0.46f );
40 const Vector4 TextStyle::DEFAULT_OUTLINE_COLOR( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) ); // cannot use Color::BLACK because it may or may not be initialized yet
41 const Vector2 TextStyle::DEFAULT_OUTLINE_THICKNESS( 0.51f, 0.00f );
42 const Vector4 TextStyle::DEFAULT_GRADIENT_COLOR( 1.0f, 1.0f, 1.0f, 1.0f );            // cannot use Color::WHI|TE because it may or may not be initialized yet
43 const Vector2 TextStyle::DEFAULT_GRADIENT_START_POINT( 0.0f, 0.0f );
44 const Vector2 TextStyle::DEFAULT_GRADIENT_END_POINT( 0.0f, 0.0f );
45
46 const std::string DEFAULT_NAME;
47
48 struct TextStyle::Impl
49 {
50   Impl()
51   : mFontName(),
52     mFontStyle(),
53     mFontPointSize( 0.f ),
54     mWeight( REGULAR ),
55     mTextColor( DEFAULT_TEXT_COLOR ),
56     mItalics( false ),
57     mUnderline( false ),
58     mShadow( false ),
59     mGlow( false ),
60     mOutline( false ),
61     mItalicsAngle( DEFAULT_ITALICS_ANGLE ),
62     mUnderlineThickness( DEFAULT_UNDERLINE_THICKNESS ),
63     mUnderlinePosition( DEFAULT_UNDERLINE_POSITION ),
64     mShadowColor( DEFAULT_SHADOW_COLOR ),
65     mShadowOffset( DEFAULT_SHADOW_OFFSET ),
66     mShadowSize( DEFAULT_SHADOW_SIZE ),
67     mGlowColor( DEFAULT_GLOW_COLOR ),
68     mGlowIntensity( DEFAULT_GLOW_INTENSITY ),
69     mSmoothEdge( DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD ),
70     mOutlineColor( DEFAULT_OUTLINE_COLOR ),
71     mOutlineThickness( DEFAULT_OUTLINE_THICKNESS )
72   {
73   }
74
75   Impl( const std::string& fontName,
76         const std::string& fontStyle,
77         PointSize fontPointSize,
78         Weight weight,
79         const Vector4& textColor,
80         bool italics,
81         bool underline,
82         bool shadow,
83         bool glow,
84         bool outline,
85         Degree italicsAngle,
86         float underlineThickness,
87         float underlinePosition,
88         const Vector4& shadowColor,
89         const Vector2& shadowOffset,
90         const float shadowSize,
91         const Vector4& glowColor,
92         float glowIntensity,
93         float smoothEdge,
94         const Vector4& outlineColor,
95         const Vector2& outlineThickness )
96   : mFontName( fontName ),
97     mFontStyle( fontStyle ),
98     mFontPointSize( fontPointSize ),
99     mWeight( weight ),
100     mTextColor( textColor ),
101     mItalics( italics ),
102     mUnderline( underline ),
103     mShadow( shadow ),
104     mGlow( glow ),
105     mOutline( outline ),
106     mItalicsAngle( italicsAngle ),
107     mUnderlineThickness( underlineThickness ),
108     mUnderlinePosition( underlinePosition ),
109     mShadowColor( shadowColor ),
110     mShadowOffset( shadowOffset ),
111     mShadowSize( shadowSize ),
112     mGlowColor( glowColor ),
113     mGlowIntensity( glowIntensity ),
114     mSmoothEdge( smoothEdge ),
115     mOutlineColor( outlineColor ),
116     mOutlineThickness( outlineThickness )
117   {
118   }
119
120   std::string mFontName;             ///< Font family name.
121   std::string mFontStyle;            ///< Font style.
122   PointSize   mFontPointSize;        ///< Size of the font in points.
123   Weight      mWeight;               ///< Style weight.
124   Vector4     mTextColor;            ///< Color of the text.
125   bool        mItalics:1;            ///< Whether the text is in italics or not.
126   bool        mUnderline:1;          ///< Whether the text is underlined or not.
127   bool        mShadow:1;             ///< Whether the text has a shadow or not.
128   bool        mGlow:1;               ///< Whether the text has a glow or not.
129   bool        mOutline:1;            ///< Whether the text has an outline or not.
130   Degree      mItalicsAngle;         ///< The italics angle.
131   float       mUnderlineThickness;   ///< The underline's thickness.
132   float       mUnderlinePosition;    ///< The underline's position.
133   Vector4     mShadowColor;          ///< The color of the shadow.
134   Vector2     mShadowOffset;         ///< The shadow offset in pixels.
135   float       mShadowSize;           ///< The shadow size in pixels
136   Vector4     mGlowColor;            ///< The color of the glow.
137   float       mGlowIntensity;        ///< Determines the amount of glow around text.
138   float       mSmoothEdge;           ///< Specify the distance field value for the center of the text edge.
139   Vector4     mOutlineColor;         ///< The color of the outline.
140   Vector2     mOutlineThickness;     ///< The outline's thickness.
141 };
142
143
144 TextStyle::TextStyle()
145 : mImpl( NULL )
146 {
147 }
148
149 TextStyle::TextStyle( const TextStyle& textStyle )
150 : mImpl( NULL )
151 {
152
153   if ( textStyle.mImpl )
154   {
155     mImpl = new TextStyle::Impl( textStyle.mImpl->mFontName,
156                                  textStyle.mImpl->mFontStyle,
157                                  textStyle.mImpl->mFontPointSize,
158                                  textStyle.mImpl->mWeight,
159                                  textStyle.mImpl->mTextColor,
160                                  textStyle.mImpl->mItalics,
161                                  textStyle.mImpl->mUnderline,
162                                  textStyle.mImpl->mShadow,
163                                  textStyle.mImpl->mGlow,
164                                  textStyle.mImpl->mOutline,
165                                  textStyle.mImpl->mItalicsAngle,
166                                  textStyle.mImpl->mUnderlineThickness,
167                                  textStyle.mImpl->mUnderlinePosition,
168                                  textStyle.mImpl->mShadowColor,
169                                  textStyle.mImpl->mShadowOffset,
170                                  textStyle.mImpl->mShadowSize,
171                                  textStyle.mImpl->mGlowColor,
172                                  textStyle.mImpl->mGlowIntensity,
173                                  textStyle.mImpl->mSmoothEdge,
174                                  textStyle.mImpl->mOutlineColor,
175                                  textStyle.mImpl->mOutlineThickness );
176   }
177 }
178 TextStyle::~TextStyle()
179 {
180   delete mImpl;
181 }
182
183 TextStyle& TextStyle::operator=( const TextStyle& textStyle )
184 {
185   if( &textStyle != this )
186   {
187     // Is the source object current set to defaults?
188     if ( textStyle.mImpl == NULL )
189     {
190       // Yes, so delete our current implementation and set to defaults (ie/ no implementation)
191       delete mImpl;
192       mImpl = NULL;
193       return *this;
194     }
195
196     CreateImplementationJustInTime();
197     mImpl->mFontName = textStyle.mImpl->mFontName;
198     mImpl->mFontStyle = textStyle.mImpl->mFontStyle;
199     mImpl->mFontPointSize = textStyle.mImpl->mFontPointSize;
200     mImpl->mWeight = textStyle.mImpl->mWeight;
201     mImpl->mTextColor = textStyle.mImpl->mTextColor;
202     mImpl->mItalics = textStyle.mImpl->mItalics;
203     mImpl->mUnderline = textStyle.mImpl->mUnderline;
204     mImpl->mShadow = textStyle.mImpl->mShadow;
205     mImpl->mGlow = textStyle.mImpl->mGlow;
206     mImpl->mOutline = textStyle.mImpl->mOutline;
207     mImpl->mItalicsAngle = textStyle.mImpl->mItalicsAngle;
208     mImpl->mUnderlineThickness = textStyle.mImpl->mUnderlineThickness;
209     mImpl->mUnderlinePosition = textStyle.mImpl->mUnderlinePosition;
210     mImpl->mShadowColor = textStyle.mImpl->mShadowColor;
211     mImpl->mShadowOffset = textStyle.mImpl->mShadowOffset;
212     mImpl->mShadowSize = textStyle.mImpl->mShadowSize;
213     mImpl->mGlowColor = textStyle.mImpl->mGlowColor;
214     mImpl->mGlowIntensity = textStyle.mImpl->mGlowIntensity;
215     mImpl->mSmoothEdge = textStyle.mImpl->mSmoothEdge;
216     mImpl->mOutlineColor = textStyle.mImpl->mOutlineColor;
217     mImpl->mOutlineThickness = textStyle.mImpl->mOutlineThickness;
218   }
219
220   return *this;
221 }
222
223 bool TextStyle::operator==( const TextStyle& textStyle ) const
224 {
225   // If both Implementations are uninitialized then return equal
226   if ( mImpl == NULL && textStyle.mImpl == NULL )
227   {
228     return true;
229   }
230   // Otherwise if either one of the Implemetations are uninitialized then return not equal
231   else if ( mImpl == NULL || textStyle.mImpl == NULL )
232   {
233     return false;
234   }
235   return ( ( mImpl->mFontName == textStyle.mImpl->mFontName ) &&
236            ( mImpl->mFontStyle == textStyle.mImpl->mFontStyle ) &&
237            ( fabsf( mImpl->mFontPointSize - textStyle.mImpl->mFontPointSize ) < GetRangedEpsilon( mImpl->mFontPointSize, textStyle.mImpl->mFontPointSize ) ) &&
238            ( mImpl->mWeight == textStyle.mImpl->mWeight ) &&
239            ( mImpl->mTextColor == textStyle.mImpl->mTextColor ) &&
240            ( mImpl->mItalics == textStyle.mImpl->mItalics ) &&
241            ( mImpl->mUnderline == textStyle.mImpl->mUnderline ) &&
242            ( mImpl->mShadow == textStyle.mImpl->mShadow ) &&
243            ( mImpl->mGlow == textStyle.mImpl->mGlow ) &&
244            ( mImpl->mOutline == textStyle.mImpl->mOutline ) &&
245            ( mImpl->mItalicsAngle == textStyle.mImpl->mItalicsAngle ) &&
246            ( fabsf( mImpl->mUnderlineThickness - textStyle.mImpl->mUnderlineThickness ) < GetRangedEpsilon( mImpl->mUnderlineThickness, textStyle.mImpl->mUnderlineThickness ) ) &&
247            ( fabsf( mImpl->mUnderlinePosition - textStyle.mImpl->mUnderlinePosition ) < GetRangedEpsilon( mImpl->mUnderlinePosition, textStyle.mImpl->mUnderlinePosition ) ) &&
248            ( mImpl->mShadowColor == textStyle.mImpl->mShadowColor ) &&
249            ( mImpl->mShadowOffset == textStyle.mImpl->mShadowOffset ) &&
250            ( fabsf( mImpl->mShadowSize - textStyle.mImpl->mShadowSize ) < GetRangedEpsilon( mImpl->mShadowSize, textStyle.mImpl->mShadowSize ) ) &&
251            ( mImpl->mGlowColor == textStyle.mImpl->mGlowColor ) &&
252            ( fabsf( mImpl->mGlowIntensity - textStyle.mImpl->mGlowIntensity ) < GetRangedEpsilon( mImpl->mGlowIntensity, textStyle.mImpl->mGlowIntensity ) ) &&
253            ( fabsf( mImpl->mSmoothEdge - textStyle.mImpl->mSmoothEdge ) < GetRangedEpsilon( mImpl->mSmoothEdge, textStyle.mImpl->mSmoothEdge ) ) &&
254            ( mImpl->mOutlineColor == textStyle.mImpl->mOutlineColor ) &&
255            ( mImpl->mOutlineThickness == textStyle.mImpl->mOutlineThickness ) );
256 }
257
258 bool TextStyle::operator!=( const TextStyle& textStyle ) const
259 {
260   return !( *this == textStyle );
261 }
262
263 void TextStyle::Copy( const TextStyle& textStyle, const Mask mask )
264 {
265   // If we're attemping to copy ourselves then just return
266   if ( this == &textStyle )
267   {
268     return;
269   }
270
271   // Check to see if we're copying a default style ?
272   if ( textStyle.mImpl == NULL )
273   {
274     // Yes, so if we're coping entirely then re-create a default style, else the mask resets attributes to defaults
275     if ( mImpl && mask == ALL )
276     {
277       delete mImpl;
278       mImpl = NULL;
279     }
280     else
281     {
282       if ( mImpl )
283       {
284         if( mask & FONT )
285         {
286           mImpl->mFontName = DEFAULT_NAME;
287         }
288         if( mask & STYLE )
289         {
290           mImpl->mFontStyle = DEFAULT_NAME;
291         }
292         if( mask & SIZE )
293         {
294           mImpl->mFontPointSize = static_cast<PointSize>( 0.f );
295         }
296         if( mask & WEIGHT )
297         {
298           mImpl->mWeight = REGULAR;
299           mImpl->mSmoothEdge = DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD;
300         }
301         if( mask & COLOR )
302         {
303           mImpl->mTextColor = DEFAULT_TEXT_COLOR;
304         }
305         if( mask & ITALICS )
306         {
307           mImpl->mItalics = false;
308           mImpl->mItalicsAngle = DEFAULT_ITALICS_ANGLE;
309         }
310         if( mask & UNDERLINE )
311         {
312           mImpl->mUnderline = false;
313           mImpl->mUnderlineThickness = DEFAULT_UNDERLINE_THICKNESS;
314           mImpl->mUnderlinePosition = DEFAULT_UNDERLINE_POSITION;
315         }
316         if ( mask & SHADOW )
317         {
318           mImpl->mShadow = false;
319           mImpl->mShadowColor = DEFAULT_SHADOW_COLOR;
320           mImpl->mShadowOffset = DEFAULT_SHADOW_OFFSET;
321           mImpl->mShadowSize = DEFAULT_SHADOW_SIZE;
322         }
323         if ( mask & GLOW )
324         {
325           mImpl->mGlow = false;
326           mImpl->mGlowColor = DEFAULT_GLOW_COLOR;
327           mImpl->mGlowIntensity = DEFAULT_GLOW_INTENSITY;
328         }
329         if ( mask & OUTLINE )
330         {
331           mImpl->mOutline = false;
332           mImpl->mOutlineColor = DEFAULT_OUTLINE_COLOR;
333           mImpl->mOutlineThickness = DEFAULT_OUTLINE_THICKNESS;
334         }
335       }
336     }
337     return;
338   }
339
340   // Source has an implementation and so the target also needs one
341   CreateImplementationJustInTime();
342   if( mask == ALL )
343   {
344     *this = textStyle;
345   }
346   else
347   {
348     if( mask & FONT )
349     {
350       mImpl->mFontName = textStyle.mImpl->mFontName;
351     }
352     if( mask & STYLE )
353     {
354       mImpl->mFontStyle = textStyle.mImpl->mFontStyle;
355     }
356     if( mask & SIZE )
357     {
358       mImpl->mFontPointSize = textStyle.mImpl->mFontPointSize;
359     }
360     if( mask & WEIGHT )
361     {
362       mImpl->mWeight = textStyle.mImpl->mWeight;
363       mImpl->mSmoothEdge = textStyle.mImpl->mSmoothEdge;
364     }
365     if( mask & COLOR )
366     {
367       mImpl->mTextColor = textStyle.mImpl->mTextColor;
368     }
369     if( mask & ITALICS )
370     {
371       mImpl->mItalics = textStyle.mImpl->mItalics;
372       mImpl->mItalicsAngle = textStyle.mImpl->mItalicsAngle;
373     }
374     if( mask & UNDERLINE )
375     {
376       mImpl->mUnderline = textStyle.mImpl->mUnderline;
377       mImpl->mUnderlineThickness = textStyle.mImpl->mUnderlineThickness;
378       mImpl->mUnderlinePosition = textStyle.mImpl->mUnderlinePosition;
379     }
380     if ( mask & SHADOW )
381     {
382       mImpl->mShadow = textStyle.mImpl->mShadow;
383       mImpl->mShadowColor = textStyle.mImpl->mShadowColor;
384       mImpl->mShadowOffset = textStyle.mImpl->mShadowOffset;
385       mImpl->mShadowSize = textStyle.mImpl->mShadowSize;
386     }
387     if ( mask & GLOW )
388     {
389       mImpl->mGlow = textStyle.mImpl->mGlow;
390       mImpl->mGlowColor = textStyle.mImpl->mGlowColor;
391       mImpl->mGlowIntensity = textStyle.mImpl->mGlowIntensity;
392     }
393     if ( mask & OUTLINE )
394     {
395       mImpl->mOutline = textStyle.mImpl->mOutline;
396       mImpl->mOutlineColor = textStyle.mImpl->mOutlineColor;
397       mImpl->mOutlineThickness = textStyle.mImpl->mOutlineThickness;
398     }
399   }
400 }
401
402 const std::string& TextStyle::GetFontName() const
403 {
404   if ( !mImpl )
405   {
406     return DEFAULT_NAME;
407   }
408   else
409   {
410     return mImpl->mFontName;
411   }
412 }
413
414 void TextStyle::SetFontName( const std::string& fontName )
415 {
416   CreateImplementationJustInTime();
417   mImpl->mFontName = fontName;
418 }
419
420 const std::string& TextStyle::GetFontStyle() const
421 {
422   if ( !mImpl )
423   {
424     return DEFAULT_NAME;
425   }
426   else
427   {
428     return mImpl->mFontStyle;
429   }
430 }
431
432 void TextStyle::SetFontStyle( const std::string& fontStyle )
433 {
434   CreateImplementationJustInTime();
435   mImpl->mFontStyle = fontStyle;
436 }
437
438 PointSize TextStyle::GetFontPointSize() const
439 {
440   if ( !mImpl )
441   {
442     return static_cast<PointSize>( 0.f );
443   }
444   else
445   {
446     return mImpl->mFontPointSize;
447   }
448 }
449
450 void TextStyle::SetFontPointSize( PointSize fontPointSize )
451 {
452   CreateImplementationJustInTime();
453   mImpl->mFontPointSize = fontPointSize;
454 }
455
456 TextStyle::Weight TextStyle::GetWeight() const
457 {
458   if ( !mImpl )
459   {
460     return REGULAR;
461   }
462   else
463   {
464     return mImpl->mWeight ;
465   }
466 }
467
468 void TextStyle::SetWeight( TextStyle::Weight weight )
469 {
470   CreateImplementationJustInTime();
471   mImpl->mWeight = weight;
472 }
473
474 const Vector4& TextStyle::GetTextColor() const
475 {
476   if ( !mImpl )
477   {
478     return DEFAULT_TEXT_COLOR;
479   }
480   else
481   {
482     return mImpl->mTextColor;
483   }
484 }
485
486 void TextStyle::SetTextColor( const Vector4& textColor )
487 {
488   CreateImplementationJustInTime();
489   mImpl->mTextColor = textColor;
490 }
491
492 bool TextStyle::GetItalics() const
493 {
494   if ( !mImpl )
495   {
496     return false;
497   }
498   return mImpl->mItalics;
499 }
500
501 void TextStyle::SetItalics( bool italics )
502 {
503   CreateImplementationJustInTime();
504   mImpl->mItalics = italics;
505 }
506
507 Degree TextStyle::GetItalicsAngle() const
508 {
509   if ( !mImpl )
510   {
511     return DEFAULT_ITALICS_ANGLE;
512   }
513   else
514   {
515     return mImpl->mItalicsAngle;
516   }
517 }
518
519 void TextStyle::SetItalicsAngle( Degree angle )
520 {
521   CreateImplementationJustInTime();
522   mImpl->mItalicsAngle = angle;
523 }
524
525 bool TextStyle::GetUnderline() const
526 {
527   if ( !mImpl )
528   {
529     return false;
530   }
531   else
532   {
533     return mImpl->mUnderline;
534   }
535 }
536
537 void TextStyle::SetUnderline( bool underline )
538 {
539   CreateImplementationJustInTime();
540   mImpl->mUnderline = underline;
541 }
542
543 float TextStyle::GetUnderlineThickness() const
544 {
545   if ( !mImpl )
546   {
547     return DEFAULT_UNDERLINE_THICKNESS;
548   }
549   else
550   {
551     return mImpl->mUnderlineThickness;
552   }
553 }
554
555 void TextStyle::SetUnderlineThickness( float thickness )
556 {
557   CreateImplementationJustInTime();
558   mImpl->mUnderlineThickness = thickness;
559 }
560
561 float TextStyle::GetUnderlinePosition() const
562 {
563   if ( !mImpl )
564   {
565     return DEFAULT_UNDERLINE_POSITION;
566   }
567   else
568   {
569     return mImpl->mUnderlinePosition;
570   }
571 }
572
573 void TextStyle::SetUnderlinePosition( float position )
574 {
575   CreateImplementationJustInTime();
576   mImpl->mUnderlinePosition = position;
577 }
578
579 bool TextStyle::GetShadow() const
580 {
581   if ( !mImpl )
582   {
583     return false;
584   }
585   else
586   {
587     return mImpl->mShadow;
588   }
589 }
590
591 const Vector4& TextStyle::GetShadowColor() const
592 {
593   if ( !mImpl )
594   {
595     return DEFAULT_SHADOW_COLOR;
596   }
597   return mImpl->mShadowColor;
598 }
599
600 const Vector2& TextStyle::GetShadowOffset() const
601 {
602   if ( !mImpl )
603   {
604     return DEFAULT_SHADOW_OFFSET;
605   }
606   return mImpl->mShadowOffset;
607 }
608
609 float TextStyle::GetShadowSize() const
610 {
611   if ( !mImpl )
612   {
613     return DEFAULT_SHADOW_SIZE;
614   }
615   else
616   {
617     return mImpl->mShadowSize;
618   }
619 }
620
621 void TextStyle::SetShadow( bool shadow, const Vector4& shadowColor, const Vector2& shadowOffset, const float shadowSize )
622 {
623   CreateImplementationJustInTime();
624   mImpl->mShadow = shadow;
625   mImpl->mShadowColor = shadowColor;
626   mImpl->mShadowOffset = shadowOffset;
627   mImpl->mShadowSize = shadowSize;
628 }
629
630 bool TextStyle::GetGlow() const
631 {
632   if ( !mImpl )
633   {
634     return false;
635   }
636   return mImpl->mGlow;
637 }
638
639 const Vector4& TextStyle::GetGlowColor() const
640 {
641   if ( !mImpl )
642   {
643     return DEFAULT_GLOW_COLOR;
644   }
645   else
646   {
647     return mImpl->mGlowColor;
648   }
649 }
650
651 float TextStyle::GetGlowIntensity() const
652 {
653   if ( !mImpl )
654   {
655     return DEFAULT_GLOW_INTENSITY;
656   }
657   else
658   {
659     return mImpl->mGlowIntensity;
660   }
661 }
662
663 void TextStyle::SetGlow( bool glow, const Vector4& glowColor, float glowIntensity )
664 {
665   CreateImplementationJustInTime();
666   mImpl->mGlow = glow;
667   mImpl->mGlowColor = glowColor;
668   mImpl->mGlowIntensity = glowIntensity;
669 }
670
671 float TextStyle::GetSmoothEdge() const
672 {
673   if ( !mImpl )
674   {
675     return DEFAULT_SMOOTH_EDGE_DISTANCE_FIELD;
676   }
677   else
678   {
679     return mImpl->mSmoothEdge;
680   }
681 }
682
683 void TextStyle::SetSmoothEdge( float smoothEdge )
684 {
685   CreateImplementationJustInTime();
686   mImpl->mSmoothEdge = smoothEdge;
687 }
688
689 bool TextStyle::GetOutline() const
690 {
691   if ( !mImpl )
692   {
693     return false;
694   }
695   else
696   {
697     return mImpl->mOutline;
698   }
699 }
700
701 const Vector4& TextStyle::GetOutlineColor() const
702 {
703   if ( !mImpl )
704   {
705     return DEFAULT_OUTLINE_COLOR;
706   }
707   else
708   {
709     return mImpl->mOutlineColor;
710   }
711 }
712
713 const Vector2& TextStyle::GetOutlineThickness() const
714 {
715   if ( !mImpl )
716   {
717     return DEFAULT_OUTLINE_THICKNESS;
718   }
719   else
720   {
721     return mImpl->mOutlineThickness;
722   }
723 }
724
725 void TextStyle::SetOutline( bool outline, const Vector4& outlineColor, const Vector2& outlineThickness )
726 {
727   CreateImplementationJustInTime();
728   mImpl->mOutline = outline;
729   mImpl->mOutlineColor = outlineColor;
730   mImpl->mOutlineThickness = outlineThickness;
731 }
732
733 void TextStyle::CreateImplementationJustInTime()
734 {
735   if ( mImpl == NULL )
736   {
737     mImpl = new TextStyle::Impl();
738   }
739 }
740
741
742 } // namespace Dali