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;
64 const char* const SIGNAL_TEXT_LOADING_FINISHED = "text-loading-finished";
66 // Default property names
68 const char* DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[] =
75 "outline-thickness-width",
86 "font-detection-automatic",
88 "gradient-start-point",
93 const int DEFAULT_TEXT_ACTOR_PROPERTY_COUNT = sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES ) / sizeof( DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[0] );
95 const Property::Type DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[DEFAULT_TEXT_ACTOR_PROPERTY_COUNT] =
97 Property::STRING, // "text"
98 Property::STRING, // "font"
99 Property::STRING, // "font-style"
100 Property::BOOLEAN, // "outline-enable"
101 Property::VECTOR4, // "outline-color"
102 Property::VECTOR2, // "outline-thickness-width"
103 Property::FLOAT, // "smooth-edge"
104 Property::BOOLEAN, // "glow-enable"
105 Property::VECTOR4, // "glow-color"
106 Property::FLOAT, // "glow-intensity"
107 Property::BOOLEAN, // "shadow-enable"
108 Property::VECTOR4, // "shadow-color"
109 Property::VECTOR2, // "shadow-offset"
110 Property::FLOAT, // "italics-angle"
111 Property::BOOLEAN, // "underline"
112 Property::INTEGER, // "weight"
113 Property::BOOLEAN, // "font-detection-automatic"
114 Property::VECTOR4, // "gradient-color",
115 Property::VECTOR2, // "gradient-start-point",
116 Property::VECTOR2, // "gradient-end-point"
117 Property::FLOAT, // "shadow-size"
118 Property::VECTOR4, // "text-color",
131 return Dali::TextActor::New();
134 TypeRegistration mType( typeid(Dali::TextActor), typeid(Dali::RenderableActor), Create );
136 SignalConnectorType s1( mType, SIGNAL_TEXT_LOADING_FINISHED, &TextActor::DoConnectSignal );
140 TextActorPtr TextActor::New( const Integration::TextArray& utfCodes, const TextActorParameters& parameters )
142 // first stage construction
143 TextActorPtr actor ( new TextActor( parameters.IsAutomaticFontDetectionEnabled() ) );
145 const TextStyle& style = parameters.GetTextStyle();
147 FontPointer fontPtr( Font::New(style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) );
149 // Second-phase construction
152 //create the attachment
153 actor->mTextAttachment = TextAttachment::New( *actor->mStage, *actor->mNode, Integration::TextArray(), fontPtr );
154 actor->Attach(*actor->mTextAttachment);
156 // Note: SetTextStyle() MUST be called before SetText(), to ensure
157 // that a single ResourceRequest for the glyphs is made. Calling
158 // them in the wrong order will issue two requests.
159 actor->SetTextStyle( style, DONT_REQUEST_NEW_TEXT );
161 actor->SetText( utfCodes );
166 TextActor::TextActor(bool fontDetection)
168 mLoadingState(Dali::ResourceLoading),
169 mUsingNaturalSize(true),
170 mInternalSetSize(false),
171 mFontDetection(fontDetection),
176 void TextActor::OnInitialize()
180 TextActor::~TextActor()
182 StopObservingTextLoads();
185 const std::string TextActor::GetText() const
187 const Integration::TextArray& utfCodes = mTextAttachment->GetText();
191 const std::size_t length = utfCodes.Count();
192 // minimize allocations for ascii strings
193 text.reserve( length );
195 for (unsigned int i = 0; i < length; ++i)
197 unsigned char utf8Data[4];
198 unsigned int utf8Length;
200 utf8Length = UTF8Write(utfCodes[i], utf8Data);
202 text.append(reinterpret_cast<const char*>(utf8Data), utf8Length);
208 Font* TextActor::GetFont() const
210 return &mTextAttachment->GetFont();
213 void TextActor::SetToNaturalSize()
215 // ignore size set by application
216 mUsingNaturalSize = true;
217 TextChanged(); // this will calculate natural size
220 void TextActor::StopObservingTextLoads()
224 mTextAttachment->GetFont().RemoveObserver( *this );
229 void TextActor::StartObservingTextLoads()
233 mTextAttachment->GetFont().AddObserver( *this );
238 void TextActor::SetText(const Integration::TextArray& utfCodes)
240 StopObservingTextLoads();
242 // assign the new text
243 mTextAttachment->SetText(utfCodes);
247 // first check if the provided font supports the text
249 if( !mTextAttachment->GetFont().AllGlyphsSupported(utfCodes) )
252 // @todo GetFamilyForText should return font name and style
253 const std::string fontName = Font::GetFamilyForText(utfCodes);
255 // use previous formatting
256 Internal::Font& font = mTextAttachment->GetFont();
258 Dali::Font fontNew = Dali::Font::New( Dali::FontParameters( fontName, font.GetStyle(), PointSize(font.GetPointSize() ) ) );
260 SetFont( GetImplementation(fontNew), DONT_REQUEST_NEW_TEXT );
267 void TextActor::SetFont(Font& font, TextRequestMode mode )
269 StopObservingTextLoads();
271 if( mode == REQUEST_NEW_TEXT )
274 mTextAttachment->SetFont( font );
276 // request text for new font
282 mTextAttachment->SetFont( font );
286 Vector3 TextActor::GetNaturalSize() const
288 Vector2 naturalSize( mTextAttachment->GetNaturalTextSize() );
289 return Vector3( naturalSize.width, naturalSize.height, CalculateSizeZ( naturalSize ) );
292 void TextActor::OnSizeSet(const Vector3& targetSize)
294 if( !mInternalSetSize )
296 // after size is once set by application we no longer use the natural size
297 mUsingNaturalSize = false;
301 void TextActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
303 // after size has been animated by application we no longer use the natural size
304 mUsingNaturalSize = false;
307 RenderableAttachment& TextActor::GetRenderableAttachment() const
309 DALI_ASSERT_DEBUG( mTextAttachment );
310 return *mTextAttachment;
313 void TextActor::SetGradientColor( const Vector4& color )
315 mTextAttachment->SetGradient( color, mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
318 const Vector4& TextActor::GetGradientColor() const
320 return mTextAttachment->GetGradientColor();
323 void TextActor::SetGradientStartPoint( const Vector2& position )
325 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), position, mTextAttachment->GetGradientEndPoint() );
328 const Vector2& TextActor::GetGradientStartPoint() const
330 return mTextAttachment->GetGradientStartPoint();
333 void TextActor::SetGradientEndPoint( const Vector2& position )
335 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), position );
338 const Vector2& TextActor::GetGradientEndPoint() const
340 return mTextAttachment->GetGradientEndPoint();
343 void TextActor::SetGradient( const Vector4& color, const Vector2& startPoint, const Vector2& endPoint )
345 mTextAttachment->SetGradient( color, startPoint, endPoint );
348 void TextActor::SetTextStyle( const TextStyle& style, TextRequestMode mode )
351 const Font& font = mTextAttachment->GetFont();
353 // Determine the font name/style/size that Font would create.
354 // Then compare this to the existing font (which has been validated by Font).
356 std::string resolvedFontName = style.GetFontName();
357 std::string resolvedFontStyle = style.GetFontStyle();
358 float resolvedFontPointSize = style.GetFontPointSize();
359 bool resolvedFontFamilyDefault(false);
360 bool resolvedFontPointSizeDefault(false);
362 Font::ValidateFontRequest( resolvedFontName,
364 resolvedFontPointSize,
365 resolvedFontFamilyDefault,
366 resolvedFontPointSizeDefault );
368 // Now compare to existing font used to see if a font change is necessary.
369 if( ( font.GetName() != resolvedFontName ) ||
370 ( font.GetStyle() != resolvedFontStyle ) ||
371 ( fabsf(font.GetPointSize() - resolvedFontPointSize) >= GetRangedEpsilon(font.GetPointSize(), resolvedFontPointSize) ) )
373 // Create font with original request (so font can determine if family and/or point size is default)
374 SetFont( *(Font::New( style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) ), mode );
378 if( !style.IsTextColorDefault() )
380 SetTextColor( style.GetTextColor() );
384 mTextAttachment->ResetTextColor();
388 if( !style.IsItalicsDefault() )
390 SetItalics( style.IsItalicsEnabled() ? Radian( style.GetItalicsAngle() ) : Radian( 0.0f ) );
394 mTextAttachment->ResetItalics();
398 if( !style.IsUnderlineDefault() )
400 SetUnderline( style.IsUnderlineEnabled(), style.GetUnderlineThickness(), style.GetUnderlinePosition() );
404 mTextAttachment->ResetUnderline();
408 if( !style.IsShadowDefault() )
410 SetShadow( style.IsShadowEnabled(), style.GetShadowColor(), style.GetShadowOffset(), style.GetShadowSize() );
414 mTextAttachment->ResetShadow();
418 if( !style.IsGlowDefault() )
420 SetGlow( style.IsGlowEnabled(), style.GetGlowColor(), style.GetGlowIntensity() );
424 mTextAttachment->ResetGlow();
428 if( !style.IsSmoothEdgeDefault() )
430 SetSmoothEdge( style.GetSmoothEdge() );
434 mTextAttachment->ResetSmoothEdge();
438 if( !style.IsOutlineDefault() )
440 SetOutline( style.IsOutlineEnabled(), style.GetOutlineColor(), style.GetOutlineThickness() );
444 mTextAttachment->ResetOutline();
448 if( !style.IsFontWeightDefault() )
450 SetWeight( style.GetWeight() );
454 mTextAttachment->ResetWeight();
458 if( !style.IsGradientDefault() )
460 if( style.IsGradientEnabled() )
462 SetGradient( style.GetGradientColor(), style.GetGradientStartPoint(), style.GetGradientEndPoint() );
466 SetGradient( TextStyle::DEFAULT_GRADIENT_COLOR, TextStyle::DEFAULT_GRADIENT_START_POINT, TextStyle::DEFAULT_GRADIENT_END_POINT );
471 mTextAttachment->ResetGradient();
476 TextStyle TextActor::GetTextStyle() const
479 mTextAttachment->GetTextStyle( textStyle );
484 void TextActor::SetTextColor(const Vector4& color)
486 mTextAttachment->SetTextColor( color );
489 Vector4 TextActor::GetTextColor() const
491 return mTextAttachment->GetTextColor();
494 void TextActor::SetSmoothEdge( float smoothEdge )
496 mTextAttachment->SetSmoothEdge(smoothEdge);
499 void TextActor::SetOutline( bool enable, const Vector4& color, const Vector2& offset )
501 mTextAttachment->SetOutline(enable, color, offset);
504 void TextActor::SetGlow( bool enable, const Vector4& color, float intensity )
506 mTextAttachment->SetGlow(enable, color, intensity);
509 void TextActor::SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size )
511 mTextAttachment->SetShadow(enable, color, offset, size);
514 void TextActor::SetItalics( Radian angle )
516 mTextAttachment->SetItalics( angle );
521 bool TextActor::GetItalics() const
523 return mTextAttachment->GetItalics();
526 Radian TextActor::GetItalicsAngle() const
528 return mTextAttachment->GetItalicsAngle();
531 void TextActor::SetUnderline( bool enable, float thickness, float position )
533 mTextAttachment->SetUnderline( enable, thickness, position );
538 bool TextActor::GetUnderline() const
540 return mTextAttachment->GetUnderline();
543 float TextActor::GetUnderlineThickness() const
545 return mTextAttachment->GetUnderlineThickness();
548 float TextActor::GetUnderlinePosition() const
550 return mTextAttachment->GetUnderlinePosition();
553 void TextActor::SetWeight( TextStyle::Weight weight )
555 mTextAttachment->SetWeight( weight );
558 TextStyle::Weight TextActor::GetWeight() const
560 return mTextAttachment->GetWeight();
563 void TextActor::SetFontDetectionAutomatic(bool value)
565 mFontDetection = value;
568 bool TextActor::IsFontDetectionAutomatic() const
570 return mFontDetection;
573 bool TextActor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
575 bool connected( true );
576 TextActor* textActor = dynamic_cast<TextActor*>(object);
578 if( 0 == strcmp( signalName.c_str(), SIGNAL_TEXT_LOADING_FINISHED ) )
580 textActor->TextAvailableSignal().Connect( tracker, functor );
584 // signalName does not match any signal
591 void TextActor::TextLoaded()
593 // if the text is loaded, trigger the loaded finished signal
594 CheckTextLoadState();
597 void TextActor::TextChanged()
599 // this will tell the text attachment to act on any text or font changes
600 mTextAttachment->TextChanged();
602 // check the loading state
603 bool loaded = CheckTextLoadState();
606 mLoadingState = Dali::ResourceLoading;
608 StartObservingTextLoads();
610 // the text natural size is calculated synchronously above, when TextChanged() is called
611 if (mUsingNaturalSize)
613 mInternalSetSize = true; // to know we're internally setting size
614 SetSize( mTextAttachment->GetNaturalTextSize() );
615 mInternalSetSize = false;
619 bool TextActor::CheckTextLoadState()
621 if( mTextAttachment->IsTextLoaded() )
623 mLoadingState = Dali::ResourceLoadingSucceeded;
625 StopObservingTextLoads();
627 // emit text available signal
629 mLoadingFinished.Emit( Dali::TextActor( this ) );
638 unsigned int TextActor::GetDefaultPropertyCount() const
640 return RenderableActor::GetDefaultPropertyCount() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT;
643 void TextActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
645 RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
647 indices.reserve( indices.size() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT );
649 int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
650 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i, ++index )
652 indices.push_back( index );
656 const char* TextActor::GetDefaultPropertyName( Property::Index index ) const
658 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
660 return RenderableActor::GetDefaultPropertyName(index) ;
664 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
666 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
668 return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index];
677 Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
679 Property::Index index = Property::INVALID_INDEX;
681 // Look for name in default properties
682 for( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
684 if( 0 == strcmp( name.c_str(), DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[ i ] ) ) // dont want to convert rhs to string
686 index = i + DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
691 // If not found, check in base class
692 if( Property::INVALID_INDEX == index )
694 index = RenderableActor::GetDefaultPropertyIndex( name );
700 bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
702 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
704 return RenderableActor::IsDefaultPropertyWritable(index) ;
712 bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
714 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
716 return RenderableActor::IsDefaultPropertyAnimatable(index) ;
724 bool TextActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
726 if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
728 return RenderableActor::IsDefaultPropertyAConstraintInput(index);
730 return true; // Our properties can be used as input to constraints.
733 Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
735 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
737 return RenderableActor::GetDefaultPropertyType(index) ;
741 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
743 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
745 return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index];
749 // index out-of-bounds
750 return Property::NONE;
755 void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
757 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
759 RenderableActor::SetDefaultProperty(index, propertyValue) ;
765 case Dali::TextActor::TEXT:
767 SetText( GetTextArray( Dali::Text( propertyValue.Get<std::string>() ) ) );
770 case Dali::TextActor::FONT:
772 SetFont(*Font::New(propertyValue.Get<std::string>(),
773 mTextAttachment->GetFont().GetStyle(),
774 PointSize(mTextAttachment->GetFont().GetPointSize())));
777 case Dali::TextActor::FONT_STYLE:
779 SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
780 propertyValue.Get<std::string>(),
781 PointSize(mTextAttachment->GetFont().GetPointSize())));
784 case Dali::TextActor::OUTLINE_ENABLE:
788 mTextAttachment->GetOutlineParams( color, thickness );
789 mTextAttachment->SetOutline(propertyValue.Get<bool>(), color, thickness);
792 case Dali::TextActor::OUTLINE_COLOR:
796 mTextAttachment->GetOutlineParams( color, thickness );
797 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get<Vector4>(), thickness);
800 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
804 mTextAttachment->GetOutlineParams( color, thickness );
805 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get<Vector2>());
808 case Dali::TextActor::SMOOTH_EDGE:
810 mTextAttachment->SetSmoothEdge( propertyValue.Get<float>());
813 case Dali::TextActor::GLOW_ENABLE:
817 mTextAttachment->GetGlowParams( color, intensity );
818 mTextAttachment->SetGlow(propertyValue.Get<bool>(), color, intensity);
821 case Dali::TextActor::GLOW_COLOR:
825 mTextAttachment->GetGlowParams( color, intensity );
826 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get<Vector4>(), intensity);
829 case Dali::TextActor::GLOW_INTENSITY:
833 mTextAttachment->GetGlowParams( color, intensity );
834 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get<float>());
837 case Dali::TextActor::SHADOW_ENABLE:
842 mTextAttachment->GetShadowParams( color, offset, size );
843 mTextAttachment->SetShadow(propertyValue.Get<bool>(), color, offset, size );
846 case Dali::TextActor::SHADOW_COLOR:
851 mTextAttachment->GetShadowParams( color, offset, size );
852 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get<Vector4>(), offset, size);
855 case Dali::TextActor::SHADOW_OFFSET:
860 mTextAttachment->GetShadowParams( color, offset, size );
861 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get<Vector2>(), size );
864 case Dali::TextActor::SHADOW_SIZE:
869 mTextAttachment->GetShadowParams( color, offset, size );
870 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get<float>());
873 case Dali::TextActor::ITALICS_ANGLE:
875 SetItalics(Radian(propertyValue.Get<float>())) ;
878 case Dali::TextActor::UNDERLINE:
880 SetUnderline(propertyValue.Get<bool>(), 0.f, 0.f ) ;
883 case Dali::TextActor::WEIGHT:
885 mTextAttachment->SetWeight(static_cast<TextStyle::Weight>(propertyValue.Get<int>())) ;
888 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
890 mFontDetection = propertyValue.Get<bool>() ;
893 case Dali::TextActor::GRADIENT_COLOR:
895 mTextAttachment->SetGradient( propertyValue.Get<Vector4>(), mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
898 case Dali::TextActor::GRADIENT_START_POINT:
900 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), propertyValue.Get<Vector2>(), mTextAttachment->GetGradientEndPoint() );
903 case Dali::TextActor::GRADIENT_END_POINT:
905 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), propertyValue.Get<Vector2>() );
908 case Dali::TextActor::TEXT_COLOR:
910 mTextAttachment->SetTextColor( propertyValue.Get<Vector4>() );
915 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
923 Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
925 Property::Value ret ;
926 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
928 ret = RenderableActor::GetDefaultProperty(index) ;
934 case Dali::TextActor::TEXT:
939 case Dali::TextActor::FONT:
941 ret = mTextAttachment->GetFont().GetName();
944 case Dali::TextActor::FONT_STYLE:
946 ret = mTextAttachment->GetFont().GetStyle();
949 case Dali::TextActor::OUTLINE_ENABLE:
951 ret = mTextAttachment->GetOutline();
954 case Dali::TextActor::OUTLINE_COLOR:
958 mTextAttachment->GetOutlineParams( color, thickness );
962 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
966 mTextAttachment->GetOutlineParams( color, thickness );
970 case Dali::TextActor::SMOOTH_EDGE:
972 ret = mTextAttachment->GetSmoothEdge();
975 case Dali::TextActor::GLOW_ENABLE:
977 ret = mTextAttachment->GetGlow();
980 case Dali::TextActor::GLOW_COLOR:
983 float intensity(0.0f);
984 mTextAttachment->GetGlowParams( color, intensity );
988 case Dali::TextActor::GLOW_INTENSITY:
991 float intensity(0.0f);
992 mTextAttachment->GetGlowParams( color, intensity );
996 case Dali::TextActor::SHADOW_ENABLE:
998 ret = mTextAttachment->GetShadow();
1001 case Dali::TextActor::SHADOW_COLOR:
1006 mTextAttachment->GetShadowParams( color, offset, size );
1010 case Dali::TextActor::SHADOW_OFFSET:
1015 mTextAttachment->GetShadowParams( color, offset, size );
1019 case Dali::TextActor::SHADOW_SIZE:
1024 mTextAttachment->GetShadowParams( color, offset, size );
1028 case Dali::TextActor::ITALICS_ANGLE:
1030 ret = static_cast<float>(mTextAttachment->GetItalics()) ;
1033 case Dali::TextActor::UNDERLINE:
1035 ret = mTextAttachment->GetUnderline() ;
1038 case Dali::TextActor::WEIGHT:
1040 ret = static_cast<int>(mTextAttachment->GetWeight());
1043 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
1045 ret = mFontDetection;
1048 case Dali::TextActor::GRADIENT_COLOR:
1050 ret = mTextAttachment->GetGradientColor();
1053 case Dali::TextActor::GRADIENT_START_POINT:
1055 ret = mTextAttachment->GetGradientStartPoint();
1058 case Dali::TextActor::GRADIENT_END_POINT:
1060 ret = mTextAttachment->GetGradientEndPoint();
1063 case Dali::TextActor::TEXT_COLOR:
1065 ret = mTextAttachment->GetTextColor();
1070 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
1074 } // if from base class
1079 } // namespace Internal