2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/event/actors/text-actor-impl.h>
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/public-api/text/text-actor-parameters.h>
24 #include <dali/internal/event/actor-attachments/text-attachment-impl.h>
25 #include <dali/internal/event/common/property-index-ranges.h>
26 #include <dali/internal/event/text/font-impl.h>
27 #include <dali/internal/event/text/utf8-impl.h>
28 #include <dali/internal/event/text/text-impl.h>
29 #include <dali/integration-api/platform-abstraction.h>
30 #include <dali/integration-api/debug.h>
31 #include <dali/internal/common/core-impl.h>
36 const Property::Index TextActor::TEXT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
37 const Property::Index TextActor::FONT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 1;
38 const Property::Index TextActor::FONT_STYLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 2;
39 const Property::Index TextActor::OUTLINE_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 3;
40 const Property::Index TextActor::OUTLINE_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 4;
41 const Property::Index TextActor::OUTLINE_THICKNESS_WIDTH = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 5;
42 const Property::Index TextActor::SMOOTH_EDGE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 6;
43 const Property::Index TextActor::GLOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 7;
44 const Property::Index TextActor::GLOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 8;
45 const Property::Index TextActor::GLOW_INTENSITY = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 9;
46 const Property::Index TextActor::SHADOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 10;
47 const Property::Index TextActor::SHADOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 11;
48 const Property::Index TextActor::SHADOW_OFFSET = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 12;
49 const Property::Index TextActor::ITALICS_ANGLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 13;
50 const Property::Index TextActor::UNDERLINE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 14;
51 const Property::Index TextActor::WEIGHT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 15;
52 const Property::Index TextActor::FONT_DETECTION_AUTOMATIC = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 16;
53 const Property::Index TextActor::GRADIENT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 17;
54 const Property::Index TextActor::GRADIENT_START_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 18;
55 const Property::Index TextActor::GRADIENT_END_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 19;
56 const Property::Index TextActor::SHADOW_SIZE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 20;
57 const Property::Index TextActor::TEXT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 21;
62 const std::string DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[] =
69 "outline-thickness-width",
80 "font-detection-automatic",
82 "gradient-start-point",
87 const int DEFAULT_TEXT_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES ) / sizeof( std::string );
89 const Property::Type DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[DEFAULT_TEXT_ACTOR_PROPERTY_COUNT] =
91 Property::STRING, // "text"
92 Property::STRING, // "font"
93 Property::STRING, // "font-style"
94 Property::BOOLEAN, // "outline-enable"
95 Property::VECTOR4, // "outline-color"
96 Property::VECTOR2, // "outline-thickness-width"
97 Property::FLOAT, // "smooth-edge"
98 Property::BOOLEAN, // "glow-enable"
99 Property::VECTOR4, // "glow-color"
100 Property::FLOAT, // "glow-intensity"
101 Property::BOOLEAN, // "shadow-enable"
102 Property::VECTOR4, // "shadow-color"
103 Property::VECTOR2, // "shadow-offset"
104 Property::FLOAT, // "italics-angle"
105 Property::BOOLEAN, // "underline"
106 Property::INTEGER, // "weight"
107 Property::BOOLEAN, // "font-detection-automatic"
108 Property::VECTOR4, // "gradient-color",
109 Property::VECTOR2, // "gradient-start-point",
110 Property::VECTOR2, // "gradient-end-point"
111 Property::FLOAT, // "shadow-size"
112 Property::VECTOR4, // "text-color",
119 bool TextActor::mFirstInstance = true;
120 Actor::DefaultPropertyLookup* TextActor::mDefaultTextActorPropertyLookup = NULL;
127 return Dali::TextActor::New();
130 TypeRegistration mType( typeid(Dali::TextActor), typeid(Dali::RenderableActor), Create );
132 SignalConnectorType s1( mType, Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED, &TextActor::DoConnectSignal );
136 TextActorPtr TextActor::New( const Integration::TextArray& utfCodes, const TextActorParameters& parameters )
138 // first stage construction
139 TextActorPtr actor ( new TextActor( parameters.IsAutomaticFontDetectionEnabled() ) );
141 const TextStyle& style = parameters.GetTextStyle();
143 FontPointer fontPtr( Font::New(style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) );
145 // Second-phase construction
148 //create the attachment
149 actor->mTextAttachment = TextAttachment::New( *actor->mNode, Integration::TextArray(), fontPtr );
151 // Note: SetTextStyle() MUST be called before SetText(), to ensure
152 // that a single ResourceRequest for the glyphs is made. Calling
153 // them in the wrong order will issue two requests.
154 actor->SetTextStyle( style, DONT_REQUEST_NEW_TEXT );
156 actor->SetText( utfCodes );
161 TextActor::TextActor(bool fontDetection)
163 mLoadingState(Dali::ResourceLoading),
164 mUsingNaturalSize(true),
165 mInternalSetSize(false),
166 mFontDetection(fontDetection),
171 void TextActor::OnInitialize()
173 if(TextActor::mFirstInstance)
175 mDefaultTextActorPropertyLookup = new DefaultPropertyLookup();
176 const int start = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
177 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
179 (*mDefaultTextActorPropertyLookup)[DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[i]] = i + start;
181 TextActor::mFirstInstance = false ;
185 TextActor::~TextActor()
187 StopObservingTextLoads();
190 const std::string TextActor::GetText() const
192 const Integration::TextArray& utfCodes = mTextAttachment->GetText();
196 const std::size_t length = utfCodes.Count();
197 // minimize allocations for ascii strings
198 text.reserve( length );
200 for (unsigned int i = 0; i < length; ++i)
202 unsigned char utf8Data[4];
203 unsigned int utf8Length;
205 utf8Length = UTF8Write(utfCodes[i], utf8Data);
207 text.append(reinterpret_cast<const char*>(utf8Data), utf8Length);
213 Font* TextActor::GetFont() const
215 return &mTextAttachment->GetFont();
218 void TextActor::SetToNaturalSize()
220 // ignore size set by application
221 mUsingNaturalSize = true;
222 TextChanged(); // this will calculate natural size
225 void TextActor::StopObservingTextLoads()
229 mTextAttachment->GetFont().RemoveObserver( *this );
234 void TextActor::StartObservingTextLoads()
238 mTextAttachment->GetFont().AddObserver( *this );
243 void TextActor::SetText(const Integration::TextArray& utfCodes)
245 StopObservingTextLoads();
247 // assign the new text
248 mTextAttachment->SetText(utfCodes);
252 // first check if the provided font supports the text
254 if( !mTextAttachment->GetFont().AllGlyphsSupported(utfCodes) )
257 // @todo GetFamilyForText should return font name and style
258 const std::string fontName = Font::GetFamilyForText(utfCodes);
260 // use previous formatting
261 Internal::Font& font = mTextAttachment->GetFont();
263 Dali::Font fontNew = Dali::Font::New( Dali::FontParameters( fontName, font.GetStyle(), PointSize(font.GetPointSize() ) ) );
265 SetFont( GetImplementation(fontNew), DONT_REQUEST_NEW_TEXT );
272 void TextActor::SetFont(Font& font, TextRequestMode mode )
274 StopObservingTextLoads();
276 if( mode == REQUEST_NEW_TEXT )
279 mTextAttachment->SetFont( font );
281 // request text for new font
287 mTextAttachment->SetFont( font );
291 void TextActor::OnSizeSet(const Vector3& targetSize)
293 if( !mInternalSetSize )
295 // after size is once set by application we no longer use the natural size
296 mUsingNaturalSize = false;
300 void TextActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
302 // after size has been animated by application we no longer use the natural size
303 mUsingNaturalSize = false;
306 RenderableAttachment& TextActor::GetRenderableAttachment() const
308 DALI_ASSERT_DEBUG( mTextAttachment );
309 return *mTextAttachment;
312 void TextActor::SetGradientColor( const Vector4& color )
314 mTextAttachment->SetGradient( color, mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
317 const Vector4& TextActor::GetGradientColor() const
319 return mTextAttachment->GetGradientColor();
322 void TextActor::SetGradientStartPoint( const Vector2& position )
324 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), position, mTextAttachment->GetGradientEndPoint() );
327 const Vector2& TextActor::GetGradientStartPoint() const
329 return mTextAttachment->GetGradientStartPoint();
332 void TextActor::SetGradientEndPoint( const Vector2& position )
334 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), position );
337 const Vector2& TextActor::GetGradientEndPoint() const
339 return mTextAttachment->GetGradientEndPoint();
342 void TextActor::SetGradient( const Vector4& color, const Vector2& startPoint, const Vector2& endPoint )
344 mTextAttachment->SetGradient( color, startPoint, endPoint );
347 void TextActor::SetTextStyle( const TextStyle& style, TextRequestMode mode )
350 const Font& font = mTextAttachment->GetFont();
352 // Determine the font name/style/size that Font would create.
353 // Then compare this to the existing font (which has been validated by Font).
355 std::string resolvedFontName = style.GetFontName();
356 std::string resolvedFontStyle = style.GetFontStyle();
357 float resolvedFontPointSize = style.GetFontPointSize();
358 bool resolvedFontFamilyDefault(false);
359 bool resolvedFontPointSizeDefault(false);
361 Font::ValidateFontRequest( resolvedFontName,
363 resolvedFontPointSize,
364 resolvedFontFamilyDefault,
365 resolvedFontPointSizeDefault );
367 // Now compare to existing font used to see if a font change is necessary.
368 if( ( font.GetName() != resolvedFontName ) ||
369 ( font.GetStyle() != resolvedFontStyle ) ||
370 ( fabsf(font.GetPointSize() - resolvedFontPointSize) >= GetRangedEpsilon(font.GetPointSize(), resolvedFontPointSize) ) )
372 // Create font with original request (so font can determine if family and/or point size is default)
373 SetFont( *(Font::New( style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) ), mode );
377 if( !style.IsTextColorDefault() )
379 SetTextColor( style.GetTextColor() );
383 mTextAttachment->ResetTextColor();
387 if( !style.IsItalicsDefault() )
389 SetItalics( style.IsItalicsEnabled() ? Radian( style.GetItalicsAngle() ) : Radian( 0.0f ) );
393 mTextAttachment->ResetItalics();
397 if( !style.IsUnderlineDefault() )
399 SetUnderline( style.IsUnderlineEnabled(), style.GetUnderlineThickness(), style.GetUnderlinePosition() );
403 mTextAttachment->ResetUnderline();
407 if( !style.IsShadowDefault() )
409 SetShadow( style.IsShadowEnabled(), style.GetShadowColor(), style.GetShadowOffset(), style.GetShadowSize() );
413 mTextAttachment->ResetShadow();
417 if( !style.IsGlowDefault() )
419 SetGlow( style.IsGlowEnabled(), style.GetGlowColor(), style.GetGlowIntensity() );
423 mTextAttachment->ResetGlow();
427 if( !style.IsSmoothEdgeDefault() )
429 SetSmoothEdge( style.GetSmoothEdge() );
433 mTextAttachment->ResetSmoothEdge();
437 if( !style.IsOutlineDefault() )
439 SetOutline( style.IsOutlineEnabled(), style.GetOutlineColor(), style.GetOutlineThickness() );
443 mTextAttachment->ResetOutline();
447 if( !style.IsFontWeightDefault() )
449 SetWeight( style.GetWeight() );
453 mTextAttachment->ResetWeight();
457 if( !style.IsGradientDefault() )
459 if( style.IsGradientEnabled() )
461 SetGradient( style.GetGradientColor(), style.GetGradientStartPoint(), style.GetGradientEndPoint() );
465 SetGradient( TextStyle::DEFAULT_GRADIENT_COLOR, TextStyle::DEFAULT_GRADIENT_START_POINT, TextStyle::DEFAULT_GRADIENT_END_POINT );
470 mTextAttachment->ResetGradient();
474 TextStyle TextActor::GetTextStyle() const
477 mTextAttachment->GetTextStyle( textStyle );
482 void TextActor::SetTextColor(const Vector4& color)
484 mTextAttachment->SetTextColor( color );
487 Vector4 TextActor::GetTextColor() const
489 return mTextAttachment->GetTextColor();
492 void TextActor::SetSmoothEdge( float smoothEdge )
494 mTextAttachment->SetSmoothEdge(smoothEdge);
497 void TextActor::SetOutline( bool enable, const Vector4& color, const Vector2& offset )
499 mTextAttachment->SetOutline(enable, color, offset);
502 void TextActor::SetGlow( bool enable, const Vector4& color, float intensity )
504 mTextAttachment->SetGlow(enable, color, intensity);
507 void TextActor::SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size )
509 mTextAttachment->SetShadow(enable, color, offset, size);
512 void TextActor::SetItalics( Radian angle )
514 mTextAttachment->SetItalics( angle );
519 bool TextActor::GetItalics() const
521 return mTextAttachment->GetItalics();
524 Radian TextActor::GetItalicsAngle() const
526 return mTextAttachment->GetItalicsAngle();
529 void TextActor::SetUnderline( bool enable, float thickness, float position )
531 mTextAttachment->SetUnderline( enable, thickness, position );
536 bool TextActor::GetUnderline() const
538 return mTextAttachment->GetUnderline();
541 float TextActor::GetUnderlineThickness() const
543 return mTextAttachment->GetUnderlineThickness();
546 float TextActor::GetUnderlinePosition() const
548 return mTextAttachment->GetUnderlinePosition();
551 void TextActor::SetWeight( TextStyle::Weight weight )
553 mTextAttachment->SetWeight( weight );
556 TextStyle::Weight TextActor::GetWeight() const
558 return mTextAttachment->GetWeight();
561 void TextActor::SetFontDetectionAutomatic(bool value)
563 mFontDetection = value;
566 bool TextActor::IsFontDetectionAutomatic() const
568 return mFontDetection;
571 bool TextActor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
573 bool connected( true );
574 TextActor* textActor = dynamic_cast<TextActor*>(object);
576 if( Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED == signalName )
578 textActor->TextAvailableSignal().Connect( tracker, functor );
582 // signalName does not match any signal
589 void TextActor::TextLoaded()
591 // if the text is loaded, trigger the loaded finished signal
592 CheckTextLoadState();
595 void TextActor::TextChanged()
597 // this will tell the text attachment to act on any text or font changes
598 mTextAttachment->TextChanged();
600 // check the loading state
601 bool loaded = CheckTextLoadState();
604 mLoadingState = Dali::ResourceLoading;
606 StartObservingTextLoads();
608 // the text natural size is calculated synchronously above, when TextChanged() is called
609 if (mUsingNaturalSize)
611 mInternalSetSize = true; // to know we're internally setting size
612 SetSize( mTextAttachment->GetNaturalTextSize() );
613 mInternalSetSize = false;
617 bool TextActor::CheckTextLoadState()
619 if( mTextAttachment->IsTextLoaded() )
621 mLoadingState = Dali::ResourceLoadingSucceeded;
623 StopObservingTextLoads();
625 // emit text available signal
627 mLoadingFinishedV2.Emit( Dali::TextActor( this ) );
636 unsigned int TextActor::GetDefaultPropertyCount() const
638 return RenderableActor::GetDefaultPropertyCount() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT;
641 void TextActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
643 RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
645 indices.reserve( indices.size() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT );
647 int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
648 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i, ++index )
650 indices.push_back( index );
654 const std::string& TextActor::GetDefaultPropertyName( Property::Index index ) const
656 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
658 return RenderableActor::GetDefaultPropertyName(index) ;
662 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
664 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
666 return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index];
670 // index out-of-bounds
671 static const std::string INVALID_PROPERTY_NAME;
672 return INVALID_PROPERTY_NAME;
677 Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
679 Property::Index index = Property::INVALID_INDEX;
681 DALI_ASSERT_DEBUG( NULL != mDefaultTextActorPropertyLookup );
683 // Look for name in current class' default properties
684 DefaultPropertyLookup::const_iterator result = mDefaultTextActorPropertyLookup->find( name );
685 if ( mDefaultTextActorPropertyLookup->end() != result )
687 index = result->second;
691 // If not found, check in base class
692 index = RenderableActor::GetDefaultPropertyIndex( name );
698 bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
700 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
702 return RenderableActor::IsDefaultPropertyWritable(index) ;
710 bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
712 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
714 return RenderableActor::IsDefaultPropertyAnimatable(index) ;
722 bool TextActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
724 if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
726 return RenderableActor::IsDefaultPropertyAConstraintInput(index);
728 return true; // Our properties can be used as input to constraints.
731 Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
733 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
735 return RenderableActor::GetDefaultPropertyType(index) ;
739 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
741 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
743 return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index];
747 // index out-of-bounds
748 return Property::NONE;
753 void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
755 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
757 RenderableActor::SetDefaultProperty(index, propertyValue) ;
763 case Dali::TextActor::TEXT:
765 SetText( GetTextArray( Dali::Text( propertyValue.Get<std::string>() ) ) );
768 case Dali::TextActor::FONT:
770 SetFont(*Font::New(propertyValue.Get<std::string>(),
771 mTextAttachment->GetFont().GetStyle(),
772 PointSize(mTextAttachment->GetFont().GetPointSize())));
775 case Dali::TextActor::FONT_STYLE:
777 SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
778 propertyValue.Get<std::string>(),
779 PointSize(mTextAttachment->GetFont().GetPointSize())));
782 case Dali::TextActor::OUTLINE_ENABLE:
786 mTextAttachment->GetOutlineParams( color, thickness );
787 mTextAttachment->SetOutline(propertyValue.Get<bool>(), color, thickness);
790 case Dali::TextActor::OUTLINE_COLOR:
794 mTextAttachment->GetOutlineParams( color, thickness );
795 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get<Vector4>(), thickness);
798 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
802 mTextAttachment->GetOutlineParams( color, thickness );
803 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get<Vector2>());
806 case Dali::TextActor::SMOOTH_EDGE:
808 mTextAttachment->SetSmoothEdge( propertyValue.Get<float>());
811 case Dali::TextActor::GLOW_ENABLE:
815 mTextAttachment->GetGlowParams( color, intensity );
816 mTextAttachment->SetGlow(propertyValue.Get<bool>(), color, intensity);
819 case Dali::TextActor::GLOW_COLOR:
823 mTextAttachment->GetGlowParams( color, intensity );
824 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get<Vector4>(), intensity);
827 case Dali::TextActor::GLOW_INTENSITY:
831 mTextAttachment->GetGlowParams( color, intensity );
832 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get<float>());
835 case Dali::TextActor::SHADOW_ENABLE:
840 mTextAttachment->GetShadowParams( color, offset, size );
841 mTextAttachment->SetShadow(propertyValue.Get<bool>(), color, offset, size );
844 case Dali::TextActor::SHADOW_COLOR:
849 mTextAttachment->GetShadowParams( color, offset, size );
850 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get<Vector4>(), offset, size);
853 case Dali::TextActor::SHADOW_OFFSET:
858 mTextAttachment->GetShadowParams( color, offset, size );
859 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get<Vector2>(), size );
862 case Dali::TextActor::SHADOW_SIZE:
867 mTextAttachment->GetShadowParams( color, offset, size );
868 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get<float>());
871 case Dali::TextActor::ITALICS_ANGLE:
873 SetItalics(Radian(propertyValue.Get<float>())) ;
876 case Dali::TextActor::UNDERLINE:
878 SetUnderline(propertyValue.Get<bool>(), 0.f, 0.f ) ;
881 case Dali::TextActor::WEIGHT:
883 mTextAttachment->SetWeight(static_cast<TextStyle::Weight>(propertyValue.Get<int>())) ;
886 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
888 mFontDetection = propertyValue.Get<bool>() ;
891 case Dali::TextActor::GRADIENT_COLOR:
893 mTextAttachment->SetGradient( propertyValue.Get<Vector4>(), mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
896 case Dali::TextActor::GRADIENT_START_POINT:
898 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), propertyValue.Get<Vector2>(), mTextAttachment->GetGradientEndPoint() );
901 case Dali::TextActor::GRADIENT_END_POINT:
903 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), propertyValue.Get<Vector2>() );
906 case Dali::TextActor::TEXT_COLOR:
908 mTextAttachment->SetTextColor( propertyValue.Get<Vector4>() );
913 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
921 Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
923 Property::Value ret ;
924 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
926 ret = RenderableActor::GetDefaultProperty(index) ;
932 case Dali::TextActor::TEXT:
937 case Dali::TextActor::FONT:
939 ret = mTextAttachment->GetFont().GetName();
942 case Dali::TextActor::FONT_STYLE:
944 ret = mTextAttachment->GetFont().GetStyle();
947 case Dali::TextActor::OUTLINE_ENABLE:
949 ret = mTextAttachment->GetOutline();
952 case Dali::TextActor::OUTLINE_COLOR:
956 mTextAttachment->GetOutlineParams( color, thickness );
960 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
964 mTextAttachment->GetOutlineParams( color, thickness );
968 case Dali::TextActor::SMOOTH_EDGE:
970 ret = mTextAttachment->GetSmoothEdge();
973 case Dali::TextActor::GLOW_ENABLE:
975 ret = mTextAttachment->GetGlow();
978 case Dali::TextActor::GLOW_COLOR:
981 float intensity(0.0f);
982 mTextAttachment->GetGlowParams( color, intensity );
986 case Dali::TextActor::GLOW_INTENSITY:
989 float intensity(0.0f);
990 mTextAttachment->GetGlowParams( color, intensity );
994 case Dali::TextActor::SHADOW_ENABLE:
996 ret = mTextAttachment->GetShadow();
999 case Dali::TextActor::SHADOW_COLOR:
1004 mTextAttachment->GetShadowParams( color, offset, size );
1008 case Dali::TextActor::SHADOW_OFFSET:
1013 mTextAttachment->GetShadowParams( color, offset, size );
1017 case Dali::TextActor::SHADOW_SIZE:
1022 mTextAttachment->GetShadowParams( color, offset, size );
1026 case Dali::TextActor::ITALICS_ANGLE:
1028 ret = static_cast<float>(mTextAttachment->GetItalics()) ;
1031 case Dali::TextActor::UNDERLINE:
1033 ret = mTextAttachment->GetUnderline() ;
1036 case Dali::TextActor::WEIGHT:
1038 ret = static_cast<int>(mTextAttachment->GetWeight());
1041 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
1043 ret = mFontDetection;
1046 case Dali::TextActor::GRADIENT_COLOR:
1048 ret = mTextAttachment->GetGradientColor();
1051 case Dali::TextActor::GRADIENT_START_POINT:
1053 ret = mTextAttachment->GetGradientStartPoint();
1056 case Dali::TextActor::GRADIENT_END_POINT:
1058 ret = mTextAttachment->GetGradientEndPoint();
1061 case Dali::TextActor::TEXT_COLOR:
1063 ret = mTextAttachment->GetTextColor();
1068 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
1072 } // if from base class
1077 } // namespace Internal