2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 #include <dali/internal/event/actors/text-actor-impl.h>
21 #include <dali/internal/event/actor-attachments/text-attachment-impl.h>
22 #include <dali/internal/event/common/property-index-ranges.h>
23 #include <dali/internal/event/text/font-impl.h>
24 #include <dali/internal/event/text/utf8-impl.h>
25 #include <dali/internal/event/text/text-impl.h>
26 #include <dali/integration-api/platform-abstraction.h>
27 #include <dali/integration-api/debug.h>
28 #include <dali/internal/common/core-impl.h>
29 #include <dali/public-api/object/type-registry.h>
34 const Property::Index TextActor::TEXT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
35 const Property::Index TextActor::FONT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 1;
36 const Property::Index TextActor::FONT_STYLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 2;
37 const Property::Index TextActor::OUTLINE_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 3;
38 const Property::Index TextActor::OUTLINE_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 4;
39 const Property::Index TextActor::OUTLINE_THICKNESS_WIDTH = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 5;
40 const Property::Index TextActor::SMOOTH_EDGE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 6;
41 const Property::Index TextActor::GLOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 7;
42 const Property::Index TextActor::GLOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 8;
43 const Property::Index TextActor::GLOW_INTENSITY = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 9;
44 const Property::Index TextActor::SHADOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 10;
45 const Property::Index TextActor::SHADOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 11;
46 const Property::Index TextActor::SHADOW_OFFSET = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 12;
47 const Property::Index TextActor::ITALICS_ANGLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 13;
48 const Property::Index TextActor::UNDERLINE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 14;
49 const Property::Index TextActor::WEIGHT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 15;
50 const Property::Index TextActor::FONT_DETECTION_AUTOMATIC = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 16;
51 const Property::Index TextActor::GRADIENT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 17;
52 const Property::Index TextActor::GRADIENT_START_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 18;
53 const Property::Index TextActor::GRADIENT_END_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 19;
54 const Property::Index TextActor::SHADOW_SIZE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 20;
55 const Property::Index TextActor::TEXT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 21;
60 const std::string DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[] =
67 "outline-thickness-width",
78 "font-detection-automatic",
80 "gradient-start-point",
85 const int DEFAULT_TEXT_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES ) / sizeof( std::string );
87 const Property::Type DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[DEFAULT_TEXT_ACTOR_PROPERTY_COUNT] =
89 Property::STRING, // "text"
90 Property::STRING, // "font"
91 Property::STRING, // "font-style"
92 Property::BOOLEAN, // "outline-enable"
93 Property::VECTOR4, // "outline-color"
94 Property::VECTOR2, // "outline-thickness-width"
95 Property::FLOAT, // "smooth-edge"
96 Property::BOOLEAN, // "glow-enable"
97 Property::VECTOR4, // "glow-color"
98 Property::FLOAT, // "glow-intensity"
99 Property::BOOLEAN, // "shadow-enable"
100 Property::VECTOR4, // "shadow-color"
101 Property::VECTOR2, // "shadow-offset"
102 Property::FLOAT, // "italics-angle"
103 Property::BOOLEAN, // "underline"
104 Property::INTEGER, // "weight"
105 Property::BOOLEAN, // "font-detection-automatic"
106 Property::VECTOR4, // "gradient-color",
107 Property::VECTOR2, // "gradient-start-point",
108 Property::VECTOR2, // "gradient-end-point"
109 Property::FLOAT, // "shadow-size"
110 Property::VECTOR4, // "text-color",
117 bool TextActor::mFirstInstance = true;
118 Actor::DefaultPropertyLookup* TextActor::mDefaultTextActorPropertyLookup = NULL;
125 return Dali::TextActor::New();
128 TypeRegistration mType( typeid(Dali::TextActor), typeid(Dali::RenderableActor), Create );
130 SignalConnectorType s1( mType, Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED, &TextActor::DoConnectSignal );
134 TextActorPtr TextActor::New(const Dali::Text& text, bool fontDetection, bool isLeftToRight)
136 Dali::Font font( Dali::Font::New() );
137 return New( text, fontDetection, isLeftToRight, GetImplementation( font ) );
140 TextActorPtr TextActor::New(const Dali::Text& text, bool fontDetection, bool isLeftToRight, Font& font )
142 // first stage construction
143 TextActorPtr actor ( new TextActor( fontDetection, isLeftToRight ) );
145 FontPointer fontPtr(&font);
147 // Second-phase construction
150 //create the attachment
151 actor->mTextAttachment = TextAttachment::New( *actor->mNode, TextArray(), fontPtr, isLeftToRight);
153 actor->SetText( text );
158 TextActorPtr TextActor::New(const Dali::Text& text, bool fontDetection, bool isLeftToRight, const Dali::TextStyle& style )
160 // first stage construction
161 TextActorPtr actor ( new TextActor( fontDetection, isLeftToRight ) );
163 FontPointer fontPtr( Font::New(style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) );
165 // Second-phase construction
168 //create the attachment
169 actor->mTextAttachment = TextAttachment::New( *actor->mNode, TextArray(), fontPtr, isLeftToRight );
171 // Note: SetTextStyle() MUST be called before SetText(), to ensure
172 // that a single ResourceRequest for the glyphs is made. Calling
173 // them in the wrong order will issue two requests.
174 actor->SetTextStyle( style, DONT_REQUEST_NEW_TEXT );
176 actor->SetText( text );
181 TextActor::TextActor(bool fontDetection, bool isLeftToRight)
183 mLoadingState(Dali::ResourceLoading),
184 mUsingNaturalSize(true),
185 mInternalSetSize(false),
186 mFontDetection(fontDetection),
187 mIsLeftToRight(isLeftToRight),
192 void TextActor::OnInitialize()
194 if(TextActor::mFirstInstance)
196 mDefaultTextActorPropertyLookup = new DefaultPropertyLookup();
197 const int start = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
198 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
200 (*mDefaultTextActorPropertyLookup)[DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[i]] = i + start;
202 TextActor::mFirstInstance = false ;
206 TextActor::~TextActor()
208 StopObservingTextLoads();
211 const std::string TextActor::GetText() const
213 const TextArray& utfCodes = mTextAttachment->GetText();
217 // minimize allocations for ascii strings
218 text.reserve(utfCodes.size());
220 for (unsigned int i = 0; i < utfCodes.size(); ++i)
222 unsigned char utf8Data[4];
223 unsigned int utf8Length;
225 utf8Length = UTF8Write(utfCodes[i], utf8Data);
227 text.append(reinterpret_cast<const char*>(utf8Data), utf8Length);
233 void TextActor::SetText(const std::string& text)
239 // minimize allocations for ascii strings
240 utfCodes.reserve(text.size());
242 // break string into UTF-8 tokens
243 UTF8Tokenize(reinterpret_cast<const unsigned char*>(text.c_str()), text.size(), utfCodes);
249 Font* TextActor::GetFont() const
251 return &mTextAttachment->GetFont();
254 void TextActor::SetText(const Dali::Text& text)
258 if( !text.IsEmpty() )
260 utfCodes = text.GetImplementation().GetTextArray();
266 void TextActor::SetToNaturalSize()
268 // ignore size set by application
269 mUsingNaturalSize = true;
270 TextChanged(); // this will calculate natural size
273 void TextActor::StopObservingTextLoads()
277 mTextAttachment->GetFont().RemoveObserver( *this );
282 void TextActor::StartObservingTextLoads()
286 mTextAttachment->GetFont().AddObserver( *this );
291 void TextActor::SetText(const TextArray& utfCodes)
293 StopObservingTextLoads();
295 // assign the new text
296 mTextAttachment->SetText(utfCodes);
300 // first check if the provided font supports the text
302 if( !mTextAttachment->GetFont().AllGlyphsSupported(utfCodes) )
305 // @todo GetFamilyForText should return font name and style
306 const std::string fontName = Font::GetFamilyForText(utfCodes);
308 // use previous formatting
309 Internal::Font& font = mTextAttachment->GetFont();
311 Dali::Font fontNew = Dali::Font::New( Dali::FontParameters( fontName, font.GetStyle(), PointSize(font.GetPointSize() ) ) );
313 SetFont( GetImplementation(fontNew), DONT_REQUEST_NEW_TEXT );
320 void TextActor::SetFont(Font& font, TextRequestMode mode )
322 StopObservingTextLoads();
324 if( mode == REQUEST_NEW_TEXT )
327 mTextAttachment->SetFont( font );
329 // request text for new font
335 mTextAttachment->SetFont( font );
339 void TextActor::OnSizeSet(const Vector3& targetSize)
341 if( !mInternalSetSize )
343 // after size is once set by application we no longer use the natural size
344 mUsingNaturalSize = false;
348 void TextActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
350 // after size has been animated by application we no longer use the natural size
351 mUsingNaturalSize = false;
354 RenderableAttachment& TextActor::GetRenderableAttachment() const
356 DALI_ASSERT_DEBUG( mTextAttachment );
357 return *mTextAttachment;
360 void TextActor::SetGradientColor( const Vector4& color )
362 mTextAttachment->SetGradientColor( color );
365 const Vector4& TextActor::GetGradientColor() const
367 return mTextAttachment->GetGradientColor();
370 void TextActor::SetGradientStartPoint( const Vector2& position )
372 mTextAttachment->SetGradientStartPoint( position );
375 const Vector2& TextActor::GetGradientStartPoint() const
377 return mTextAttachment->GetGradientStartPoint();
380 void TextActor::SetGradientEndPoint( const Vector2& position )
382 mTextAttachment->SetGradientEndPoint( position );
385 const Vector2& TextActor::GetGradientEndPoint() const
387 return mTextAttachment->GetGradientEndPoint();
390 void TextActor::SetTextStyle( const TextStyle& style, TextRequestMode mode )
393 const Font& font = mTextAttachment->GetFont();
395 // Determine the font name/style/size that Font would create.
396 // Then compare this to the existing font (which has been validated by Font).
398 std::string resolvedFontName = style.GetFontName();
399 std::string resolvedFontStyle = style.GetFontStyle();
400 float resolvedFontPointSize = style.GetFontPointSize();
401 bool resolvedFontFamilyDefault(false);
402 bool resolvedFontPointSizeDefault(false);
404 Font::ValidateFontRequest( resolvedFontName,
406 resolvedFontPointSize,
407 resolvedFontFamilyDefault,
408 resolvedFontPointSizeDefault );
410 // Now compare to existing font used to see if a font change is necessary.
411 if( ( font.GetName() != resolvedFontName ) ||
412 ( font.GetStyle() != resolvedFontStyle ) ||
413 ( fabsf(font.GetPointSize() - resolvedFontPointSize) >= GetRangedEpsilon(font.GetPointSize(), resolvedFontPointSize) ) )
415 // Create font with original request (so font can determine if family and/or point size is default)
416 SetFont( *(Font::New( style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) ), mode );
420 SetTextColor( style.GetTextColor() );
423 SetItalics( style.GetItalics() ? Radian( style.GetItalicsAngle() ) : Radian( 0.0f ) );
426 SetUnderline( style.GetUnderline(), style.GetUnderlineThickness(), style.GetUnderlinePosition() );
429 SetShadow( style.GetShadow(), style.GetShadowColor(), style.GetShadowOffset(), style.GetShadowSize() );
432 SetGlow( style.GetGlow(), style.GetGlowColor(), style.GetGlowIntensity() );
435 SetSmoothEdge( style.GetSmoothEdge() );
438 SetOutline( style.GetOutline(), style.GetOutlineColor(), style.GetOutlineThickness() );
441 SetWeight( style.GetWeight() );
444 TextStyle TextActor::GetTextStyle() const
446 // Reset to default values.
450 const Font& font = mTextAttachment->GetFont();
452 if( !font.IsDefaultSystemFont() )
454 textStyle.SetFontName( font.GetName() );
455 textStyle.SetFontStyle( font.GetStyle() );
458 if( !font.IsDefaultSystemSize() )
460 textStyle.SetFontPointSize( PointSize( font.GetPointSize() ) );
464 textStyle.SetTextColor( GetTextColor() );
467 textStyle.SetItalics( Radian( 0.f ) != GetItalics() );
468 textStyle.SetItalicsAngle( Degree( GetItalics() ) );
471 textStyle.SetUnderline( GetUnderline() );
472 textStyle.SetUnderlinePosition( GetUnderlinePosition() );
473 textStyle.SetUnderlineThickness( GetUnderlineThickness() );
477 Vector2 shadowOffset;
479 mTextAttachment->GetShadowParams( shadowColor, shadowOffset, shadowSize );
480 textStyle.SetShadow( mTextAttachment->GetShadow(), shadowColor, shadowOffset, shadowSize );
484 float glowOffset(0.0f);
485 mTextAttachment->GetGlowParams( glowColor, glowOffset );
486 textStyle.SetGlow( mTextAttachment->GetGlow(), glowColor, glowOffset );
489 textStyle.SetSmoothEdge( mTextAttachment->GetSmoothEdge() );
492 Vector4 outlineColor;
493 Vector2 outlineOffset;
494 mTextAttachment->GetOutlineParams( outlineColor, outlineOffset );
495 textStyle.SetOutline( mTextAttachment->GetOutline(), outlineColor, outlineOffset );
498 textStyle.SetWeight( mTextAttachment->GetWeight() );
503 void TextActor::SetTextColor(const Vector4& color)
505 mTextAttachment->SetTextColor( color );
508 Vector4 TextActor::GetTextColor() const
510 return mTextAttachment->GetTextColor();
513 void TextActor::SetSmoothEdge(const float smoothEdge)
515 mTextAttachment->SetSmoothEdge(smoothEdge);
518 void TextActor::SetOutline(const bool enable, const Vector4& color, const Vector2& offset)
520 mTextAttachment->SetOutline(enable, color, offset);
523 void TextActor::SetGlow(const bool enable, const Vector4& color, const float intensity)
525 mTextAttachment->SetGlow(enable, color, intensity);
528 void TextActor::SetShadow(const bool enable, const Vector4& color, const Vector2& offset, const float size)
530 mTextAttachment->SetShadow(enable, color, offset, size);
533 void TextActor::SetItalics( const Radian& angle )
535 mTextAttachment->SetItalics( angle );
540 const Radian& TextActor::GetItalics() const
542 return mTextAttachment->GetItalics();
545 void TextActor::SetUnderline( const bool enable, float thickness, float position )
547 mTextAttachment->SetUnderline( enable, thickness, position );
552 bool TextActor::GetUnderline() const
554 return mTextAttachment->GetUnderline();
557 float TextActor::GetUnderlineThickness() const
559 return mTextAttachment->GetUnderlineThickness();
562 float TextActor::GetUnderlinePosition() const
564 return mTextAttachment->GetUnderlinePosition();
567 void TextActor::SetWeight( TextStyle::Weight weight )
569 mTextAttachment->SetWeight( weight );
572 TextStyle::Weight TextActor::GetWeight() const
574 return mTextAttachment->GetWeight();
577 void TextActor::SetFontDetectionAutomatic(bool value)
579 mFontDetection = value;
582 bool TextActor::IsFontDetectionAutomatic() const
584 return mFontDetection;
587 bool TextActor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
589 bool connected( true );
590 TextActor* textActor = dynamic_cast<TextActor*>(object);
592 if( Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED == signalName )
594 textActor->TextAvailableSignal().Connect( tracker, functor );
598 // signalName does not match any signal
605 void TextActor::TextLoaded()
607 // if the text is loaded, trigger the loaded finished signal
608 CheckTextLoadState();
611 void TextActor::TextChanged()
613 // this will tell the text attachment to act on any text or font changes
614 mTextAttachment->TextChanged();
616 // check the loading state
617 bool loaded = CheckTextLoadState();
620 mLoadingState = Dali::ResourceLoading;
622 StartObservingTextLoads();
624 // the text natural size is calculated synchronously above, when TextChanged() is called
625 if (mUsingNaturalSize)
627 mInternalSetSize = true; // to know we're internally setting size
628 SetSize( mTextAttachment->GetNaturalTextSize() );
629 mInternalSetSize = false;
633 bool TextActor::CheckTextLoadState()
635 if( mTextAttachment->IsTextLoaded() )
637 mLoadingState = Dali::ResourceLoadingSucceeded;
639 StopObservingTextLoads();
641 // emit text available signal
643 mLoadingFinishedV2.Emit( Dali::TextActor( this ) );
652 unsigned int TextActor::GetDefaultPropertyCount() const
654 return RenderableActor::GetDefaultPropertyCount() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT;
657 void TextActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
659 RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
661 indices.reserve( indices.size() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT );
663 int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
664 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i, ++index )
666 indices.push_back( index );
670 const std::string& TextActor::GetDefaultPropertyName( Property::Index index ) const
672 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
674 return RenderableActor::GetDefaultPropertyName(index) ;
678 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
680 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
682 return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index];
686 // index out-of-bounds
687 static const std::string INVALID_PROPERTY_NAME;
688 return INVALID_PROPERTY_NAME;
693 Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
695 Property::Index index = Property::INVALID_INDEX;
697 DALI_ASSERT_DEBUG( NULL != mDefaultTextActorPropertyLookup );
699 // Look for name in current class' default properties
700 DefaultPropertyLookup::const_iterator result = mDefaultTextActorPropertyLookup->find( name );
701 if ( mDefaultTextActorPropertyLookup->end() != result )
703 index = result->second;
707 // If not found, check in base class
708 index = RenderableActor::GetDefaultPropertyIndex( name );
714 bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
716 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
718 return RenderableActor::IsDefaultPropertyWritable(index) ;
726 bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
728 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
730 return RenderableActor::IsDefaultPropertyAnimatable(index) ;
738 bool TextActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
740 if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
742 return RenderableActor::IsDefaultPropertyAConstraintInput(index);
744 return true; // Our properties can be used as input to constraints.
747 Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
749 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
751 return RenderableActor::GetDefaultPropertyType(index) ;
755 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
757 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
759 return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index];
763 // index out-of-bounds
764 return Property::NONE;
769 void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
771 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
773 RenderableActor::SetDefaultProperty(index, propertyValue) ;
779 case Dali::TextActor::TEXT:
781 SetText(propertyValue.Get<std::string>());
784 case Dali::TextActor::FONT:
786 SetFont(*Font::New(propertyValue.Get<std::string>(),
787 mTextAttachment->GetFont().GetStyle(),
788 PointSize(mTextAttachment->GetFont().GetPointSize())));
791 case Dali::TextActor::FONT_STYLE:
793 SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
794 propertyValue.Get<std::string>(),
795 PointSize(mTextAttachment->GetFont().GetPointSize())));
798 case Dali::TextActor::OUTLINE_ENABLE:
802 mTextAttachment->GetOutlineParams( color, thickness );
803 mTextAttachment->SetOutline(propertyValue.Get<bool>(), color, thickness);
806 case Dali::TextActor::OUTLINE_COLOR:
810 mTextAttachment->GetOutlineParams( color, thickness );
811 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get<Vector4>(), thickness);
814 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
818 mTextAttachment->GetOutlineParams( color, thickness );
819 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get<Vector2>());
822 case Dali::TextActor::SMOOTH_EDGE:
824 mTextAttachment->SetSmoothEdge( propertyValue.Get<float>());
827 case Dali::TextActor::GLOW_ENABLE:
831 mTextAttachment->GetGlowParams( color, intensity );
832 mTextAttachment->SetGlow(propertyValue.Get<bool>(), color, intensity);
835 case Dali::TextActor::GLOW_COLOR:
839 mTextAttachment->GetGlowParams( color, intensity );
840 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get<Vector4>(), intensity);
843 case Dali::TextActor::GLOW_INTENSITY:
847 mTextAttachment->GetGlowParams( color, intensity );
848 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get<float>());
851 case Dali::TextActor::SHADOW_ENABLE:
856 mTextAttachment->GetShadowParams( color, offset, size );
857 mTextAttachment->SetShadow(propertyValue.Get<bool>(), color, offset, size );
860 case Dali::TextActor::SHADOW_COLOR:
865 mTextAttachment->GetShadowParams( color, offset, size );
866 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get<Vector4>(), offset, size);
869 case Dali::TextActor::SHADOW_OFFSET:
874 mTextAttachment->GetShadowParams( color, offset, size );
875 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get<Vector2>(), size );
878 case Dali::TextActor::SHADOW_SIZE:
883 mTextAttachment->GetShadowParams( color, offset, size );
884 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get<float>());
887 case Dali::TextActor::ITALICS_ANGLE:
889 SetItalics(Radian(propertyValue.Get<float>())) ;
892 case Dali::TextActor::UNDERLINE:
894 SetUnderline(propertyValue.Get<bool>(), 0.f, 0.f ) ;
897 case Dali::TextActor::WEIGHT:
899 mTextAttachment->SetWeight(static_cast<TextStyle::Weight>(propertyValue.Get<int>())) ;
902 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
904 mFontDetection = propertyValue.Get<bool>() ;
907 case Dali::TextActor::GRADIENT_COLOR:
909 mTextAttachment->SetGradientColor( propertyValue.Get<Vector4>() );
912 case Dali::TextActor::GRADIENT_START_POINT:
914 mTextAttachment->SetGradientStartPoint( propertyValue.Get<Vector2>() );
917 case Dali::TextActor::GRADIENT_END_POINT:
919 mTextAttachment->SetGradientEndPoint( propertyValue.Get<Vector2>() );
922 case Dali::TextActor::TEXT_COLOR:
924 mTextAttachment->SetTextColor( propertyValue.Get<Vector4>() );
929 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
937 Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
939 Property::Value ret ;
940 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
942 ret = RenderableActor::GetDefaultProperty(index) ;
948 case Dali::TextActor::TEXT:
953 case Dali::TextActor::FONT:
955 ret = mTextAttachment->GetFont().GetName();
958 case Dali::TextActor::FONT_STYLE:
960 ret = mTextAttachment->GetFont().GetStyle();
963 case Dali::TextActor::OUTLINE_ENABLE:
965 ret = mTextAttachment->GetOutline();
968 case Dali::TextActor::OUTLINE_COLOR:
972 mTextAttachment->GetOutlineParams( color, thickness );
976 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
980 mTextAttachment->GetOutlineParams( color, thickness );
984 case Dali::TextActor::SMOOTH_EDGE:
986 ret = mTextAttachment->GetSmoothEdge();
989 case Dali::TextActor::GLOW_ENABLE:
991 ret = mTextAttachment->GetGlow();
994 case Dali::TextActor::GLOW_COLOR:
997 float intensity(0.0f);
998 mTextAttachment->GetGlowParams( color, intensity );
1002 case Dali::TextActor::GLOW_INTENSITY:
1005 float intensity(0.0f);
1006 mTextAttachment->GetGlowParams( color, intensity );
1010 case Dali::TextActor::SHADOW_ENABLE:
1012 ret = mTextAttachment->GetShadow();
1015 case Dali::TextActor::SHADOW_COLOR:
1020 mTextAttachment->GetShadowParams( color, offset, size );
1024 case Dali::TextActor::SHADOW_OFFSET:
1029 mTextAttachment->GetShadowParams( color, offset, size );
1033 case Dali::TextActor::SHADOW_SIZE:
1038 mTextAttachment->GetShadowParams( color, offset, size );
1042 case Dali::TextActor::ITALICS_ANGLE:
1044 ret = static_cast<float>(mTextAttachment->GetItalics()) ;
1047 case Dali::TextActor::UNDERLINE:
1049 ret = mTextAttachment->GetUnderline() ;
1052 case Dali::TextActor::WEIGHT:
1054 ret = static_cast<int>(mTextAttachment->GetWeight());
1057 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
1059 ret = mFontDetection;
1062 case Dali::TextActor::GRADIENT_COLOR:
1064 ret = mTextAttachment->GetGradientColor();
1067 case Dali::TextActor::GRADIENT_START_POINT:
1069 ret = mTextAttachment->GetGradientStartPoint();
1072 case Dali::TextActor::GRADIENT_END_POINT:
1074 ret = mTextAttachment->GetGradientEndPoint();
1077 case Dali::TextActor::TEXT_COLOR:
1079 ret = mTextAttachment->GetTextColor();
1084 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
1088 } // if from base class
1093 } // namespace Internal