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 = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT;
35 const Property::Index TextActor::FONT = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 1;
36 const Property::Index TextActor::FONT_STYLE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 2;
37 const Property::Index TextActor::OUTLINE_ENABLE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 3;
38 const Property::Index TextActor::OUTLINE_COLOR = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 4;
39 const Property::Index TextActor::OUTLINE_THICKNESS_WIDTH = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 5;
40 const Property::Index TextActor::SMOOTH_EDGE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 6;
41 const Property::Index TextActor::GLOW_ENABLE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 7;
42 const Property::Index TextActor::GLOW_COLOR = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 8;
43 const Property::Index TextActor::GLOW_INTENSITY = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 9;
44 const Property::Index TextActor::SHADOW_ENABLE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 10;
45 const Property::Index TextActor::SHADOW_COLOR = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 11;
46 const Property::Index TextActor::SHADOW_OFFSET = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 12;
47 const Property::Index TextActor::ITALICS_ANGLE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 13;
48 const Property::Index TextActor::UNDERLINE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 14;
49 const Property::Index TextActor::WEIGHT = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 15;
50 const Property::Index TextActor::FONT_DETECTION_AUTOMATIC = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 16;
51 const Property::Index TextActor::GRADIENT_COLOR = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 17;
52 const Property::Index TextActor::GRADIENT_START_POINT = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 18;
53 const Property::Index TextActor::GRADIENT_END_POINT = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 19;
54 const Property::Index TextActor::SHADOW_SIZE = RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT + 20;
55 const Property::Index TextActor::TEXT_COLOR = RENDERABLE_ACTOR_DEFAULT_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 = RENDERABLE_ACTOR_DEFAULT_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::SetNaturalSize()
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 const std::string& TextActor::GetDefaultPropertyName( Property::Index index ) const
659 if(index < RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT)
661 return RenderableActor::GetDefaultPropertyName(index) ;
665 // ProxyObject guarantees that index is within range
666 return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index - RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT];
670 Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
672 Property::Index index = Property::INVALID_INDEX;
674 DALI_ASSERT_DEBUG( NULL != mDefaultTextActorPropertyLookup );
676 // Look for name in current class' default properties
677 DefaultPropertyLookup::const_iterator result = mDefaultTextActorPropertyLookup->find( name );
678 if ( mDefaultTextActorPropertyLookup->end() != result )
680 index = result->second;
684 // If not found, check in base class
685 index = RenderableActor::GetDefaultPropertyIndex( name );
691 bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
693 if(index < RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT)
695 return RenderableActor::IsDefaultPropertyWritable(index) ;
703 bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
705 if(index < RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT)
707 return RenderableActor::IsDefaultPropertyAnimatable(index) ;
715 Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
717 if(index < RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT)
719 return RenderableActor::GetDefaultPropertyType(index) ;
723 // ProxyObject guarantees that index is within range
724 return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index - RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT];
728 void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
730 // ProxyObject guarantees the property is writable and index is in range
732 if(index < RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT)
734 RenderableActor::SetDefaultProperty(index, propertyValue) ;
740 case Dali::TextActor::TEXT:
742 SetText(propertyValue.Get<std::string>());
745 case Dali::TextActor::FONT:
747 SetFont(*Font::New(propertyValue.Get<std::string>(),
748 mTextAttachment->GetFont().GetStyle(),
749 PointSize(mTextAttachment->GetFont().GetPointSize())));
752 case Dali::TextActor::FONT_STYLE:
754 SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
755 propertyValue.Get<std::string>(),
756 PointSize(mTextAttachment->GetFont().GetPointSize())));
759 case Dali::TextActor::OUTLINE_ENABLE:
763 mTextAttachment->GetOutlineParams( color, thickness );
764 mTextAttachment->SetOutline(propertyValue.Get<bool>(), color, thickness);
767 case Dali::TextActor::OUTLINE_COLOR:
771 mTextAttachment->GetOutlineParams( color, thickness );
772 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get<Vector4>(), thickness);
775 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
779 mTextAttachment->GetOutlineParams( color, thickness );
780 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get<Vector2>());
783 case Dali::TextActor::SMOOTH_EDGE:
785 mTextAttachment->SetSmoothEdge( propertyValue.Get<float>());
788 case Dali::TextActor::GLOW_ENABLE:
792 mTextAttachment->GetGlowParams( color, intensity );
793 mTextAttachment->SetGlow(propertyValue.Get<bool>(), color, intensity);
796 case Dali::TextActor::GLOW_COLOR:
800 mTextAttachment->GetGlowParams( color, intensity );
801 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get<Vector4>(), intensity);
804 case Dali::TextActor::GLOW_INTENSITY:
808 mTextAttachment->GetGlowParams( color, intensity );
809 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get<float>());
812 case Dali::TextActor::SHADOW_ENABLE:
817 mTextAttachment->GetShadowParams( color, offset, size );
818 mTextAttachment->SetShadow(propertyValue.Get<bool>(), color, offset, size );
821 case Dali::TextActor::SHADOW_COLOR:
826 mTextAttachment->GetShadowParams( color, offset, size );
827 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get<Vector4>(), offset, size);
830 case Dali::TextActor::SHADOW_OFFSET:
835 mTextAttachment->GetShadowParams( color, offset, size );
836 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get<Vector2>(), size );
839 case Dali::TextActor::SHADOW_SIZE:
844 mTextAttachment->GetShadowParams( color, offset, size );
845 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get<float>());
848 case Dali::TextActor::ITALICS_ANGLE:
850 SetItalics(Radian(propertyValue.Get<float>())) ;
853 case Dali::TextActor::UNDERLINE:
855 SetUnderline(propertyValue.Get<bool>(), 0.f, 0.f ) ;
858 case Dali::TextActor::WEIGHT:
860 mTextAttachment->SetWeight(static_cast<TextStyle::Weight>(propertyValue.Get<int>())) ;
863 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
865 mFontDetection = propertyValue.Get<bool>() ;
868 case Dali::TextActor::GRADIENT_COLOR:
870 mTextAttachment->SetGradientColor( propertyValue.Get<Vector4>() );
873 case Dali::TextActor::GRADIENT_START_POINT:
875 mTextAttachment->SetGradientStartPoint( propertyValue.Get<Vector2>() );
878 case Dali::TextActor::GRADIENT_END_POINT:
880 mTextAttachment->SetGradientEndPoint( propertyValue.Get<Vector2>() );
883 case Dali::TextActor::TEXT_COLOR:
885 mTextAttachment->SetTextColor( propertyValue.Get<Vector4>() );
890 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
898 Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
900 Property::Value ret ;
901 if(index < RENDERABLE_ACTOR_DEFAULT_PROPERTY_MAX_COUNT)
903 ret = RenderableActor::GetDefaultProperty(index) ;
909 case Dali::TextActor::TEXT:
914 case Dali::TextActor::FONT:
916 ret = mTextAttachment->GetFont().GetName();
919 case Dali::TextActor::FONT_STYLE:
921 ret = mTextAttachment->GetFont().GetStyle();
924 case Dali::TextActor::OUTLINE_ENABLE:
926 ret = mTextAttachment->GetOutline();
929 case Dali::TextActor::OUTLINE_COLOR:
933 mTextAttachment->GetOutlineParams( color, thickness );
937 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
941 mTextAttachment->GetOutlineParams( color, thickness );
945 case Dali::TextActor::SMOOTH_EDGE:
947 ret = mTextAttachment->GetSmoothEdge();
950 case Dali::TextActor::GLOW_ENABLE:
952 ret = mTextAttachment->GetGlow();
955 case Dali::TextActor::GLOW_COLOR:
958 float intensity(0.0f);
959 mTextAttachment->GetGlowParams( color, intensity );
963 case Dali::TextActor::GLOW_INTENSITY:
966 float intensity(0.0f);
967 mTextAttachment->GetGlowParams( color, intensity );
971 case Dali::TextActor::SHADOW_ENABLE:
973 ret = mTextAttachment->GetShadow();
976 case Dali::TextActor::SHADOW_COLOR:
981 mTextAttachment->GetShadowParams( color, offset, size );
985 case Dali::TextActor::SHADOW_OFFSET:
990 mTextAttachment->GetShadowParams( color, offset, size );
994 case Dali::TextActor::SHADOW_SIZE:
999 mTextAttachment->GetShadowParams( color, offset, size );
1003 case Dali::TextActor::ITALICS_ANGLE:
1005 ret = static_cast<float>(mTextAttachment->GetItalics()) ;
1008 case Dali::TextActor::UNDERLINE:
1010 ret = mTextAttachment->GetUnderline() ;
1013 case Dali::TextActor::WEIGHT:
1015 ret = static_cast<int>(mTextAttachment->GetWeight());
1018 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
1020 ret = mFontDetection;
1023 case Dali::TextActor::GRADIENT_COLOR:
1025 ret = mTextAttachment->GetGradientColor();
1028 case Dali::TextActor::GRADIENT_START_POINT:
1030 ret = mTextAttachment->GetGradientStartPoint();
1033 case Dali::TextActor::GRADIENT_END_POINT:
1035 ret = mTextAttachment->GetGradientEndPoint();
1038 case Dali::TextActor::TEXT_COLOR:
1040 ret = mTextAttachment->GetTextColor();
1045 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
1049 } // if from base class
1054 } // namespace Internal