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/internal/event/actor-attachments/text-attachment-impl.h>
23 #include <dali/internal/event/common/property-index-ranges.h>
24 #include <dali/internal/event/text/font-impl.h>
25 #include <dali/internal/event/text/utf8-impl.h>
26 #include <dali/internal/event/text/text-impl.h>
27 #include <dali/integration-api/platform-abstraction.h>
28 #include <dali/integration-api/debug.h>
29 #include <dali/internal/common/core-impl.h>
30 #include <dali/public-api/object/type-registry.h>
35 const Property::Index TextActor::TEXT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
36 const Property::Index TextActor::FONT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 1;
37 const Property::Index TextActor::FONT_STYLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 2;
38 const Property::Index TextActor::OUTLINE_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 3;
39 const Property::Index TextActor::OUTLINE_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 4;
40 const Property::Index TextActor::OUTLINE_THICKNESS_WIDTH = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 5;
41 const Property::Index TextActor::SMOOTH_EDGE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 6;
42 const Property::Index TextActor::GLOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 7;
43 const Property::Index TextActor::GLOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 8;
44 const Property::Index TextActor::GLOW_INTENSITY = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 9;
45 const Property::Index TextActor::SHADOW_ENABLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 10;
46 const Property::Index TextActor::SHADOW_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 11;
47 const Property::Index TextActor::SHADOW_OFFSET = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 12;
48 const Property::Index TextActor::ITALICS_ANGLE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 13;
49 const Property::Index TextActor::UNDERLINE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 14;
50 const Property::Index TextActor::WEIGHT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 15;
51 const Property::Index TextActor::FONT_DETECTION_AUTOMATIC = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 16;
52 const Property::Index TextActor::GRADIENT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 17;
53 const Property::Index TextActor::GRADIENT_START_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 18;
54 const Property::Index TextActor::GRADIENT_END_POINT = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 19;
55 const Property::Index TextActor::SHADOW_SIZE = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 20;
56 const Property::Index TextActor::TEXT_COLOR = Internal::DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT + 21;
61 const std::string DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[] =
68 "outline-thickness-width",
79 "font-detection-automatic",
81 "gradient-start-point",
86 const int DEFAULT_TEXT_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES ) / sizeof( std::string );
88 const Property::Type DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[DEFAULT_TEXT_ACTOR_PROPERTY_COUNT] =
90 Property::STRING, // "text"
91 Property::STRING, // "font"
92 Property::STRING, // "font-style"
93 Property::BOOLEAN, // "outline-enable"
94 Property::VECTOR4, // "outline-color"
95 Property::VECTOR2, // "outline-thickness-width"
96 Property::FLOAT, // "smooth-edge"
97 Property::BOOLEAN, // "glow-enable"
98 Property::VECTOR4, // "glow-color"
99 Property::FLOAT, // "glow-intensity"
100 Property::BOOLEAN, // "shadow-enable"
101 Property::VECTOR4, // "shadow-color"
102 Property::VECTOR2, // "shadow-offset"
103 Property::FLOAT, // "italics-angle"
104 Property::BOOLEAN, // "underline"
105 Property::INTEGER, // "weight"
106 Property::BOOLEAN, // "font-detection-automatic"
107 Property::VECTOR4, // "gradient-color",
108 Property::VECTOR2, // "gradient-start-point",
109 Property::VECTOR2, // "gradient-end-point"
110 Property::FLOAT, // "shadow-size"
111 Property::VECTOR4, // "text-color",
118 bool TextActor::mFirstInstance = true;
119 Actor::DefaultPropertyLookup* TextActor::mDefaultTextActorPropertyLookup = NULL;
126 return Dali::TextActor::New();
129 TypeRegistration mType( typeid(Dali::TextActor), typeid(Dali::RenderableActor), Create );
131 SignalConnectorType s1( mType, Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED, &TextActor::DoConnectSignal );
135 TextActorPtr TextActor::New(const Dali::Text& text, bool fontDetection, bool isLeftToRight)
137 Dali::Font font( Dali::Font::New() );
138 return New( text, fontDetection, isLeftToRight, GetImplementation( font ) );
141 TextActorPtr TextActor::New(const Dali::Text& text, bool fontDetection, bool isLeftToRight, Font& font )
143 // first stage construction
144 TextActorPtr actor ( new TextActor( fontDetection, isLeftToRight ) );
146 FontPointer fontPtr(&font);
148 // Second-phase construction
151 //create the attachment
152 actor->mTextAttachment = TextAttachment::New( *actor->mNode, TextArray(), fontPtr, isLeftToRight);
154 actor->SetText( text );
159 TextActorPtr TextActor::New(const Dali::Text& text, bool fontDetection, bool isLeftToRight, const Dali::TextStyle& style )
161 // first stage construction
162 TextActorPtr actor ( new TextActor( fontDetection, isLeftToRight ) );
164 FontPointer fontPtr( Font::New(style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) );
166 // Second-phase construction
169 //create the attachment
170 actor->mTextAttachment = TextAttachment::New( *actor->mNode, TextArray(), fontPtr, isLeftToRight );
172 // Note: SetTextStyle() MUST be called before SetText(), to ensure
173 // that a single ResourceRequest for the glyphs is made. Calling
174 // them in the wrong order will issue two requests.
175 actor->SetTextStyle( style, DONT_REQUEST_NEW_TEXT );
177 actor->SetText( text );
182 TextActor::TextActor(bool fontDetection, bool isLeftToRight)
184 mLoadingState(Dali::ResourceLoading),
185 mUsingNaturalSize(true),
186 mInternalSetSize(false),
187 mFontDetection(fontDetection),
188 mIsLeftToRight(isLeftToRight),
193 void TextActor::OnInitialize()
195 if(TextActor::mFirstInstance)
197 mDefaultTextActorPropertyLookup = new DefaultPropertyLookup();
198 const int start = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
199 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
201 (*mDefaultTextActorPropertyLookup)[DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[i]] = i + start;
203 TextActor::mFirstInstance = false ;
207 TextActor::~TextActor()
209 StopObservingTextLoads();
212 const std::string TextActor::GetText() const
214 const TextArray& utfCodes = mTextAttachment->GetText();
218 // minimize allocations for ascii strings
219 text.reserve(utfCodes.size());
221 for (unsigned int i = 0; i < utfCodes.size(); ++i)
223 unsigned char utf8Data[4];
224 unsigned int utf8Length;
226 utf8Length = UTF8Write(utfCodes[i], utf8Data);
228 text.append(reinterpret_cast<const char*>(utf8Data), utf8Length);
234 void TextActor::SetText(const std::string& text)
240 // minimize allocations for ascii strings
241 utfCodes.reserve(text.size());
243 // break string into UTF-8 tokens
244 UTF8Tokenize(reinterpret_cast<const unsigned char*>(text.c_str()), text.size(), utfCodes);
250 Font* TextActor::GetFont() const
252 return &mTextAttachment->GetFont();
255 void TextActor::SetText(const Dali::Text& text)
259 if( !text.IsEmpty() )
261 utfCodes = text.GetImplementation().GetTextArray();
267 void TextActor::SetToNaturalSize()
269 // ignore size set by application
270 mUsingNaturalSize = true;
271 TextChanged(); // this will calculate natural size
274 void TextActor::StopObservingTextLoads()
278 mTextAttachment->GetFont().RemoveObserver( *this );
283 void TextActor::StartObservingTextLoads()
287 mTextAttachment->GetFont().AddObserver( *this );
292 void TextActor::SetText(const TextArray& utfCodes)
294 StopObservingTextLoads();
296 // assign the new text
297 mTextAttachment->SetText(utfCodes);
301 // first check if the provided font supports the text
303 if( !mTextAttachment->GetFont().AllGlyphsSupported(utfCodes) )
306 // @todo GetFamilyForText should return font name and style
307 const std::string fontName = Font::GetFamilyForText(utfCodes);
309 // use previous formatting
310 Internal::Font& font = mTextAttachment->GetFont();
312 Dali::Font fontNew = Dali::Font::New( Dali::FontParameters( fontName, font.GetStyle(), PointSize(font.GetPointSize() ) ) );
314 SetFont( GetImplementation(fontNew), DONT_REQUEST_NEW_TEXT );
321 void TextActor::SetFont(Font& font, TextRequestMode mode )
323 StopObservingTextLoads();
325 if( mode == REQUEST_NEW_TEXT )
328 mTextAttachment->SetFont( font );
330 // request text for new font
336 mTextAttachment->SetFont( font );
340 void TextActor::OnSizeSet(const Vector3& targetSize)
342 if( !mInternalSetSize )
344 // after size is once set by application we no longer use the natural size
345 mUsingNaturalSize = false;
349 void TextActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
351 // after size has been animated by application we no longer use the natural size
352 mUsingNaturalSize = false;
355 RenderableAttachment& TextActor::GetRenderableAttachment() const
357 DALI_ASSERT_DEBUG( mTextAttachment );
358 return *mTextAttachment;
361 void TextActor::SetGradientColor( const Vector4& color )
363 mTextAttachment->SetGradient( color, mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
366 const Vector4& TextActor::GetGradientColor() const
368 return mTextAttachment->GetGradientColor();
371 void TextActor::SetGradientStartPoint( const Vector2& position )
373 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), position, mTextAttachment->GetGradientEndPoint() );
376 const Vector2& TextActor::GetGradientStartPoint() const
378 return mTextAttachment->GetGradientStartPoint();
381 void TextActor::SetGradientEndPoint( const Vector2& position )
383 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), position );
386 const Vector2& TextActor::GetGradientEndPoint() const
388 return mTextAttachment->GetGradientEndPoint();
391 void TextActor::SetGradient( const Vector4& color, const Vector2& startPoint, const Vector2& endPoint )
393 mTextAttachment->SetGradient( color, startPoint, endPoint );
396 void TextActor::SetTextStyle( const TextStyle& style, TextRequestMode mode )
399 const Font& font = mTextAttachment->GetFont();
401 // Determine the font name/style/size that Font would create.
402 // Then compare this to the existing font (which has been validated by Font).
404 std::string resolvedFontName = style.GetFontName();
405 std::string resolvedFontStyle = style.GetFontStyle();
406 float resolvedFontPointSize = style.GetFontPointSize();
407 bool resolvedFontFamilyDefault(false);
408 bool resolvedFontPointSizeDefault(false);
410 Font::ValidateFontRequest( resolvedFontName,
412 resolvedFontPointSize,
413 resolvedFontFamilyDefault,
414 resolvedFontPointSizeDefault );
416 // Now compare to existing font used to see if a font change is necessary.
417 if( ( font.GetName() != resolvedFontName ) ||
418 ( font.GetStyle() != resolvedFontStyle ) ||
419 ( fabsf(font.GetPointSize() - resolvedFontPointSize) >= GetRangedEpsilon(font.GetPointSize(), resolvedFontPointSize) ) )
421 // Create font with original request (so font can determine if family and/or point size is default)
422 SetFont( *(Font::New( style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) ), mode );
426 if( !style.IsTextColorDefault() )
428 SetTextColor( style.GetTextColor() );
432 mTextAttachment->ResetTextColor();
436 if( !style.IsItalicsDefault() )
438 SetItalics( style.IsItalicsEnabled() ? Radian( style.GetItalicsAngle() ) : Radian( 0.0f ) );
442 mTextAttachment->ResetItalics();
446 if( !style.IsUnderlineDefault() )
448 SetUnderline( style.IsUnderlineEnabled(), style.GetUnderlineThickness(), style.GetUnderlinePosition() );
452 mTextAttachment->ResetUnderline();
456 if( !style.IsShadowDefault() )
458 SetShadow( style.IsShadowEnabled(), style.GetShadowColor(), style.GetShadowOffset(), style.GetShadowSize() );
462 mTextAttachment->ResetShadow();
466 if( !style.IsGlowDefault() )
468 SetGlow( style.IsGlowEnabled(), style.GetGlowColor(), style.GetGlowIntensity() );
472 mTextAttachment->ResetGlow();
476 if( !style.IsSmoothEdgeDefault() )
478 SetSmoothEdge( style.GetSmoothEdge() );
482 mTextAttachment->ResetSmoothEdge();
486 if( !style.IsOutlineDefault() )
488 SetOutline( style.IsOutlineEnabled(), style.GetOutlineColor(), style.GetOutlineThickness() );
492 mTextAttachment->ResetOutline();
496 if( !style.IsFontWeightDefault() )
498 SetWeight( style.GetWeight() );
502 mTextAttachment->ResetWeight();
506 if( !style.IsGradientDefault() )
508 if( style.IsGradientEnabled() )
510 SetGradient( style.GetGradientColor(), style.GetGradientStartPoint(), style.GetGradientEndPoint() );
514 SetGradient( TextStyle::DEFAULT_GRADIENT_COLOR, TextStyle::DEFAULT_GRADIENT_START_POINT, TextStyle::DEFAULT_GRADIENT_END_POINT );
519 mTextAttachment->ResetGradient();
523 TextStyle TextActor::GetTextStyle() const
526 mTextAttachment->GetTextStyle( textStyle );
531 void TextActor::SetTextColor(const Vector4& color)
533 mTextAttachment->SetTextColor( color );
536 Vector4 TextActor::GetTextColor() const
538 return mTextAttachment->GetTextColor();
541 void TextActor::SetSmoothEdge( float smoothEdge )
543 mTextAttachment->SetSmoothEdge(smoothEdge);
546 void TextActor::SetOutline( bool enable, const Vector4& color, const Vector2& offset )
548 mTextAttachment->SetOutline(enable, color, offset);
551 void TextActor::SetGlow( bool enable, const Vector4& color, float intensity )
553 mTextAttachment->SetGlow(enable, color, intensity);
556 void TextActor::SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size )
558 mTextAttachment->SetShadow(enable, color, offset, size);
561 void TextActor::SetItalics( Radian angle )
563 mTextAttachment->SetItalics( angle );
568 bool TextActor::GetItalics() const
570 return mTextAttachment->GetItalics();
573 Radian TextActor::GetItalicsAngle() const
575 return mTextAttachment->GetItalicsAngle();
578 void TextActor::SetUnderline( bool enable, float thickness, float position )
580 mTextAttachment->SetUnderline( enable, thickness, position );
585 bool TextActor::GetUnderline() const
587 return mTextAttachment->GetUnderline();
590 float TextActor::GetUnderlineThickness() const
592 return mTextAttachment->GetUnderlineThickness();
595 float TextActor::GetUnderlinePosition() const
597 return mTextAttachment->GetUnderlinePosition();
600 void TextActor::SetWeight( TextStyle::Weight weight )
602 mTextAttachment->SetWeight( weight );
605 TextStyle::Weight TextActor::GetWeight() const
607 return mTextAttachment->GetWeight();
610 void TextActor::SetFontDetectionAutomatic(bool value)
612 mFontDetection = value;
615 bool TextActor::IsFontDetectionAutomatic() const
617 return mFontDetection;
620 bool TextActor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
622 bool connected( true );
623 TextActor* textActor = dynamic_cast<TextActor*>(object);
625 if( Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED == signalName )
627 textActor->TextAvailableSignal().Connect( tracker, functor );
631 // signalName does not match any signal
638 void TextActor::TextLoaded()
640 // if the text is loaded, trigger the loaded finished signal
641 CheckTextLoadState();
644 void TextActor::TextChanged()
646 // this will tell the text attachment to act on any text or font changes
647 mTextAttachment->TextChanged();
649 // check the loading state
650 bool loaded = CheckTextLoadState();
653 mLoadingState = Dali::ResourceLoading;
655 StartObservingTextLoads();
657 // the text natural size is calculated synchronously above, when TextChanged() is called
658 if (mUsingNaturalSize)
660 mInternalSetSize = true; // to know we're internally setting size
661 SetSize( mTextAttachment->GetNaturalTextSize() );
662 mInternalSetSize = false;
666 bool TextActor::CheckTextLoadState()
668 if( mTextAttachment->IsTextLoaded() )
670 mLoadingState = Dali::ResourceLoadingSucceeded;
672 StopObservingTextLoads();
674 // emit text available signal
676 mLoadingFinishedV2.Emit( Dali::TextActor( this ) );
685 unsigned int TextActor::GetDefaultPropertyCount() const
687 return RenderableActor::GetDefaultPropertyCount() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT;
690 void TextActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
692 RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
694 indices.reserve( indices.size() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT );
696 int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
697 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i, ++index )
699 indices.push_back( index );
703 const std::string& TextActor::GetDefaultPropertyName( Property::Index index ) const
705 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
707 return RenderableActor::GetDefaultPropertyName(index) ;
711 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
713 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
715 return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index];
719 // index out-of-bounds
720 static const std::string INVALID_PROPERTY_NAME;
721 return INVALID_PROPERTY_NAME;
726 Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
728 Property::Index index = Property::INVALID_INDEX;
730 DALI_ASSERT_DEBUG( NULL != mDefaultTextActorPropertyLookup );
732 // Look for name in current class' default properties
733 DefaultPropertyLookup::const_iterator result = mDefaultTextActorPropertyLookup->find( name );
734 if ( mDefaultTextActorPropertyLookup->end() != result )
736 index = result->second;
740 // If not found, check in base class
741 index = RenderableActor::GetDefaultPropertyIndex( name );
747 bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
749 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
751 return RenderableActor::IsDefaultPropertyWritable(index) ;
759 bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
761 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
763 return RenderableActor::IsDefaultPropertyAnimatable(index) ;
771 bool TextActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
773 if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
775 return RenderableActor::IsDefaultPropertyAConstraintInput(index);
777 return true; // Our properties can be used as input to constraints.
780 Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
782 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
784 return RenderableActor::GetDefaultPropertyType(index) ;
788 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
790 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
792 return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index];
796 // index out-of-bounds
797 return Property::NONE;
802 void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
804 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
806 RenderableActor::SetDefaultProperty(index, propertyValue) ;
812 case Dali::TextActor::TEXT:
814 SetText(propertyValue.Get<std::string>());
817 case Dali::TextActor::FONT:
819 SetFont(*Font::New(propertyValue.Get<std::string>(),
820 mTextAttachment->GetFont().GetStyle(),
821 PointSize(mTextAttachment->GetFont().GetPointSize())));
824 case Dali::TextActor::FONT_STYLE:
826 SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
827 propertyValue.Get<std::string>(),
828 PointSize(mTextAttachment->GetFont().GetPointSize())));
831 case Dali::TextActor::OUTLINE_ENABLE:
835 mTextAttachment->GetOutlineParams( color, thickness );
836 mTextAttachment->SetOutline(propertyValue.Get<bool>(), color, thickness);
839 case Dali::TextActor::OUTLINE_COLOR:
843 mTextAttachment->GetOutlineParams( color, thickness );
844 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get<Vector4>(), thickness);
847 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
851 mTextAttachment->GetOutlineParams( color, thickness );
852 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get<Vector2>());
855 case Dali::TextActor::SMOOTH_EDGE:
857 mTextAttachment->SetSmoothEdge( propertyValue.Get<float>());
860 case Dali::TextActor::GLOW_ENABLE:
864 mTextAttachment->GetGlowParams( color, intensity );
865 mTextAttachment->SetGlow(propertyValue.Get<bool>(), color, intensity);
868 case Dali::TextActor::GLOW_COLOR:
872 mTextAttachment->GetGlowParams( color, intensity );
873 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get<Vector4>(), intensity);
876 case Dali::TextActor::GLOW_INTENSITY:
880 mTextAttachment->GetGlowParams( color, intensity );
881 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get<float>());
884 case Dali::TextActor::SHADOW_ENABLE:
889 mTextAttachment->GetShadowParams( color, offset, size );
890 mTextAttachment->SetShadow(propertyValue.Get<bool>(), color, offset, size );
893 case Dali::TextActor::SHADOW_COLOR:
898 mTextAttachment->GetShadowParams( color, offset, size );
899 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get<Vector4>(), offset, size);
902 case Dali::TextActor::SHADOW_OFFSET:
907 mTextAttachment->GetShadowParams( color, offset, size );
908 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get<Vector2>(), size );
911 case Dali::TextActor::SHADOW_SIZE:
916 mTextAttachment->GetShadowParams( color, offset, size );
917 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get<float>());
920 case Dali::TextActor::ITALICS_ANGLE:
922 SetItalics(Radian(propertyValue.Get<float>())) ;
925 case Dali::TextActor::UNDERLINE:
927 SetUnderline(propertyValue.Get<bool>(), 0.f, 0.f ) ;
930 case Dali::TextActor::WEIGHT:
932 mTextAttachment->SetWeight(static_cast<TextStyle::Weight>(propertyValue.Get<int>())) ;
935 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
937 mFontDetection = propertyValue.Get<bool>() ;
940 case Dali::TextActor::GRADIENT_COLOR:
942 mTextAttachment->SetGradient( propertyValue.Get<Vector4>(), mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
945 case Dali::TextActor::GRADIENT_START_POINT:
947 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), propertyValue.Get<Vector2>(), mTextAttachment->GetGradientEndPoint() );
950 case Dali::TextActor::GRADIENT_END_POINT:
952 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), propertyValue.Get<Vector2>() );
955 case Dali::TextActor::TEXT_COLOR:
957 mTextAttachment->SetTextColor( propertyValue.Get<Vector4>() );
962 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
970 Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
972 Property::Value ret ;
973 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
975 ret = RenderableActor::GetDefaultProperty(index) ;
981 case Dali::TextActor::TEXT:
986 case Dali::TextActor::FONT:
988 ret = mTextAttachment->GetFont().GetName();
991 case Dali::TextActor::FONT_STYLE:
993 ret = mTextAttachment->GetFont().GetStyle();
996 case Dali::TextActor::OUTLINE_ENABLE:
998 ret = mTextAttachment->GetOutline();
1001 case Dali::TextActor::OUTLINE_COLOR:
1005 mTextAttachment->GetOutlineParams( color, thickness );
1009 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
1013 mTextAttachment->GetOutlineParams( color, thickness );
1017 case Dali::TextActor::SMOOTH_EDGE:
1019 ret = mTextAttachment->GetSmoothEdge();
1022 case Dali::TextActor::GLOW_ENABLE:
1024 ret = mTextAttachment->GetGlow();
1027 case Dali::TextActor::GLOW_COLOR:
1030 float intensity(0.0f);
1031 mTextAttachment->GetGlowParams( color, intensity );
1035 case Dali::TextActor::GLOW_INTENSITY:
1038 float intensity(0.0f);
1039 mTextAttachment->GetGlowParams( color, intensity );
1043 case Dali::TextActor::SHADOW_ENABLE:
1045 ret = mTextAttachment->GetShadow();
1048 case Dali::TextActor::SHADOW_COLOR:
1053 mTextAttachment->GetShadowParams( color, offset, size );
1057 case Dali::TextActor::SHADOW_OFFSET:
1062 mTextAttachment->GetShadowParams( color, offset, size );
1066 case Dali::TextActor::SHADOW_SIZE:
1071 mTextAttachment->GetShadowParams( color, offset, size );
1075 case Dali::TextActor::ITALICS_ANGLE:
1077 ret = static_cast<float>(mTextAttachment->GetItalics()) ;
1080 case Dali::TextActor::UNDERLINE:
1082 ret = mTextAttachment->GetUnderline() ;
1085 case Dali::TextActor::WEIGHT:
1087 ret = static_cast<int>(mTextAttachment->GetWeight());
1090 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
1092 ret = mFontDetection;
1095 case Dali::TextActor::GRADIENT_COLOR:
1097 ret = mTextAttachment->GetGradientColor();
1100 case Dali::TextActor::GRADIENT_START_POINT:
1102 ret = mTextAttachment->GetGradientStartPoint();
1105 case Dali::TextActor::GRADIENT_END_POINT:
1107 ret = mTextAttachment->GetGradientEndPoint();
1110 case Dali::TextActor::TEXT_COLOR:
1112 ret = mTextAttachment->GetTextColor();
1117 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
1121 } // if from base class
1126 } // namespace Internal