Change-Id: Iad29ca658c92f1bee620e39b3164f4fc2fff6d54
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
mDepth = depth;
const Vector2& actorSize( view.GetControlSize() );
mDepth = depth;
const Vector2& actorSize( view.GetControlSize() );
- const Vector2 halfActorSize( actorSize * 0.5f );
+ const Vector2& textSize( view.GetActualSize() );
+ const Vector2 halfTextSize( textSize * 0.5f );
const Vector2& shadowOffset( view.GetShadowOffset() );
const Vector4& shadowColor( view.GetShadowColor() );
const bool underlineEnabled( view.IsUnderlineEnabled() );
const Vector2& shadowOffset( view.GetShadowOffset() );
const Vector4& shadowColor( view.GetShadowColor() );
const bool underlineEnabled( view.IsUnderlineEnabled() );
}
// Move the origin (0,0) of the mesh to the center of the actor
}
// Move the origin (0,0) of the mesh to the center of the actor
- const Vector2 position = *( positionsBuffer + i ) - halfActorSize;
+ const Vector2 position = *( positionsBuffer + i ) - halfTextSize;
// Generate mesh data for this quad, plugging in our supplied position
AtlasManager::Mesh2D newMesh;
// Generate mesh data for this quad, plugging in our supplied position
AtlasManager::Mesh2D newMesh;
{
MeshRecord& meshRecord = *it;
{
MeshRecord& meshRecord = *it;
- Actor actor = CreateMeshActor( meshRecord, actorSize );
+ Actor actor = CreateMeshActor( meshRecord, textSize );
// Create an effect if necessary
if( style == STYLE_DROP_SHADOW )
// Create an effect if necessary
if( style == STYLE_DROP_SHADOW )
containerActor.SetParentOrigin( ParentOrigin::CENTER );
containerActor.SetSize( actorSize );
containerActor.SetParentOrigin( ParentOrigin::CENTER );
containerActor.SetSize( actorSize );
- Actor shadowActor = CreateMeshActor( meshRecord, actorSize );
+ Actor shadowActor = CreateMeshActor( meshRecord, textSize );
#if defined(DEBUG_ENABLED)
shadowActor.SetName( "Text Shadow renderable actor" );
#endif
#if defined(DEBUG_ENABLED)
shadowActor.SetName( "Text Shadow renderable actor" );
#endif
Dali::Renderer renderer( shadowActor.GetRendererAt( 0 ) );
int depthIndex = renderer.GetProperty<int>(Dali::Renderer::Property::DEPTH_INDEX);
renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex - 1 );
Dali::Renderer renderer( shadowActor.GetRendererAt( 0 ) );
int depthIndex = renderer.GetProperty<int>(Dali::Renderer::Property::DEPTH_INDEX);
renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex - 1 );
- shadowActor.SetParentOrigin( ParentOrigin::CENTER );
- shadowActor.SetSize( actorSize );
containerActor.Add( shadowActor );
containerActor.Add( actor );
actor = containerActor;
containerActor.Add( shadowActor );
containerActor.Add( actor );
actor = containerActor;
actor.SetName( "Text renderable actor" );
#endif
actor.AddRenderer( renderer );
actor.SetName( "Text renderable actor" );
#endif
actor.AddRenderer( renderer );
- actor.SetParentOrigin( ParentOrigin::CENTER ); // Keep all of the origins aligned
+
+ // Keep all of the origins aligned
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
actor.SetSize( actorSize );
actor.RegisterProperty("uOffset", Vector2::ZERO );
return actor;
actor.SetSize( actorSize );
actor.RegisterProperty("uOffset", Vector2::ZERO );
return actor;
virtual const Vector2& GetControlSize() const = 0;
/**
virtual const Vector2& GetControlSize() const = 0;
/**
+ * @brief Retrieves the text's actual size after it has been laid out.
+ *
+ * @return The text's size. Note that this may be larger than the control size,
+ * in the case where text is scrolling/clipped.
+ */
+ virtual const Vector2& GetActualSize() const = 0;
+
+ /**
* Retrieves the number of glyphs.
*
* @return The number of glyphs.
* Retrieves the number of glyphs.
*
* @return The number of glyphs.
+const Vector2& View::GetActualSize() const
+{
+ if ( mImpl->mVisualModel )
+ {
+ return mImpl->mVisualModel->GetActualSize();
+ }
+
+ return Vector2::ZERO;
+}
+
Length View::GetNumberOfGlyphs() const
{
if( mImpl->mVisualModel )
Length View::GetNumberOfGlyphs() const
{
if( mImpl->mVisualModel )
virtual const Vector2& GetControlSize() const;
/**
virtual const Vector2& GetControlSize() const;
/**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetActualSize()
+ */
+ virtual const Vector2& GetActualSize() const;
+
+ /**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
*/
virtual Length GetNumberOfGlyphs() const;
* @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
*/
virtual Length GetNumberOfGlyphs() const;