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