2 * Copyright (c) 2016 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-toolkit/internal/visuals/text/text-visual.h>
22 #include <dali/devel-api/scripting/enum-helper.h>
23 // #include <dali/devel-api/scripting/scripting.h>
26 #include <dali-toolkit/public-api/text/rendering-backend.h>
27 #include <dali-toolkit/public-api/visuals/text-visual-properties.h>
28 #include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
29 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
30 #include <dali-toolkit/internal/text/rendering/text-backend.h>
31 #include <dali-toolkit/internal/text/text-view.h>
32 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
33 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
34 #include <dali-toolkit/internal/text/text-font-style.h>
35 #include <dali-toolkit/internal/text/text-effects-style.h>
37 using Dali::Toolkit::Text::LayoutEngine;
52 const char * const RENDERING_BACKEND_PROPERTY( "renderingBackend" );
53 const char * const TEXT_PROPERTY( "text" );
54 const char * const FONT_FAMILY_PROPERTY( "fontFamily" );
55 const char * const FONT_STYLE_PROPERTY( "fontStyle" );
56 const char * const POINT_SIZE_PROPERTY( "pointSize" );
57 const char * const MULTI_LINE_PROPERTY( "multiLine" );
58 const char * const HORIZONTAL_ALIGNMENT_PROPERTY( "horizontalAlignment" );
59 const char * const VERTICAL_ALIGNMENT_PROPERTY( "verticalAlignment" );
60 const char * const TEXT_COLOR_PROPERTY( "textColor" );
61 const char * const ENABLE_MARKUP_PROPERTY( "enableMarkup" );
62 const char * const ENABLE_AUTO_SCROLL_PROPERTY( "enableAutoScroll" );
63 const char * const AUTO_SCROLL_SPEED_PROPERTY( "autoScrollSpeed" );
64 const char * const AUTO_SCROLL_LOOP_COUNT_PROPERTY( "autoScrollLoopCount" );
65 const char * const AUTO_SCROLL_GAP_PROPERTY( "autoScrollGap" );
66 const char * const LINE_SPACING_PROPERTY( "lineSpacing" );
67 const char * const UNDERLINE_PROPERTY( "underline" );
68 const char * const SHADOW_PROPERTY( "shadow" );
69 const char * const OUTLINE_PROPERTY( "outline" );
70 const char * const BATCHING_ENABLED_PROPERTY( "batchingEnabled" );
72 const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
74 { "BEGIN", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN },
75 { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
76 { "END", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END },
78 const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
80 const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
82 { "TOP", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_TOP },
83 { "CENTER", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_CENTER },
84 { "BOTTOM", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_BOTTOM },
86 const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
88 std::string GetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment )
90 const char* name = Scripting::GetEnumerationName<Toolkit::Text::LayoutEngine::HorizontalAlignment>( alignment,
91 HORIZONTAL_ALIGNMENT_STRING_TABLE,
92 HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
94 return std::string( name );
97 std::string GetVerticalAlignment( LayoutEngine::VerticalAlignment alignment )
99 const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( alignment,
100 VERTICAL_ALIGNMENT_STRING_TABLE,
101 VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
103 return std::string( name );
106 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
107 attribute mediump vec2 aPosition;\n
108 uniform mediump mat4 uMvpMatrix;\n
109 uniform mediump vec3 uSize;\n
110 uniform mediump vec4 pixelArea;
111 varying mediump vec2 vTexCoord;\n
115 mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
116 vertexPosition.xyz *= uSize;\n
117 vertexPosition = uMvpMatrix * vertexPosition;\n
119 vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
120 gl_Position = vertexPosition;\n
124 const char* FRAGMENT_SHADER_ATLAS_CLAMP = DALI_COMPOSE_SHADER(
125 varying mediump vec2 vTexCoord;\n
126 uniform sampler2D sTexture;\n
127 uniform mediump vec4 uAtlasRect;\n
128 uniform lowp vec4 uColor;\n
132 mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
133 gl_FragColor = texture2D( sTexture, texCoord ) * uColor;\n
137 Geometry CreateGeometry( VisualFactoryCache& factoryCache, ImageDimensions gridSize )
141 if( gridSize == ImageDimensions( 1, 1 ) )
143 geometry = factoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
146 geometry = VisualFactoryCache::CreateQuadGeometry();
147 factoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
152 geometry = VisualFactoryCache::CreateGridGeometry( gridSize );
158 } // unnamed namespace
160 TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache )
162 return new TextVisual( factoryCache );
165 void TextVisual::SetSize( const Vector2& size )
167 const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
169 if( ( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) ) ||
174 mRenderer = Text::Backend::Get().NewRenderer( mRenderingBackend );
181 float TextVisual::GetHeightForWidth( float width ) const
183 return mController->GetHeightForWidth( width );
186 void TextVisual::GetNaturalSize( Vector2& naturalSize )
188 naturalSize = mController->GetNaturalSize().GetVectorXY();
191 void TextVisual::DoCreatePropertyMap( Property::Map& map ) const
193 Property::Value value;
196 map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::TEXT );
198 map.Insert( Toolkit::TextVisual::Property::RENDERING_BACKEND, mRenderingBackend );
201 mController->GetText( text );
202 map.Insert( Toolkit::TextVisual::Property::TEXT, text );
204 map.Insert( Toolkit::TextVisual::Property::FONT_FAMILY, mController->GetDefaultFontFamily() );
206 GetFontStyleProperty( mController, value, Text::FontStyle::DEFAULT );
207 map.Insert( Toolkit::TextVisual::Property::FONT_STYLE, value );
209 map.Insert( Toolkit::TextVisual::Property::POINT_SIZE, mController->GetDefaultPointSize() );
211 map.Insert( Toolkit::TextVisual::Property::MULTI_LINE, mController->IsMultiLineEnabled() );
213 map.Insert( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, GetHorizontalAlignment( mController->GetHorizontalAlignment() ) );
215 map.Insert( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, GetVerticalAlignment( mController->GetVerticalAlignment() ) );
217 map.Insert( Toolkit::TextVisual::Property::TEXT_COLOR, mController->GetTextColor() );
219 map.Insert( Toolkit::TextVisual::Property::ENABLE_MARKUP, mController->IsMarkupProcessorEnabled() );
221 map.Insert( Toolkit::TextVisual::Property::LINE_SPACING, mController->GetDefaultLineSpacing() );
223 GetUnderlineProperties( mController, value, Text::EffectStyle::DEFAULT );
224 map.Insert( Toolkit::TextVisual::Property::UNDERLINE, value );
226 GetShadowProperties( mController, value, Text::EffectStyle::DEFAULT );
227 map.Insert( Toolkit::TextVisual::Property::SHADOW, value );
229 GetOutlineProperties( mController, value, Text::EffectStyle::DEFAULT );
230 map.Insert( Toolkit::TextVisual::Property::OUTLINE, value );
232 map.Insert( Toolkit::TextVisual::Property::BATCHING_ENABLED, false ); // TODO
235 TextVisual::TextVisual( VisualFactoryCache& factoryCache )
236 : Visual::Base( factoryCache ),
237 mController( Text::Controller::New() ),
238 mRenderingBackend( Toolkit::Text::DEFAULT_RENDERING_BACKEND ),
239 mHasBeenStaged( false )
243 TextVisual::~TextVisual()
247 void TextVisual::DoSetProperties( const Property::Map& propertyMap )
249 for( Property::Map::SizeType index = 0u, count = propertyMap.Count(); index < count; ++index )
251 const KeyValuePair& keyValue = propertyMap.GetKeyValue( index );
253 switch( keyValue.first.type )
255 case Property::Key::INDEX:
257 if( Toolkit::VisualProperty::TYPE != keyValue.first.indexKey ) // Toolkit::VisualProperty::TYPE is not a TextVisual's property.
259 DoSetProperty( keyValue.first.indexKey, keyValue.second );
263 case Property::Key::STRING:
265 if( keyValue.first.stringKey == RENDERING_BACKEND_PROPERTY )
267 DoSetProperty( Toolkit::TextVisual::Property::RENDERING_BACKEND, keyValue.second );
269 else if( keyValue.first.stringKey == TEXT_PROPERTY )
271 DoSetProperty( Toolkit::TextVisual::Property::TEXT, keyValue.second );
273 else if( keyValue.first.stringKey == FONT_FAMILY_PROPERTY )
275 DoSetProperty( Toolkit::TextVisual::Property::FONT_FAMILY, keyValue.second );
277 else if( keyValue.first.stringKey == FONT_STYLE_PROPERTY )
279 DoSetProperty( Toolkit::TextVisual::Property::FONT_STYLE, keyValue.second );
281 else if( keyValue.first.stringKey == POINT_SIZE_PROPERTY )
283 DoSetProperty( Toolkit::TextVisual::Property::POINT_SIZE, keyValue.second );
285 else if( keyValue.first.stringKey == MULTI_LINE_PROPERTY )
287 DoSetProperty( Toolkit::TextVisual::Property::MULTI_LINE, keyValue.second );
289 else if( keyValue.first.stringKey == HORIZONTAL_ALIGNMENT_PROPERTY )
291 DoSetProperty( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, keyValue.second );
293 else if( keyValue.first.stringKey == VERTICAL_ALIGNMENT_PROPERTY )
295 DoSetProperty( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, keyValue.second );
297 else if( keyValue.first.stringKey == TEXT_COLOR_PROPERTY )
299 DoSetProperty( Toolkit::TextVisual::Property::TEXT_COLOR, keyValue.second );
301 else if( keyValue.first.stringKey == ENABLE_MARKUP_PROPERTY )
303 DoSetProperty( Toolkit::TextVisual::Property::ENABLE_MARKUP, keyValue.second );
305 else if( keyValue.first.stringKey == ENABLE_AUTO_SCROLL_PROPERTY )
307 DoSetProperty( Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL, keyValue.second );
309 else if( keyValue.first.stringKey == AUTO_SCROLL_SPEED_PROPERTY )
311 DoSetProperty( Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED, keyValue.second );
313 else if( keyValue.first.stringKey == AUTO_SCROLL_LOOP_COUNT_PROPERTY )
315 DoSetProperty( Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT, keyValue.second );
317 else if( keyValue.first.stringKey == AUTO_SCROLL_GAP_PROPERTY )
319 DoSetProperty( Toolkit::TextVisual::Property::AUTO_SCROLL_GAP, keyValue.second );
321 else if( keyValue.first.stringKey == LINE_SPACING_PROPERTY )
323 DoSetProperty( Toolkit::TextVisual::Property::LINE_SPACING, keyValue.second );
325 else if( keyValue.first.stringKey == UNDERLINE_PROPERTY )
327 DoSetProperty( Toolkit::TextVisual::Property::UNDERLINE, keyValue.second );
329 else if( keyValue.first.stringKey == SHADOW_PROPERTY )
331 DoSetProperty( Toolkit::TextVisual::Property::SHADOW, keyValue.second );
333 else if( keyValue.first.stringKey == OUTLINE_PROPERTY )
335 DoSetProperty( Toolkit::TextVisual::Property::OUTLINE, keyValue.second );
337 else if( keyValue.first.stringKey == BATCHING_ENABLED_PROPERTY )
339 DoSetProperty( Toolkit::TextVisual::Property::BATCHING_ENABLED, keyValue.second );
346 // Retrieve the layout engine to set whether to elide the text and set the cursor's width.
347 Text::LayoutEngine& engine = mController->GetLayoutEngine();
349 // Elide the text if it exceeds the boundaries.
350 engine.SetTextEllipsisEnabled( true );
352 // Sets 0 as cursor's width.
353 engine.SetCursorWidth( 0u ); // Do not layout space for the cursor.
356 void TextVisual::DoSetOnStage( Actor& actor )
358 // TODO Create the actual renderer(s) for the text!!!!
359 // Will crash if no mImpl->mRenderer is set.
363 geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
365 shader = mFactoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP );
368 shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
369 mFactoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader );
372 mImpl->mRenderer = Renderer::New( geometry, shader );
382 mHasBeenStaged = true;
386 void TextVisual::DoSetOffStage( Actor& actor )
391 void TextVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
395 case Toolkit::TextVisual::Property::RENDERING_BACKEND:
397 int backend = propertyValue.Get<int>();
399 #ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING
400 if( Text::RENDERING_VECTOR_BASED == backend )
402 backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering
405 if( mRenderingBackend != backend )
407 mRenderingBackend = backend;
410 // When using the vector-based rendering, the size of the GLyphs are different
411 TextAbstraction::GlyphType glyphType = ( Text::RENDERING_VECTOR_BASED == mRenderingBackend ) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
412 mController->SetGlyphType( glyphType );
416 case Toolkit::TextVisual::Property::TEXT:
418 mController->SetText( propertyValue.Get<std::string>() );
421 case Toolkit::TextVisual::Property::FONT_FAMILY:
423 SetFontFamilyProperty( mController, propertyValue );
426 case Toolkit::TextVisual::Property::FONT_STYLE:
428 SetFontStyleProperty( mController, propertyValue, Text::FontStyle::DEFAULT );
431 case Toolkit::TextVisual::Property::POINT_SIZE:
433 const float pointSize = propertyValue.Get<float>();
435 if( !Equals( mController->GetDefaultPointSize(), pointSize ) )
437 mController->SetDefaultPointSize( pointSize );
441 case Toolkit::TextVisual::Property::MULTI_LINE:
443 mController->SetMultiLineEnabled( propertyValue.Get<bool>() );
446 case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT:
448 LayoutEngine::HorizontalAlignment alignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN );
449 if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::HorizontalAlignment >( propertyValue.Get< std::string >().c_str(),
450 HORIZONTAL_ALIGNMENT_STRING_TABLE,
451 HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
454 mController->SetHorizontalAlignment( alignment );
458 case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT:
460 LayoutEngine::VerticalAlignment alignment( LayoutEngine::VERTICAL_ALIGN_BOTTOM );
461 if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::VerticalAlignment >( propertyValue.Get< std::string >().c_str(),
462 VERTICAL_ALIGNMENT_STRING_TABLE,
463 VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
466 mController->SetVerticalAlignment( alignment );
470 case Toolkit::TextVisual::Property::TEXT_COLOR:
472 const Vector4 textColor = propertyValue.Get< Vector4 >();
473 if( mController->GetTextColor() != textColor )
475 mController->SetTextColor( textColor );
480 case Toolkit::TextVisual::Property::ENABLE_MARKUP:
482 const bool enableMarkup = propertyValue.Get<bool>();
483 mController->SetMarkupProcessorEnabled( enableMarkup );
486 case Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL:
491 case Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED:
496 case Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT:
501 case Toolkit::TextVisual::Property::AUTO_SCROLL_GAP:
506 case Toolkit::TextVisual::Property::LINE_SPACING:
508 const float lineSpacing = propertyValue.Get<float>();
509 mController->SetDefaultLineSpacing( lineSpacing );
513 case Toolkit::TextVisual::Property::UNDERLINE:
515 // TODO : This switch can be removed when the deprecated SHADOW_OFFSET and SHADOW_COLOR properties are finally removed.
516 // Only the code for the MAP case should be kept.
517 switch( propertyValue.GetType() )
519 case Property::VECTOR4:
521 const Vector4 color = propertyValue.Get<Vector4>();
522 if( mController->GetUnderlineColor() != color )
524 mController->SetUnderlineColor( color );
529 case Property::FLOAT:
531 float height = propertyValue.Get<float>();
532 if( fabsf( mController->GetUnderlineHeight() - height ) > Math::MACHINE_EPSILON_1000 )
534 mController->SetUnderlineHeight( height );
539 case Property::BOOLEAN:
541 const bool enabled = propertyValue.Get<bool>();
542 if( mController->IsUnderlineEnabled() != enabled )
544 mController->SetUnderlineEnabled( enabled );
551 const bool update = SetUnderlineProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
567 case Toolkit::TextVisual::Property::SHADOW:
569 // TODO : This switch can be removed when the deprecated SHADOW_OFFSET and SHADOW_COLOR properties are finally removed.
570 // Only the code for the MAP case should be kept.
571 switch( propertyValue.GetType() )
573 case Property::VECTOR2:
575 const Vector2 shadowOffset = propertyValue.Get<Vector2>();
576 if( mController->GetShadowOffset() != shadowOffset )
578 mController->SetShadowOffset( shadowOffset );
583 case Property::VECTOR4:
585 const Vector4 shadowColor = propertyValue.Get<Vector4>();
586 if( mController->GetShadowColor() != shadowColor )
588 mController->SetShadowColor( shadowColor );
595 const bool update = SetShadowProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
610 case Toolkit::TextVisual::Property::EMBOSS:
612 const bool update = SetEmbossProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
619 case Toolkit::TextVisual::Property::OUTLINE:
621 const bool update = SetOutlineProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
628 case Toolkit::TextVisual::Property::BATCHING_ENABLED:
635 // Should not arrive here.
636 DALI_ASSERT_DEBUG( false );
641 Dali::Property::Value TextVisual::DoGetProperty( Dali::Property::Index index )
643 Dali::Property::Value value;
647 case Toolkit::TextVisual::Property::RENDERING_BACKEND:
649 value = mRenderingBackend;
652 case Toolkit::TextVisual::Property::TEXT:
655 mController->GetText( text );
659 case Toolkit::TextVisual::Property::FONT_FAMILY:
661 value = mController->GetDefaultFontFamily();
664 case Toolkit::TextVisual::Property::FONT_STYLE:
666 GetFontStyleProperty( mController, value, Text::FontStyle::DEFAULT );
669 case Toolkit::TextVisual::Property::POINT_SIZE:
671 value = mController->GetDefaultPointSize();
674 case Toolkit::TextVisual::Property::MULTI_LINE:
676 value = mController->IsMultiLineEnabled();
679 case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT:
681 const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( mController->GetHorizontalAlignment(),
682 HORIZONTAL_ALIGNMENT_STRING_TABLE,
683 HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
686 value = std::string( name );
690 case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT:
692 const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( mController->GetVerticalAlignment(),
693 VERTICAL_ALIGNMENT_STRING_TABLE,
694 VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
697 value = std::string( name );
701 case Toolkit::TextVisual::Property::TEXT_COLOR:
703 value = mController->GetTextColor();
706 case Toolkit::TextVisual::Property::ENABLE_MARKUP:
708 value = mController->IsMarkupProcessorEnabled();
711 case Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL:
716 case Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED:
721 case Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT:
726 case Toolkit::TextVisual::Property::AUTO_SCROLL_GAP:
731 case Toolkit::TextVisual::Property::LINE_SPACING:
733 value = mController->GetDefaultLineSpacing();
736 case Toolkit::TextVisual::Property::UNDERLINE:
738 GetUnderlineProperties( mController, value, Text::EffectStyle::DEFAULT );
741 case Toolkit::TextVisual::Property::SHADOW:
743 GetShadowProperties( mController, value, Text::EffectStyle::DEFAULT );
746 case Toolkit::TextVisual::Property::EMBOSS:
748 GetEmbossProperties( mController, value, Text::EffectStyle::DEFAULT );
751 case Toolkit::TextVisual::Property::OUTLINE:
753 GetOutlineProperties( mController, value, Text::EffectStyle::DEFAULT );
756 case Toolkit::TextVisual::Property::BATCHING_ENABLED:
763 // Should not arrive here.
764 DALI_ASSERT_DEBUG( false );
771 void TextVisual::RenderText()
773 Actor self = mSelf.GetHandle();
776 // Nothing to do if the handle is not initialized.
780 Actor renderableActor;
784 renderableActor = mRenderer->Render( mController->GetView(), Toolkit::DepthIndex::TEXT );
787 if( renderableActor != mRenderableActor )
789 UnparentAndReset( mRenderableActor );
791 if( renderableActor )
793 const Vector2& scrollOffset = mController->GetScrollPosition();
794 renderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
796 self.Add( renderableActor );
798 mRenderableActor = renderableActor;
802 } // namespace Internal
804 } // namespace Toolkit