namespace
{
+const char* const PROPERTY_TEXT = "text";
+const char* const PROPERTY_MULTILINE_POLICY = "multiline-policy";
+const char* const PROPERTY_WIDTH_EXCEED_POLICY = "width-exceed-policy";
+const char* const PROPERTY_HEIGHT_EXCEED_POLICY = "height-exceed-policy";
+const char* const PROPERTY_LINE_JUSTIFICATION = "line-justification";
+const char* const PROPERTY_FADE_BOUNDARY_LEFT = "fade-boundary-left";
+const char* const PROPERTY_FADE_BOUNDARY_RIGHT = "fade-boundary-right";
+const char* const PROPERTY_FADE_BOUNDARY_TOP = "fade-boundary-top";
+const char* const PROPERTY_FADE_BOUNDARY_BOTTOM = "fade-boundary-bottom";
+const char* const PROPERTY_LINE_HEIGHT_OFFSET = "line-height-offset";
+const char* const PROPERTY_HORIZONTAL_ALIGNMENT = "horizontal-alignment";
+const char* const PROPERTY_VERTICAL_ALIGNMENT = "vertical-alignment";
+
// Currently on desktop machines 2k x 2k is the maximum frame buffer size, on target is 4k x 4k.
const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f;
if( ( textViewSize.width > Math::MACHINE_EPSILON_1000 ) &&
( textViewSize.height > Math::MACHINE_EPSILON_1000 ) )
{
- // Check if the text-view has text-actors.
- const bool hasTextActors = !mRelayoutData.mTextActors.empty();
+ // Check if the text-view has glyph-actors.
+ const bool hasGlyphActors = !mRelayoutData.mGlyphActors.empty();
RelayoutOperationMask mask = NO_RELAYOUT;
if( relayoutSizeAndPositionNeeded )
mask = static_cast<RelayoutOperationMask>( mask | RELAYOUT_VISIBILITY );
}
- if( hasTextActors )
+ if( hasGlyphActors )
{
- // Remove text-actors from the text-view as some text-operation like CreateTextInfo()
+ // Remove glyph-actors from the text-view as some text-operation like CreateTextInfo()
// add them to the text-actor cache.
- TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
- mRelayoutData.mTextActors.clear();
+ TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+ mRelayoutData.mGlyphActors.clear();
}
- // Relays-out but doesn't add text-actors to the text-view.
+ // Relays-out but doesn't add glyph-actors to the text-view.
DoRelayOut( textViewSize.GetVectorXY(), mask );
- if( hasTextActors )
+ if( hasGlyphActors )
{
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
{
mVisualParameters.mSortModifier = depthOffset;
- for( std::vector<TextActor>::iterator it = mRelayoutData.mTextActors.begin(), endIt = mRelayoutData.mTextActors.end();
+ for( std::vector<RenderableActor>::iterator it = mRelayoutData.mGlyphActors.begin(), endIt = mRelayoutData.mGlyphActors.end();
it != endIt;
++it )
{
{
if( enable != mVisualParameters.mSnapshotModeEnabled )
{
- // Remove first all text-actors
- if( !mRelayoutData.mTextActors.empty() )
+ // Remove first all glyph-actors
+ if( !mRelayoutData.mGlyphActors.empty() )
{
- TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
+ TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
}
mVisualParameters.mSnapshotModeEnabled = enable;
Actor self = Self();
self.Add( mOffscreenRootActor );
self.Add( mOffscreenImageActor );
+ mOffscreenImageActor.SetScale(Vector3(1.f, -1.f, 1.f));
}
else
{
mTextLayoutInfo(),
mCharacterLogicalToVisualMap(),
mCharacterVisualToLogicalMap(),
- mTextActors(),
+ mGlyphActors(),
mCharacterLayoutInfoTable(),
mLines(),
mTextSizeForRelayoutOption()
mTextLayoutInfo( relayoutData.mTextLayoutInfo ),
mCharacterLogicalToVisualMap( relayoutData.mCharacterLogicalToVisualMap ),
mCharacterVisualToLogicalMap( relayoutData.mCharacterVisualToLogicalMap ),
- mTextActors( relayoutData.mTextActors ),
+ mGlyphActors( relayoutData.mGlyphActors ),
mCharacterLayoutInfoTable( relayoutData.mCharacterLayoutInfoTable ),
mLines( relayoutData.mLines ),
mTextSizeForRelayoutOption( relayoutData.mTextSizeForRelayoutOption )
mTextLayoutInfo = relayoutData.mTextLayoutInfo;
mCharacterLogicalToVisualMap = relayoutData.mCharacterLogicalToVisualMap;
mCharacterVisualToLogicalMap = relayoutData.mCharacterVisualToLogicalMap;
- mTextActors = relayoutData.mTextActors;
+ mGlyphActors = relayoutData.mGlyphActors;
mCharacterLayoutInfoTable = relayoutData.mCharacterLayoutInfoTable;
mLines = relayoutData.mLines;
mTextSizeForRelayoutOption = relayoutData.mTextSizeForRelayoutOption;
{
// There are SetText, Inserts or Removes to do. It means the current layout info is not updated.
- if( !mRelayoutData.mTextActors.empty() )
+ if( !mRelayoutData.mGlyphActors.empty() )
{
- // Remove text-actors from the text-view as some text-operation like CreateTextInfo()
+ // Remove glyph-actors from the text-view as some text-operation like CreateTextInfo()
// add them to the text-actor cache.
- TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
- mRelayoutData.mTextActors.clear();
+ TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+ mRelayoutData.mGlyphActors.clear();
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
// Check if the given width is different than the current one.
const bool differentWidth = ( fabsf( width - mRelayoutData.mTextViewSize.width ) > Math::MACHINE_EPSILON_1000 );
- // Check if the text-view has text-actors.
- const bool hasTextActors = !mRelayoutData.mTextActors.empty();
+ // Check if the text-view has glyph-actors.
+ const bool hasGlyphActors = !mRelayoutData.mGlyphActors.empty();
// Check which layout operations need to be done.
const bool relayoutSizeAndPositionNeeded = ( mRelayoutOperations & RELAYOUT_SIZE_POSITION ) || differentWidth;
if( relayoutSizeAndPositionNeeded )
{
- if( hasTextActors )
+ if( hasGlyphActors )
{
- // Remove text-actors from the text-view as some text-operation like CreateTextInfo()
+ // Remove glyph-actors from the text-view as some text-operation like CreateTextInfo()
// add them to the text-actor cache.
- TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
- mRelayoutData.mTextActors.clear();
+ TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+ mRelayoutData.mGlyphActors.clear();
}
// Use the given width.
const Vector2 textViewSize( width, GetControlSize().height );
- // Relays-out but doesn't add text-actors to the text-view.
+ // Relays-out but doesn't add glyph-actors to the text-view.
DoRelayOut( textViewSize, RELAYOUT_SIZE_POSITION );
}
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_SIZE_POSITION );
}
- if( hasTextActors )
+ if( hasGlyphActors )
{
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_VIEW );
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations | RELAYOUT_INSERT_TO_TEXT_ACTOR_LIST );
}
- if( differentWidth || hasTextActors )
+ if( differentWidth || hasGlyphActors )
{
RelayoutRequest();
}
{
Actor self = Self();
- mPropertyText = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_TEXT, "", Property::READ_WRITE );
+ mPropertyText = self.RegisterProperty( PROPERTY_TEXT, "", Property::READ_WRITE );
- mPropertyMultilinePolicy = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_MULTILINE_POLICY, "SplitByNewLineChar", Property::READ_WRITE );
+ mPropertyMultilinePolicy = self.RegisterProperty( PROPERTY_MULTILINE_POLICY, "SplitByNewLineChar", Property::READ_WRITE );
- mPropertyWidthExceedPolicy = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_WIDTH_EXCEED_POLICY, "Original", Property::READ_WRITE );
+ mPropertyWidthExceedPolicy = self.RegisterProperty( PROPERTY_WIDTH_EXCEED_POLICY, "Original", Property::READ_WRITE );
- mPropertyHeightExceedPolicy = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_HEIGHT_EXCEED_POLICY, "Original", Property::READ_WRITE );
+ mPropertyHeightExceedPolicy = self.RegisterProperty( PROPERTY_HEIGHT_EXCEED_POLICY, "Original", Property::READ_WRITE );
- mPropertyLineJustification = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_LINE_JUSTIFICATION, "Left", Property::READ_WRITE );
+ mPropertyLineJustification = self.RegisterProperty( PROPERTY_LINE_JUSTIFICATION, "Left", Property::READ_WRITE );
- mPropertyFadeBoundaryLeft = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_FADE_BOUNDARY_LEFT, static_cast< int >( 0 ), Property::READ_WRITE );
+ mPropertyFadeBoundaryLeft = self.RegisterProperty( PROPERTY_FADE_BOUNDARY_LEFT, static_cast< int >( 0 ), Property::READ_WRITE );
- mPropertyFadeBoundaryRight = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_FADE_BOUNDARY_RIGHT, static_cast< int >( 0 ), Property::READ_WRITE );
+ mPropertyFadeBoundaryRight = self.RegisterProperty( PROPERTY_FADE_BOUNDARY_RIGHT, static_cast< int >( 0 ), Property::READ_WRITE );
- mPropertyFadeBoundaryTop = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_FADE_BOUNDARY_TOP, static_cast< int >( 0 ), Property::READ_WRITE );
+ mPropertyFadeBoundaryTop = self.RegisterProperty( PROPERTY_FADE_BOUNDARY_TOP, static_cast< int >( 0 ), Property::READ_WRITE );
- mPropertyFadeBoundaryBottom = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_FADE_BOUNDARY_BOTTOM, static_cast< int >( 0 ), Property::READ_WRITE );
+ mPropertyFadeBoundaryBottom = self.RegisterProperty( PROPERTY_FADE_BOUNDARY_BOTTOM, static_cast< int >( 0 ), Property::READ_WRITE );
- mPropertyLineHeightOffset = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_LINE_HEIGHT_OFFSET, 0.0f, Property::READ_WRITE );
+ mPropertyLineHeightOffset = self.RegisterProperty( PROPERTY_LINE_HEIGHT_OFFSET, 0.0f, Property::READ_WRITE );
- mPropertyHorizontalAlignment = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_HORIZONTAL_ALIGNMENT, "HorizontalCenter", Property::READ_WRITE );
+ mPropertyHorizontalAlignment = self.RegisterProperty( PROPERTY_HORIZONTAL_ALIGNMENT, "HorizontalCenter", Property::READ_WRITE );
- mPropertyVerticalAlignment = self.RegisterProperty( Dali::Toolkit::TextView::PROPERTY_VERTICAL_ALIGNMENT, "VerticalCenter", Property::READ_WRITE );
+ mPropertyVerticalAlignment = self.RegisterProperty( PROPERTY_VERTICAL_ALIGNMENT, "VerticalCenter", Property::READ_WRITE );
}
if( size != mRelayoutData.mTextViewSize )
{
- // if new size is different than the prevoius one, set positions and maybe sizes of all text-actor is needed.
+ // if new size is different than the prevoius one, set positions and maybe sizes of all glyph-actor is needed.
if( RELAYOUT_ALL != mRelayoutOperations )
{
mRelayoutOperations = static_cast<RelayoutOperationMask>( mRelayoutOperations |
}
}
- // Remove text-actors from text-view
- if( !mRelayoutData.mTextActors.empty() && ( mRelayoutOperations & RELAYOUT_REMOVE_TEXT_ACTORS ) )
+ // Remove glyph-actors from text-view
+ if( !mRelayoutData.mGlyphActors.empty() && ( mRelayoutOperations & RELAYOUT_REMOVE_TEXT_ACTORS ) )
{
- TextViewRelayout::RemoveTextActors( GetRootActor(), mRelayoutData.mTextActors );
- mRelayoutData.mTextActors.clear();
+ TextViewRelayout::RemoveGlyphActors( GetRootActor(), mRelayoutData.mGlyphActors );
+ mRelayoutData.mGlyphActors.clear();
}
if( NO_RELAYOUT != mRelayoutOperations )
{
- // Relays-out and add text-actors to the text-view.
+ // Relays-out and add glyph-actors to the text-view.
DoRelayOut( size, mRelayoutOperations );
ProcessSnapshot( size );
}
void TextView::DoRelayOut( const Size& textViewSize, const RelayoutOperationMask relayoutOperationMask )
{
- // Traverse the relayout operation vector. It fills the natural size, layout and text-actor data structures.
+ // Traverse the relayout operation vector. It fills the natural size, layout and glyph-actor data structures.
if( !mTextViewProcessorOperations.empty() )
{
PerformTextViewProcessorOperations();
mOffscreenCameraActor = CameraActor::New();
mOffscreenCameraActor.SetParentOrigin( ParentOrigin::CENTER );
mOffscreenCameraActor.SetAnchorPoint( AnchorPoint::CENTER );
+ mOffscreenCameraActor.SetRotation(Degree(180.f), Vector3::YAXIS);
mOffscreenCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Inherits position from the offscreen root actor.
mOffscreenRootActor.Add( mOffscreenCameraActor ); // camera to shoot the offscreen text
-
- // Images are expected to be from top to bottom, but OpenGL buffers are bottom to top
- mOffscreenCameraActor.SetInvertYAxis( false );
}
// Calculate camera parameters for current text size.
if( mOffscreenRootActor )
{
- // If there is a render-task it needs to be refreshed. Therefore text-actors need to be
+ // If there is a render-task it needs to be refreshed. Therefore glyph-actors need to be
// set to visible.
mOffscreenRootActor.SetVisible( true );
}