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->SetGradientColor( color );
366 const Vector4& TextActor::GetGradientColor() const
368 return mTextAttachment->GetGradientColor();
371 void TextActor::SetGradientStartPoint( const Vector2& position )
373 mTextAttachment->SetGradientStartPoint( position );
376 const Vector2& TextActor::GetGradientStartPoint() const
378 return mTextAttachment->GetGradientStartPoint();
381 void TextActor::SetGradientEndPoint( const Vector2& position )
383 mTextAttachment->SetGradientEndPoint( position );
386 const Vector2& TextActor::GetGradientEndPoint() const
388 return mTextAttachment->GetGradientEndPoint();
391 void TextActor::SetTextStyle( const TextStyle& style, TextRequestMode mode )
394 const Font& font = mTextAttachment->GetFont();
396 // Determine the font name/style/size that Font would create.
397 // Then compare this to the existing font (which has been validated by Font).
399 std::string resolvedFontName = style.GetFontName();
400 std::string resolvedFontStyle = style.GetFontStyle();
401 float resolvedFontPointSize = style.GetFontPointSize();
402 bool resolvedFontFamilyDefault(false);
403 bool resolvedFontPointSizeDefault(false);
405 Font::ValidateFontRequest( resolvedFontName,
407 resolvedFontPointSize,
408 resolvedFontFamilyDefault,
409 resolvedFontPointSizeDefault );
411 // Now compare to existing font used to see if a font change is necessary.
412 if( ( font.GetName() != resolvedFontName ) ||
413 ( font.GetStyle() != resolvedFontStyle ) ||
414 ( fabsf(font.GetPointSize() - resolvedFontPointSize) >= GetRangedEpsilon(font.GetPointSize(), resolvedFontPointSize) ) )
416 // Create font with original request (so font can determine if family and/or point size is default)
417 SetFont( *(Font::New( style.GetFontName(), style.GetFontStyle(), style.GetFontPointSize() ) ), mode );
421 SetTextColor( style.GetTextColor() );
424 SetItalics( style.GetItalics() ? Radian( style.GetItalicsAngle() ) : Radian( 0.0f ) );
427 SetUnderline( style.GetUnderline(), style.GetUnderlineThickness(), style.GetUnderlinePosition() );
430 SetShadow( style.GetShadow(), style.GetShadowColor(), style.GetShadowOffset(), style.GetShadowSize() );
433 SetGlow( style.GetGlow(), style.GetGlowColor(), style.GetGlowIntensity() );
436 SetSmoothEdge( style.GetSmoothEdge() );
439 SetOutline( style.GetOutline(), style.GetOutlineColor(), style.GetOutlineThickness() );
442 SetWeight( style.GetWeight() );
445 TextStyle TextActor::GetTextStyle() const
447 // Reset to default values.
451 const Font& font = mTextAttachment->GetFont();
453 if( !font.IsDefaultSystemFont() )
455 textStyle.SetFontName( font.GetName() );
456 textStyle.SetFontStyle( font.GetStyle() );
459 if( !font.IsDefaultSystemSize() )
461 textStyle.SetFontPointSize( PointSize( font.GetPointSize() ) );
465 textStyle.SetTextColor( GetTextColor() );
468 textStyle.SetItalics( Radian( 0.f ) != GetItalics() );
469 textStyle.SetItalicsAngle( Degree( GetItalics() ) );
472 textStyle.SetUnderline( GetUnderline() );
473 textStyle.SetUnderlinePosition( GetUnderlinePosition() );
474 textStyle.SetUnderlineThickness( GetUnderlineThickness() );
478 Vector2 shadowOffset;
480 mTextAttachment->GetShadowParams( shadowColor, shadowOffset, shadowSize );
481 textStyle.SetShadow( mTextAttachment->GetShadow(), shadowColor, shadowOffset, shadowSize );
485 float glowOffset(0.0f);
486 mTextAttachment->GetGlowParams( glowColor, glowOffset );
487 textStyle.SetGlow( mTextAttachment->GetGlow(), glowColor, glowOffset );
490 textStyle.SetSmoothEdge( mTextAttachment->GetSmoothEdge() );
493 Vector4 outlineColor;
494 Vector2 outlineOffset;
495 mTextAttachment->GetOutlineParams( outlineColor, outlineOffset );
496 textStyle.SetOutline( mTextAttachment->GetOutline(), outlineColor, outlineOffset );
499 textStyle.SetWeight( mTextAttachment->GetWeight() );
504 void TextActor::SetTextColor(const Vector4& color)
506 mTextAttachment->SetTextColor( color );
509 Vector4 TextActor::GetTextColor() const
511 return mTextAttachment->GetTextColor();
514 void TextActor::SetSmoothEdge(const float smoothEdge)
516 mTextAttachment->SetSmoothEdge(smoothEdge);
519 void TextActor::SetOutline(const bool enable, const Vector4& color, const Vector2& offset)
521 mTextAttachment->SetOutline(enable, color, offset);
524 void TextActor::SetGlow(const bool enable, const Vector4& color, const float intensity)
526 mTextAttachment->SetGlow(enable, color, intensity);
529 void TextActor::SetShadow(const bool enable, const Vector4& color, const Vector2& offset, const float size)
531 mTextAttachment->SetShadow(enable, color, offset, size);
534 void TextActor::SetItalics( const Radian& angle )
536 mTextAttachment->SetItalics( angle );
541 const Radian& TextActor::GetItalics() const
543 return mTextAttachment->GetItalics();
546 void TextActor::SetUnderline( const bool enable, float thickness, float position )
548 mTextAttachment->SetUnderline( enable, thickness, position );
553 bool TextActor::GetUnderline() const
555 return mTextAttachment->GetUnderline();
558 float TextActor::GetUnderlineThickness() const
560 return mTextAttachment->GetUnderlineThickness();
563 float TextActor::GetUnderlinePosition() const
565 return mTextAttachment->GetUnderlinePosition();
568 void TextActor::SetWeight( TextStyle::Weight weight )
570 mTextAttachment->SetWeight( weight );
573 TextStyle::Weight TextActor::GetWeight() const
575 return mTextAttachment->GetWeight();
578 void TextActor::SetFontDetectionAutomatic(bool value)
580 mFontDetection = value;
583 bool TextActor::IsFontDetectionAutomatic() const
585 return mFontDetection;
588 bool TextActor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
590 bool connected( true );
591 TextActor* textActor = dynamic_cast<TextActor*>(object);
593 if( Dali::TextActor::SIGNAL_TEXT_LOADING_FINISHED == signalName )
595 textActor->TextAvailableSignal().Connect( tracker, functor );
599 // signalName does not match any signal
606 void TextActor::TextLoaded()
608 // if the text is loaded, trigger the loaded finished signal
609 CheckTextLoadState();
612 void TextActor::TextChanged()
614 // this will tell the text attachment to act on any text or font changes
615 mTextAttachment->TextChanged();
617 // check the loading state
618 bool loaded = CheckTextLoadState();
621 mLoadingState = Dali::ResourceLoading;
623 StartObservingTextLoads();
625 // the text natural size is calculated synchronously above, when TextChanged() is called
626 if (mUsingNaturalSize)
628 mInternalSetSize = true; // to know we're internally setting size
629 SetSize( mTextAttachment->GetNaturalTextSize() );
630 mInternalSetSize = false;
634 bool TextActor::CheckTextLoadState()
636 if( mTextAttachment->IsTextLoaded() )
638 mLoadingState = Dali::ResourceLoadingSucceeded;
640 StopObservingTextLoads();
642 // emit text available signal
644 mLoadingFinishedV2.Emit( Dali::TextActor( this ) );
653 unsigned int TextActor::GetDefaultPropertyCount() const
655 return RenderableActor::GetDefaultPropertyCount() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT;
658 void TextActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
660 RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
662 indices.reserve( indices.size() + DEFAULT_TEXT_ACTOR_PROPERTY_COUNT );
664 int index = DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
665 for ( int i = 0; i < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT; ++i, ++index )
667 indices.push_back( index );
671 const std::string& TextActor::GetDefaultPropertyName( Property::Index index ) const
673 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
675 return RenderableActor::GetDefaultPropertyName(index) ;
679 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
681 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
683 return DEFAULT_TEXT_ACTOR_PROPERTY_NAMES[index];
687 // index out-of-bounds
688 static const std::string INVALID_PROPERTY_NAME;
689 return INVALID_PROPERTY_NAME;
694 Property::Index TextActor::GetDefaultPropertyIndex(const std::string& name) const
696 Property::Index index = Property::INVALID_INDEX;
698 DALI_ASSERT_DEBUG( NULL != mDefaultTextActorPropertyLookup );
700 // Look for name in current class' default properties
701 DefaultPropertyLookup::const_iterator result = mDefaultTextActorPropertyLookup->find( name );
702 if ( mDefaultTextActorPropertyLookup->end() != result )
704 index = result->second;
708 // If not found, check in base class
709 index = RenderableActor::GetDefaultPropertyIndex( name );
715 bool TextActor::IsDefaultPropertyWritable( Property::Index index ) const
717 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
719 return RenderableActor::IsDefaultPropertyWritable(index) ;
727 bool TextActor::IsDefaultPropertyAnimatable( Property::Index index ) const
729 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
731 return RenderableActor::IsDefaultPropertyAnimatable(index) ;
739 bool TextActor::IsDefaultPropertyAConstraintInput( Property::Index index ) const
741 if( index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT )
743 return RenderableActor::IsDefaultPropertyAConstraintInput(index);
745 return true; // Our properties can be used as input to constraints.
748 Property::Type TextActor::GetDefaultPropertyType( Property::Index index ) const
750 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
752 return RenderableActor::GetDefaultPropertyType(index) ;
756 index -= DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT;
758 if ( ( index >= 0 ) && ( index < DEFAULT_TEXT_ACTOR_PROPERTY_COUNT ) )
760 return DEFAULT_TEXT_ACTOR_PROPERTY_TYPES[index];
764 // index out-of-bounds
765 return Property::NONE;
770 void TextActor::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
772 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
774 RenderableActor::SetDefaultProperty(index, propertyValue) ;
780 case Dali::TextActor::TEXT:
782 SetText(propertyValue.Get<std::string>());
785 case Dali::TextActor::FONT:
787 SetFont(*Font::New(propertyValue.Get<std::string>(),
788 mTextAttachment->GetFont().GetStyle(),
789 PointSize(mTextAttachment->GetFont().GetPointSize())));
792 case Dali::TextActor::FONT_STYLE:
794 SetFont(*Font::New(mTextAttachment->GetFont().GetName(),
795 propertyValue.Get<std::string>(),
796 PointSize(mTextAttachment->GetFont().GetPointSize())));
799 case Dali::TextActor::OUTLINE_ENABLE:
803 mTextAttachment->GetOutlineParams( color, thickness );
804 mTextAttachment->SetOutline(propertyValue.Get<bool>(), color, thickness);
807 case Dali::TextActor::OUTLINE_COLOR:
811 mTextAttachment->GetOutlineParams( color, thickness );
812 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), propertyValue.Get<Vector4>(), thickness);
815 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
819 mTextAttachment->GetOutlineParams( color, thickness );
820 mTextAttachment->SetOutline(mTextAttachment->GetOutline(), color, propertyValue.Get<Vector2>());
823 case Dali::TextActor::SMOOTH_EDGE:
825 mTextAttachment->SetSmoothEdge( propertyValue.Get<float>());
828 case Dali::TextActor::GLOW_ENABLE:
832 mTextAttachment->GetGlowParams( color, intensity );
833 mTextAttachment->SetGlow(propertyValue.Get<bool>(), color, intensity);
836 case Dali::TextActor::GLOW_COLOR:
840 mTextAttachment->GetGlowParams( color, intensity );
841 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), propertyValue.Get<Vector4>(), intensity);
844 case Dali::TextActor::GLOW_INTENSITY:
848 mTextAttachment->GetGlowParams( color, intensity );
849 mTextAttachment->SetGlow(mTextAttachment->GetGlow(), color, propertyValue.Get<float>());
852 case Dali::TextActor::SHADOW_ENABLE:
857 mTextAttachment->GetShadowParams( color, offset, size );
858 mTextAttachment->SetShadow(propertyValue.Get<bool>(), color, offset, size );
861 case Dali::TextActor::SHADOW_COLOR:
866 mTextAttachment->GetShadowParams( color, offset, size );
867 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), propertyValue.Get<Vector4>(), offset, size);
870 case Dali::TextActor::SHADOW_OFFSET:
875 mTextAttachment->GetShadowParams( color, offset, size );
876 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, propertyValue.Get<Vector2>(), size );
879 case Dali::TextActor::SHADOW_SIZE:
884 mTextAttachment->GetShadowParams( color, offset, size );
885 mTextAttachment->SetShadow(mTextAttachment->GetShadow(), color, offset, propertyValue.Get<float>());
888 case Dali::TextActor::ITALICS_ANGLE:
890 SetItalics(Radian(propertyValue.Get<float>())) ;
893 case Dali::TextActor::UNDERLINE:
895 SetUnderline(propertyValue.Get<bool>(), 0.f, 0.f ) ;
898 case Dali::TextActor::WEIGHT:
900 mTextAttachment->SetWeight(static_cast<TextStyle::Weight>(propertyValue.Get<int>())) ;
903 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
905 mFontDetection = propertyValue.Get<bool>() ;
908 case Dali::TextActor::GRADIENT_COLOR:
910 mTextAttachment->SetGradientColor( propertyValue.Get<Vector4>() );
913 case Dali::TextActor::GRADIENT_START_POINT:
915 mTextAttachment->SetGradientStartPoint( propertyValue.Get<Vector2>() );
918 case Dali::TextActor::GRADIENT_END_POINT:
920 mTextAttachment->SetGradientEndPoint( propertyValue.Get<Vector2>() );
923 case Dali::TextActor::TEXT_COLOR:
925 mTextAttachment->SetTextColor( propertyValue.Get<Vector4>() );
930 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
938 Property::Value TextActor::GetDefaultProperty( Property::Index index ) const
940 Property::Value ret ;
941 if(index < DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT)
943 ret = RenderableActor::GetDefaultProperty(index) ;
949 case Dali::TextActor::TEXT:
954 case Dali::TextActor::FONT:
956 ret = mTextAttachment->GetFont().GetName();
959 case Dali::TextActor::FONT_STYLE:
961 ret = mTextAttachment->GetFont().GetStyle();
964 case Dali::TextActor::OUTLINE_ENABLE:
966 ret = mTextAttachment->GetOutline();
969 case Dali::TextActor::OUTLINE_COLOR:
973 mTextAttachment->GetOutlineParams( color, thickness );
977 case Dali::TextActor::OUTLINE_THICKNESS_WIDTH:
981 mTextAttachment->GetOutlineParams( color, thickness );
985 case Dali::TextActor::SMOOTH_EDGE:
987 ret = mTextAttachment->GetSmoothEdge();
990 case Dali::TextActor::GLOW_ENABLE:
992 ret = mTextAttachment->GetGlow();
995 case Dali::TextActor::GLOW_COLOR:
998 float intensity(0.0f);
999 mTextAttachment->GetGlowParams( color, intensity );
1003 case Dali::TextActor::GLOW_INTENSITY:
1006 float intensity(0.0f);
1007 mTextAttachment->GetGlowParams( color, intensity );
1011 case Dali::TextActor::SHADOW_ENABLE:
1013 ret = mTextAttachment->GetShadow();
1016 case Dali::TextActor::SHADOW_COLOR:
1021 mTextAttachment->GetShadowParams( color, offset, size );
1025 case Dali::TextActor::SHADOW_OFFSET:
1030 mTextAttachment->GetShadowParams( color, offset, size );
1034 case Dali::TextActor::SHADOW_SIZE:
1039 mTextAttachment->GetShadowParams( color, offset, size );
1043 case Dali::TextActor::ITALICS_ANGLE:
1045 ret = static_cast<float>(mTextAttachment->GetItalics()) ;
1048 case Dali::TextActor::UNDERLINE:
1050 ret = mTextAttachment->GetUnderline() ;
1053 case Dali::TextActor::WEIGHT:
1055 ret = static_cast<int>(mTextAttachment->GetWeight());
1058 case Dali::TextActor::FONT_DETECTION_AUTOMATIC:
1060 ret = mFontDetection;
1063 case Dali::TextActor::GRADIENT_COLOR:
1065 ret = mTextAttachment->GetGradientColor();
1068 case Dali::TextActor::GRADIENT_START_POINT:
1070 ret = mTextAttachment->GetGradientStartPoint();
1073 case Dali::TextActor::GRADIENT_END_POINT:
1075 ret = mTextAttachment->GetGradientEndPoint();
1078 case Dali::TextActor::TEXT_COLOR:
1080 ret = mTextAttachment->GetTextColor();
1085 DALI_LOG_WARNING("Unknown text set property (%d)\n", index);
1089 } // if from base class
1094 } // namespace Internal