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 );
150 actor->Attach(*actor->mTextAttachment);
152 // Note: SetTextStyle() MUST be called before SetText(), to ensure
153 // that a single ResourceRequest for the glyphs is made. Calling
154 // them in the wrong order will issue two requests.
155 actor->SetTextStyle( style, DONT_REQUEST_NEW_TEXT );
157 actor->SetText( utfCodes );
162 TextActor::TextActor(bool fontDetection)
164 mLoadingState(Dali::ResourceLoading),
165 mUsingNaturalSize(true),
166 mInternalSetSize(false),
167 mFontDetection(fontDetection),
172 void TextActor::OnInitialize()
174 if(TextActor::mFirstInstance)
176 mDefaultTextActorPropertyLookup = new DefaultPropertyLookup();
177 const int start = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
178 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i )
180 (*mDefaultTextActorPropertyLookup)[DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[i]] = i + start;
182 TextActor::mFirstInstance = false ;
186 TextActor::~TextActor()
188 StopObservingTextLoads();
191 const std::string TextActor::GetText() const
193 const Integration::TextArray& utfCodes = mTextAttachment->GetText();
197 const std::size_t length = utfCodes.Count();
198 // minimize allocations for ascii strings
199 text.reserve( length );
201 for (unsigned int i = 0; i < length; ++i)
203 unsigned char utf8Data[4];
204 unsigned int utf8Length;
206 utf8Length = UTF8Write(utfCodes[i], utf8Data);
208 text.append(reinterpret_cast<const char*>(utf8Data), utf8Length);
214 Font* TextActor::GetFont() const
216 return &mTextAttachment->GetFont();
219 void TextActor::SetToNaturalSize()
221 // ignore size set by application
222 mUsingNaturalSize = true;
223 TextChanged(); // this will calculate natural size
226 void TextActor::StopObservingTextLoads()
230 mTextAttachment->GetFont().RemoveObserver( *this );
235 void TextActor::StartObservingTextLoads()
239 mTextAttachment->GetFont().AddObserver( *this );
244 void TextActor::SetText(const Integration::TextArray& utfCodes)
246 StopObservingTextLoads();
248 // assign the new text
249 mTextAttachment->SetText(utfCodes);
253 // first check if the provided font supports the text
255 if( !mTextAttachment->GetFont().AllGlyphsSupported(utfCodes) )
258 // @todo GetFamilyForText should return font name and style
259 const std::string fontName = Font::GetFamilyForText(utfCodes);
261 // use previous formatting
262 Internal::Font& font = mTextAttachment->GetFont();
264 Dali::Font fontNew = Dali::Font::New( Dali::FontParameters( fontName, font.GetStyle(), PointSize(font.GetPointSize() ) ) );
266 SetFont( GetImplementation(fontNew), DONT_REQUEST_NEW_TEXT );
273 void TextActor::SetFont(Font& font, TextRequestMode mode )
275 StopObservingTextLoads();
277 if( mode == REQUEST_NEW_TEXT )
280 mTextAttachment->SetFont( font );
282 // request text for new font
288 mTextAttachment->SetFont( font );
292 Vector3 TextActor::GetNaturalSize() const
294 Vector2 naturalSize( mTextAttachment->GetNaturalTextSize() );
295 return Vector3( naturalSize.width, naturalSize.height, CalculateSizeZ( naturalSize ) );
298 void TextActor::OnSizeSet(const Vector3& targetSize)
300 if( !mInternalSetSize )
302 // after size is once set by application we no longer use the natural size
303 mUsingNaturalSize = false;
307 void TextActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize)
309 // after size has been animated by application we no longer use the natural size
310 mUsingNaturalSize = false;
313 RenderableAttachment& TextActor::GetRenderableAttachment() const
315 DALI_ASSERT_DEBUG( mTextAttachment );
316 return *mTextAttachment;
319 void TextActor::SetGradientColor( const Vector4& color )
321 mTextAttachment->SetGradient( color, mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
324 const Vector4& TextActor::GetGradientColor() const
326 return mTextAttachment->GetGradientColor();
329 void TextActor::SetGradientStartPoint( const Vector2& position )
331 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), position, mTextAttachment->GetGradientEndPoint() );
334 const Vector2& TextActor::GetGradientStartPoint() const
336 return mTextAttachment->GetGradientStartPoint();
339 void TextActor::SetGradientEndPoint( const Vector2& position )
341 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), position );
344 const Vector2& TextActor::GetGradientEndPoint() const
346 return mTextAttachment->GetGradientEndPoint();
349 void TextActor::SetGradient( const Vector4& color, const Vector2& startPoint, const Vector2& endPoint )
351 mTextAttachment->SetGradient( color, startPoint, endPoint );
354 void TextActor::SetTextStyle( const TextStyle& style, TextRequestMode mode )
357 const Font& font = mTextAttachment->GetFont();
359 // Determine the font name/style/size that Font would create.
360 // Then compare this to the existing font (which has been validated by Font).
362 std::string resolvedFontName = style.GetFontName();
363 std::string resolvedFontStyle = style.GetFontStyle();
364 float resolvedFontPointSize = style.GetFontPointSize();
365 bool resolvedFontFamilyDefault(false);
366 bool resolvedFontPointSizeDefault(false);
368 Font::ValidateFontRequest( resolvedFontName,
370 resolvedFontPointSize,
371 resolvedFontFamilyDefault,
372 resolvedFontPointSizeDefault );
374 // Now compare to existing font used to see if a font change is necessary.
375 if( ( font.GetName() != resolvedFontName ) ||
376 ( font.GetStyle() != resolvedFontStyle ) ||
377 ( fabsf(font.GetPointSize() - resolvedFontPointSize) >= GetRangedEpsilon(font.GetPointSize(), resolvedFontPointSize) ) )
379 // Create font with original request (so font can determine if family and/or point size is default)
380 SetFont( *(Font::New( style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) ), mode );
384 if( !style.IsTextColorDefault() )
386 SetTextColor( style.GetTextColor() );
390 mTextAttachment->ResetTextColor();
394 if( !style.IsItalicsDefault() )
396 SetItalics( style.IsItalicsEnabled() ? Radian( style.GetItalicsAngle() ) : Radian( 0.0f ) );
400 mTextAttachment->ResetItalics();
404 if( !style.IsUnderlineDefault() )
406 SetUnderline( style.IsUnderlineEnabled(), style.GetUnderlineThickness(), style.GetUnderlinePosition() );
410 mTextAttachment->ResetUnderline();
414 if( !style.IsShadowDefault() )
416 SetShadow( style.IsShadowEnabled(), style.GetShadowColor(), style.GetShadowOffset(), style.GetShadowSize() );
420 mTextAttachment->ResetShadow();
424 if( !style.IsGlowDefault() )
426 SetGlow( style.IsGlowEnabled(), style.GetGlowColor(), style.GetGlowIntensity() );
430 mTextAttachment->ResetGlow();
434 if( !style.IsSmoothEdgeDefault() )
436 SetSmoothEdge( style.GetSmoothEdge() );
440 mTextAttachment->ResetSmoothEdge();
444 if( !style.IsOutlineDefault() )
446 SetOutline( style.IsOutlineEnabled(), style.GetOutlineColor(), style.GetOutlineThickness() );
450 mTextAttachment->ResetOutline();
454 if( !style.IsFontWeightDefault() )
456 SetWeight( style.GetWeight() );
460 mTextAttachment->ResetWeight();
464 if( !style.IsGradientDefault() )
466 if( style.IsGradientEnabled() )
468 SetGradient( style.GetGradientColor(), style.GetGradientStartPoint(), style.GetGradientEndPoint() );
472 SetGradient( TextStyle::DEFAULT_GRADIENT_COLOR, TextStyle::DEFAULT_GRADIENT_START_POINT, TextStyle::DEFAULT_GRADIENT_END_POINT );
477 mTextAttachment->ResetGradient();
481 TextStyle TextActor::GetTextStyle() const
484 mTextAttachment->GetTextStyle( textStyle );
489 void TextActor::SetTextColor(const Vector4& color)
491 mTextAttachment->SetTextColor( color );
494 Vector4 TextActor::GetTextColor() const
496 return mTextAttachment->GetTextColor();
499 void TextActor::SetSmoothEdge( float smoothEdge )
501 mTextAttachment->SetSmoothEdge(smoothEdge);
504 void TextActor::SetOutline( bool enable, const Vector4& color, const Vector2& offset )
506 mTextAttachment->SetOutline(enable, color, offset);
509 void TextActor::SetGlow( bool enable, const Vector4& color, float intensity )
511 mTextAttachment->SetGlow(enable, color, intensity);
514 void TextActor::SetShadow( bool enable, const Vector4& color, const Vector2& offset, float size )
516 mTextAttachment->SetShadow(enable, color, offset, size);
519 void TextActor::SetItalics( Radian angle )
521 mTextAttachment->SetItalics( angle );
526 bool TextActor::GetItalics() const
528 return mTextAttachment->GetItalics();
531 Radian TextActor::GetItalicsAngle() const
533 return mTextAttachment->GetItalicsAngle();
536 void TextActor::SetUnderline( bool enable, float thickness, float position )
538 mTextAttachment->SetUnderline( enable, thickness, position );
543 bool TextActor::GetUnderline() const
545 return mTextAttachment->GetUnderline();
548 float TextActor::GetUnderlineThickness() const
550 return mTextAttachment->GetUnderlineThickness();
553 float TextActor::GetUnderlinePosition() const
555 return mTextAttachment->GetUnderlinePosition();
558 void TextActor::SetWeight( TextStyle::Weight weight )
560 mTextAttachment->SetWeight( weight );
563 TextStyle::Weight TextActor::GetWeight() const
565 return mTextAttachment->GetWeight();
568 void TextActor::SetFontDetectionAutomatic(bool value)
570 mFontDetection = value;
573 bool TextActor::IsFontDetectionAutomatic() const
575 return mFontDetection;
578 bool TextActor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
580 bool connected( true );
581 TextActor* textActor = dynamic_cast<TextActor*>(object);
583 if( Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED == signalName )
585 textActor->TextAvailableSignal().Connect( tracker, functor );
589 // signalName does not match any signal
596 void TextActor::TextLoaded()
598 // if the text is loaded, trigger the loaded finished signal
599 CheckTextLoadState();
602 void TextActor::TextChanged()
604 // this will tell the text attachment to act on any text or font changes
605 mTextAttachment->TextChanged();
607 // check the loading state
608 bool loaded = CheckTextLoadState();
611 mLoadingState = Dali::ResourceLoading;
613 StartObservingTextLoads();
615 // the text natural size is calculated synchronously above, when TextChanged() is called
616 if (mUsingNaturalSize)
618 mInternalSetSize = true; // to know we're internally setting size
619 SetSize( mTextAttachment->GetNaturalTextSize() );
620 mInternalSetSize = false;
624 bool TextActor::CheckTextLoadState()
626 if( mTextAttachment->IsTextLoaded() )
628 mLoadingState = Dali::ResourceLoadingSucceeded;
630 StopObservingTextLoads();
632 // emit text available signal
634 mLoadingFinishedV2.Emit( Dali::TextActor( this ) );
643 unsigned int TextActor::GetDefaultPropertyCount() const
645 return RenderableActor::GetDefaultPropertyCount() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT;
648 void TextActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
650 RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
652 indices.reserve( indices.size() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT );
654 int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
655 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i, ++index )
657 indices.push_back( index );
661 const std::string& TextActor::GetDefaultPropertyName( Property::Index index ) const
663 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
665 return RenderableActor::GetDefaultPropertyName(index) ;
669 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
671 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
673 return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index];
677 // index out-of-bounds
678 static const std::string INVALID_PROPERTY_NAME;
679 return INVALID_PROPERTY_NAME;
684 Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
686 Property::Index index = Property::INVALID_INDEX;
688 DALI_ASSERT_DEBUG( NULL != mDefaultTextActorPropertyLookup );
690 // Look for name in current class' default properties
691 DefaultPropertyLookup::const_iterator result = mDefaultTextActorPropertyLookup->find( name );
692 if ( mDefaultTextActorPropertyLookup->end() != result )
694 index = result->second;
698 // If not found, check in base class
699 index = RenderableActor::GetDefaultPropertyIndex( name );
705 bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
707 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
709 return RenderableActor::IsDefaultPropertyWritable(index) ;
717 bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
719 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
721 return RenderableActor::IsDefaultPropertyAnimatable(index) ;
729 bool TextActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
731 if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
733 return RenderableActor::IsDefaultPropertyAConstraintInput(index);
735 return true; // Our properties can be used as input to constraints.
738 Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
740 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
742 return RenderableActor::GetDefaultPropertyType(index) ;
746 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
748 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
750 return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index];
754 // index out-of-bounds
755 return Property::NONE;
760 void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
762 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
764 RenderableActor::SetDefaultProperty(index, propertyValue) ;
770 case Dali::TextActor::TEXT:
772 SetText( GetTextArray( Dali::Text( propertyValue.Get<std::string>() ) ) );
775 case Dali::TextActor::FONT:
777 SetFont(*Font::New(propertyValue.Get<std::string>(),
778 mTextAttachment->GetFont().GetStyle(),
779 PointSize(mTextAttachment->GetFont().GetPointSize())));
782 case Dali::TextActor::FONT_STYLE:
784 SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
785 propertyValue.Get<std::string>(),
786 PointSize(mTextAttachment->GetFont().GetPointSize())));
789 case Dali::TextActor::OUTLINE_ENABLE:
793 mTextAttachment->GetOutlineParams( color, thickness );
794 mTextAttachment->SetOutline(propertyValue.Get<bool>(), color, thickness);
797 case Dali::TextActor::OUTLINE_COLOR:
801 mTextAttachment->GetOutlineParams( color, thickness );
802 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get<Vector4>(), thickness);
805 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
809 mTextAttachment->GetOutlineParams( color, thickness );
810 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get<Vector2>());
813 case Dali::TextActor::SMOOTH_EDGE:
815 mTextAttachment->SetSmoothEdge( propertyValue.Get<float>());
818 case Dali::TextActor::GLOW_ENABLE:
822 mTextAttachment->GetGlowParams( color, intensity );
823 mTextAttachment->SetGlow(propertyValue.Get<bool>(), color, intensity);
826 case Dali::TextActor::GLOW_COLOR:
830 mTextAttachment->GetGlowParams( color, intensity );
831 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get<Vector4>(), intensity);
834 case Dali::TextActor::GLOW_INTENSITY:
838 mTextAttachment->GetGlowParams( color, intensity );
839 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get<float>());
842 case Dali::TextActor::SHADOW_ENABLE:
847 mTextAttachment->GetShadowParams( color, offset, size );
848 mTextAttachment->SetShadow(propertyValue.Get<bool>(), color, offset, size );
851 case Dali::TextActor::SHADOW_COLOR:
856 mTextAttachment->GetShadowParams( color, offset, size );
857 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get<Vector4>(), offset, size);
860 case Dali::TextActor::SHADOW_OFFSET:
865 mTextAttachment->GetShadowParams( color, offset, size );
866 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get<Vector2>(), size );
869 case Dali::TextActor::SHADOW_SIZE:
874 mTextAttachment->GetShadowParams( color, offset, size );
875 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get<float>());
878 case Dali::TextActor::ITALICS_ANGLE:
880 SetItalics(Radian(propertyValue.Get<float>())) ;
883 case Dali::TextActor::UNDERLINE:
885 SetUnderline(propertyValue.Get<bool>(), 0.f, 0.f ) ;
888 case Dali::TextActor::WEIGHT:
890 mTextAttachment->SetWeight(static_cast<TextStyle::Weight>(propertyValue.Get<int>())) ;
893 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
895 mFontDetection = propertyValue.Get<bool>() ;
898 case Dali::TextActor::GRADIENT_COLOR:
900 mTextAttachment->SetGradient( propertyValue.Get<Vector4>(), mTextAttachment->GetGradientStartPoint(), mTextAttachment->GetGradientEndPoint() );
903 case Dali::TextActor::GRADIENT_START_POINT:
905 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), propertyValue.Get<Vector2>(), mTextAttachment->GetGradientEndPoint() );
908 case Dali::TextActor::GRADIENT_END_POINT:
910 mTextAttachment->SetGradient( mTextAttachment->GetGradientColor(), mTextAttachment->GetGradientStartPoint(), propertyValue.Get<Vector2>() );
913 case Dali::TextActor::TEXT_COLOR:
915 mTextAttachment->SetTextColor( propertyValue.Get<Vector4>() );
920 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
928 Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
930 Property::Value ret ;
931 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
933 ret = RenderableActor::GetDefaultProperty(index) ;
939 case Dali::TextActor::TEXT:
944 case Dali::TextActor::FONT:
946 ret = mTextAttachment->GetFont().GetName();
949 case Dali::TextActor::FONT_STYLE:
951 ret = mTextAttachment->GetFont().GetStyle();
954 case Dali::TextActor::OUTLINE_ENABLE:
956 ret = mTextAttachment->GetOutline();
959 case Dali::TextActor::OUTLINE_COLOR:
963 mTextAttachment->GetOutlineParams( color, thickness );
967 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
971 mTextAttachment->GetOutlineParams( color, thickness );
975 case Dali::TextActor::SMOOTH_EDGE:
977 ret = mTextAttachment->GetSmoothEdge();
980 case Dali::TextActor::GLOW_ENABLE:
982 ret = mTextAttachment->GetGlow();
985 case Dali::TextActor::GLOW_COLOR:
988 float intensity(0.0f);
989 mTextAttachment->GetGlowParams( color, intensity );
993 case Dali::TextActor::GLOW_INTENSITY:
996 float intensity(0.0f);
997 mTextAttachment->GetGlowParams( color, intensity );
1001 case Dali::TextActor::SHADOW_ENABLE:
1003 ret = mTextAttachment->GetShadow();
1006 case Dali::TextActor::SHADOW_COLOR:
1011 mTextAttachment->GetShadowParams( color, offset, size );
1015 case Dali::TextActor::SHADOW_OFFSET:
1020 mTextAttachment->GetShadowParams( color, offset, size );
1024 case Dali::TextActor::SHADOW_SIZE:
1029 mTextAttachment->GetShadowParams( color, offset, size );
1033 case Dali::TextActor::ITALICS_ANGLE:
1035 ret = static_cast<float>(mTextAttachment->GetItalics()) ;
1038 case Dali::TextActor::UNDERLINE:
1040 ret = mTextAttachment->GetUnderline() ;
1043 case Dali::TextActor::WEIGHT:
1045 ret = static_cast<int>(mTextAttachment->GetWeight());
1048 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
1050 ret = mFontDetection;
1053 case Dali::TextActor::GRADIENT_COLOR:
1055 ret = mTextAttachment->GetGradientColor();
1058 case Dali::TextActor::GRADIENT_START_POINT:
1060 ret = mTextAttachment->GetGradientStartPoint();
1063 case Dali::TextActor::GRADIENT_END_POINT:
1065 ret = mTextAttachment->GetGradientEndPoint();
1068 case Dali::TextActor::TEXT_COLOR:
1070 ret = mTextAttachment->GetTextColor();
1075 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
1079 } // if from base class
1084 } // namespace Internal