std::string input;
std::size_t position;
std::size_t lineIndex;
- std::size_t groupIndex;
std::size_t wordIndex;
std::size_t characterIndex;
};
/**
- * Gets the line, group, word, and character indices for a given text and a given position and checks the results with the given indices.
+ * Gets the line, word, and character indices for a given text and a given position and checks the results with the given indices.
*
* If the test fails it prints a short description and the line where this function was called.
*
* @param input The input text.
* @param position Global position of the character. i.e in a text with with 1000 characters, position could be any value from 0 to 1000.
* @param resultLineIndex Index to the line where the character is located.
- * @param resultGroupIndex Index to the group within the line where the character is located.
- * @param resultWordIndex Index to the word within the group where the character is located.
+ * @param resultWordIndex Index to the word within the line where the character is located.
* @param resultCharacterIndex Index to the character within the word where the character is located.
* @param location Where this function has been called.
*
const std::string& input,
const std::size_t position,
const std::size_t resultLineIndex,
- const std::size_t resultGroupIndex,
const std::size_t resultWordIndex,
const std::size_t resultCharacterIndex,
const char* location )
tet_printf( "Fail. different line index. %s", location );
return false;
}
- if( indices.mGroupIndex != resultGroupIndex )
- {
- tet_printf( "Fail. different group index. %s", location );
- return false;
- }
if( indices.mWordIndex != resultWordIndex )
{
tet_printf( "Fail. different word index. %s", location );
0,
0,
0,
- 0,
0
},
{
76,
4,
0,
- 0,
0
},
{
75,
3,
0,
- 0,
0
},
{
"\n" ),
35,
1,
- 1,
- 0,
+ 4,
0
},
{
3,
0,
0,
- 0,
3
},
- /* TODO Check for mixed RTL and LTR text.
{
std::string( "Test position 33. (end of the second word of the second line)" ),
std::string( "text te<font size='30'>xt text text text\n</font>"
"\n" ),
33,
1,
- 0,
2,
3
},
"\n" ),
43,
1,
- 1,
- 3,
+ 6,
3
},
- */
};
- const std::size_t numberOfTests( 5 );
+ const std::size_t numberOfTests( 7 );
for( std::size_t index = 0; index < numberOfTests; ++index )
{
const GetIndicesFromGlobalCharacterIndexTest& test = getIndicesFromGlobalCharacterIndexTests[index];
- if( !TestGetIndicesFromGlobalCharacterIndex( test.description, test.input, test.position, test.lineIndex, test.groupIndex, test.wordIndex, test.characterIndex, TEST_LOCATION ) )
+ if( !TestGetIndicesFromGlobalCharacterIndex( test.description, test.input, test.position, test.lineIndex, test.wordIndex, test.characterIndex, TEST_LOCATION ) )
{
tet_result( TET_FAIL );
}
TextViewProcessor::TextInfoIndices indices;
DALI_TEST_EQUALS( indices.mLineIndex, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( indices.mGroupIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( indices.mWordIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( indices.mCharacterIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( wordLayoutInfo.mType, TextViewProcessor::NoSeparator, TEST_LOCATION );
DALI_TEST_EQUALS( wordLayoutInfo.mCharactersLayoutInfo.size(), 0u, TEST_LOCATION );
- TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo;
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::LTR, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mWordsLayoutInfo.size(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
-
TextViewProcessor::LineLayoutInfo lineLayoutInfo;
DALI_TEST_EQUALS( lineLayoutInfo.mSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( lineLayoutInfo.mAscender, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( lineLayoutInfo.mLineHeightOffset, 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( lineLayoutInfo.mWordGroupsLayoutInfo.size(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( lineLayoutInfo.mWordsLayoutInfo.size(), 0u, TEST_LOCATION );
DALI_TEST_EQUALS( lineLayoutInfo.mNumberOfCharacters, 0u, TEST_LOCATION );
TextViewProcessor::TextLayoutInfo textLayoutInfo;
DALI_TEST_EQUALS( wordLayoutInfo2.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( wordLayoutInfo2.mType, TextViewProcessor::LineSeparator, TEST_LOCATION );
-
- TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo;
- wordGroupLayoutInfo.mSize = Vector2( 1.f, 1.f );
- wordGroupLayoutInfo.mAscender = 1.f;
- wordGroupLayoutInfo.mDirection = TextViewProcessor::RTL;
- wordGroupLayoutInfo.mNumberOfCharacters = 1u;
-
- TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo1;
- wordGroupLayoutInfo1 = wordGroupLayoutInfo;
-
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION );
-
- TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo2( wordGroupLayoutInfo );
-
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mSize, Vector2( 1.f, 1.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mAscender, 1.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mDirection, TextViewProcessor::RTL, TEST_LOCATION );
- DALI_TEST_EQUALS( wordGroupLayoutInfo.mNumberOfCharacters, 1u, TEST_LOCATION );
-
-
TextViewProcessor::LineLayoutInfo lineLayoutInfo;
lineLayoutInfo.mSize = Vector2( 1.f, 1.f );
lineLayoutInfo.mAscender = 1.f;
tet_infoline("UtcDaliTextViewEqualityOperator : ");
TextViewProcessor::TextInfoIndices indices;
- TextViewProcessor::TextInfoIndices indices1( 1u, 1u, 1u, 1u );
+ TextViewProcessor::TextInfoIndices indices1( 1u, 1u, 1u );
DALI_TEST_CHECK( !( indices == indices1 ) );
std::string description;
std::string inputLine;
float parentWidth;
- std::size_t groupIndex;
std::size_t wordIndex;
std::size_t characterIndex;
+ std::size_t characterLineIndex;
TextViewRelayout::HorizontalWrapType splitPolicy;
float shrinkFactor;
// Prepare input parameters and the result structure and call the function to be tested.
// Creaqte indices.
- TextViewProcessor::TextInfoIndices indices( 0, test.groupIndex, test.wordIndex, test.characterIndex );
+ TextViewProcessor::TextInfoIndices indices( 0u, test.wordIndex, test.characterIndex );
// Get the input line.
TextViewProcessor::LineLayoutInfo inputLineLayout;
DALI_TEST_EQUALS( relayoutParameters.mWordSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mCharacterSize, Vector2::ZERO, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mIndices.mLineIndex, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( relayoutParameters.mIndices.mGroupIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mIndices.mWordIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mIndices.mCharacterIndex, 0u, TEST_LOCATION );
DALI_TEST_EQUALS( relayoutParameters.mCharacterGlobalIndex, 0u, TEST_LOCATION );
"The line is wraped by character. All characters have the same size.",
"Hello world", // input line
100.f, // parent width
+ 0, // indices
0,
- 0, // indices
0,
TextViewRelayout::WrapByCharacter, // split policy
1.f,
"The line is wraped by character. There are characters with different sizes.",
"Hello <font size='14'>world</font>", // input line
100.f, // parent width
- 0,
0, // indices
0,
+ 0,
TextViewRelayout::WrapByCharacter, // split policy
1.f,
// results
"The line is wraped by character. There are characters with different sizes. It calculates the layout for the second line.",
"Hello <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // input line
100.f, // parent width
- 0,
2, // indices. The third character of the third word starts in a new line.
2,
+ 8,
TextViewRelayout::WrapByCharacter, // split policy
1.f,
// results
"The line is wraped by character. There are characters with different sizes. It calculates the layout for the third line.",
"Hello <font size='14'>wo</font>rld hell<font size='14'>o world</font>", // input line
100.f, // parent width
- 0,
4, // indices. The fifth character of the fifth word starts in a new line.
4,
+ 16,
TextViewRelayout::WrapByCharacter, // split policy
1.f,
// results
"The line is wraped by word. All characters have the same size.",
"Hello world", // input line
100.f, // parent width
- 0,
0, // indices. It shouldn't use the index character so 9999999 shouldn't make it crash.
9999999,
+ 9999999,
TextViewRelayout::WrapByWord, // split policy
1.f,
// results
"The line is wraped by word. There are characters with different sizes.",
"Hell<font size='14'>o</font> world", // input line
100.f, // parent width
- 0,
0, // indices.
0,
+ 0,
TextViewRelayout::WrapByWord, // split policy
1.f,
// results
"The line is wraped by word. There are characters with different sizes. It calculates the layout for the second line.",
"Hello <font size='14'>wo</font>rld <font size='16'>hello world</font>", // input line
100.f, // parent width
- 0,
2, // indices. The third word starts in a new line.
0,
+ 6,
TextViewRelayout::WrapByWord, // split policy
1.f,
// results
"The line is wraped by word. The word doen't fit.",
"Hello world", // input line
40.f, // parent width
- 0,
0, // indices. The third word starts in a new line.
0,
+ 0,
TextViewRelayout::WrapByWord, // split policy
1.f,
// results
"The line is wraped by word and by character. All characters have the same size. There is not a long word.",
"Hello world hello world", // input line
100.f, // parent width
- 0,
0, // indices.
0,
+ 0,
TextViewRelayout::WrapByWordAndSplit, // split policy
1.f,
// results
"The line is wraped by word and by character. All characters have the same size. There is a long word.",
"Helloooooooo world", // input line
100.f, // parent width
- 0,
0, // indices.
0,
+ 0,
TextViewRelayout::WrapByWordAndSplit, // split policy
1.f,
// results
"The line is wraped by word and by character. There are characters with different sizes. There is a long word. It calculates the layout for the second line.",
"Helloooooooo <font size='14'>world</font>", // input line
100.f, // parent width
- 0,
0, // indices.
8,
+ 8,
TextViewRelayout::WrapByWordAndSplit, // split policy
1.f,
// results
"The line is wraped by word and by character. There are characters with different sizes. There is a shrink factor.",
"Helloooooooo<font size='14'> world</font>", // input line
100.f, // parent width
- 0,
0, // indices.
8,
+ 8,
TextViewRelayout::WrapByWordAndSplit, // split policy
0.7f,
// results
"The line is wraped by end of line and by character. All characters have the same size.",
"Hello world", // input line
100.f, // parent width
- 0,
0, // indices
0,
+ 0,
TextViewRelayout::WrapByLineAndSplit, // split policy
1.f,
// results
"The line fits in the width.",
"Hello", // input line
100.f, // parent width
- 0,
0, // indices
0,
+ 0,
TextViewRelayout::WrapByLineAndSplit, // split policy
1.f,
// results
"The line is wraped by end of line and by character. All characters have the same size. It calculates the layout for the second line.",
"Hello world, hello world", // input line
100.f, // parent width
- 0,
2, // indices
2,
+ 8,
TextViewRelayout::WrapByLineAndSplit, // split policy
1.f,
// results
// Internal headers are allowed here
#include <dali-toolkit/internal/controls/text-view/text-view-processor.h>
+#include <dali-toolkit/internal/controls/text-view/text-view-processor-dbg.h>
#include <dali-toolkit/internal/controls/text-view/text-view-line-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
#include <dali-toolkit/internal/controls/text-view/relayout-utilities.h>
std::string lastResult;
};
-struct SplitWordGroupTest
-{
- std::string description;
- std::string input;
- std::size_t wordPosition;
- std::size_t position;
- std::string firstResult;
- std::string lastResult;
-};
-
struct SplitLineTest
{
std::string description;
std::string input;
- std::size_t groupPosition;
- std::size_t wordPosition;
- std::size_t position;
+ std::size_t wordIndex;
+ std::size_t characterIndex;
float lineHeightOffset;
std::string firstResult;
std::string lastResult;
std::string result;
};
-struct MergeWordGroupsTest
-{
- std::string description;
- std::string inputFirst;
- std::string inputLast;
- std::string result;
-};
-
struct MergeLinesTest
{
std::string description;
std::string result;
};
-struct RemoveWordsFromGroupTest
+struct RemoveWordsFromLineTest
{
std::string description;
std::string input;
std::size_t wordIndex;
std::size_t numberOfWords;
- std::string result;
-};
-
-struct RemoveGroupsFromLineTest
-{
- std::string description;
- std::string input;
- std::size_t groupIndex;
- std::size_t numberOfGroups;
float lineHeightOffset;
std::string result;
};
std::cout << "]"; std::cout << std::endl;
}
-void Print( const TextViewProcessor::WordGroupLayoutInfo& wordGroup )
-{
- std::cout << "(";
- std::cout << " mSize : " << wordGroup.mSize << std::endl;
- std::cout << " mAscender : " << wordGroup.mAscender << std::endl;
- std::cout << " mDirection : " << wordGroup.mDirection << std::endl;
- std::cout << "mNumberOfCharacters : " << wordGroup.mNumberOfCharacters << std::endl;
- for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = wordGroup.mWordsLayoutInfo.begin(), endIt = wordGroup.mWordsLayoutInfo.end(); it != endIt; ++it )
- {
- Print( *it );
- }
- std::cout << ")"; std::cout << std::endl;
-}
-
void Print( const TextViewProcessor::LineLayoutInfo& line )
{
std::cout << "<";
std::cout << " mSize : " << line.mSize << std::endl;
std::cout << " mAscender : " << line.mAscender << std::endl;
std::cout << "mNumberOfCharacters : " << line.mNumberOfCharacters << std::endl;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it = line.mWordGroupsLayoutInfo.begin(), endIt = line.mWordGroupsLayoutInfo.end(); it != endIt; ++it )
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = line.mWordsLayoutInfo.begin(), endIt = line.mWordsLayoutInfo.end(); it != endIt; ++it )
{
Print( *it );
}
std::cout << "||" << std::endl;
}
-void Print( const TextStyle& style )
+std::string GetText( const TextViewProcessor::CharacterLayoutInfo& character )
+{
+ return character.mStyledText.mText.GetText();
+}
+
+std::string GetText( const TextViewProcessor::WordLayoutInfo& word )
+{
+ std::string text;
+
+ for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator it = word.mCharactersLayoutInfo.begin(), endIt = word.mCharactersLayoutInfo.end(); it != endIt; ++it )
+ {
+ text += GetText( *it );
+ }
+
+ return text;
+}
+
+std::string GetText( const TextViewProcessor::LineLayoutInfo& line )
{
- std::cout << " font name : " << style.GetFontName() << std::endl;
- std::cout << " : " << style.GetFontStyle() << std::endl;
- std::cout << " : " << style.GetFontPointSize() << std::endl;
- std::cout << " : " << style.GetWeight() << std::endl;
- std::cout << " : " << style.GetTextColor() << std::endl;
- std::cout << " : " << style.IsItalicsEnabled() << std::endl;
- std::cout << " : " << style.IsUnderlineEnabled() << std::endl;
- std::cout << " : " << style.IsShadowEnabled() << std::endl;
- std::cout << " : " << style.GetShadowColor() << std::endl;
- std::cout << " : " << style.GetShadowOffset() << std::endl;
- std::cout << " : " << style.IsGlowEnabled() << std::endl;
- std::cout << " : " << style.GetGlowColor() << std::endl;
- std::cout << " : " << style.GetGlowIntensity() << std::endl;
- std::cout << " : " << style.GetSmoothEdge() << std::endl;
- std::cout << " : " << style.IsOutlineEnabled() << std::endl;
- std::cout << " : " << style.GetOutlineThickness() << std::endl;
+ std::string text;
+
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it = line.mWordsLayoutInfo.begin(), endIt = line.mWordsLayoutInfo.end(); it != endIt; ++it )
+ {
+ text += GetText( *it );
+ }
+
+ return text;
}
// Test functions used to check if two data structures are equal.
bool TestEqual( float x, float y )
{
- return ( fabsf( x - y ) < Math::MACHINE_EPSILON_1000 );
+ return ( fabsf( x - y ) < 0.001f );
}
bool TestEqual( const TextViewProcessor::CharacterLayoutInfo& character1,
if( style1 != style2 )
{
+ std::cout << " style1 : " << std::endl;
+ TextViewProcessor::dbgPrint( style1 );
+
+ std::cout << " style2 : " << std::endl;
+ TextViewProcessor::dbgPrint( style2 );
return false;
}
return true;
}
-bool TestEqual( const TextViewProcessor::WordGroupLayoutInfo& group1,
- const TextViewProcessor::WordGroupLayoutInfo& group2 )
-{
-
- if( group1.mNumberOfCharacters != group2.mNumberOfCharacters )
- {
- return false;
- }
-
- if( group1.mWordsLayoutInfo.size() != group2.mWordsLayoutInfo.size() )
- {
- return false;
- }
-
- if( !TestEqual( group1.mSize.x, group2.mSize.x ) )
- {
- return false;
- }
- if( !TestEqual( group1.mSize.y, group2.mSize.y ) )
- {
- return false;
- }
-
- if( !TestEqual( group1.mAscender, group2.mAscender ) )
- {
- return false;
- }
-
- if( group1.mDirection != group2.mDirection )
- {
- return false;
- }
-
- for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it1 = group1.mWordsLayoutInfo.begin(), endIt1 = group1.mWordsLayoutInfo.end(),
- it2 = group2.mWordsLayoutInfo.begin(), endIt2 = group2.mWordsLayoutInfo.end();
- ( it1 != endIt1 ) && ( it2 != endIt2 );
- ++it1, ++it2 )
- {
- if( !TestEqual( *it1, *it2 ) )
- {
- return false;
- }
- }
-
- return true;
-}
-
bool TestEqual( const TextViewProcessor::LineLayoutInfo& line1,
const TextViewProcessor::LineLayoutInfo& line2 )
{
return false;
}
- if( line1.mWordGroupsLayoutInfo.size() != line2.mWordGroupsLayoutInfo.size() )
+ if( line1.mWordsLayoutInfo.size() != line2.mWordsLayoutInfo.size() )
{
return false;
}
- for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator it1 = line1.mWordGroupsLayoutInfo.begin(), endIt1 = line1.mWordGroupsLayoutInfo.end(),
- it2 = line2.mWordGroupsLayoutInfo.begin(), endIt2 = line2.mWordGroupsLayoutInfo.end();
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator it1 = line1.mWordsLayoutInfo.begin(), endIt1 = line1.mWordsLayoutInfo.end(),
+ it2 = line2.mWordsLayoutInfo.begin(), endIt2 = line2.mWordsLayoutInfo.end();
( it1 != endIt1 ) && ( it2 != endIt2 );
++it1, ++it2 )
{
*/
bool TestSplitWord( const std::string& description, const std::string& input, const size_t position, const std::string& firstResult, const std::string& lastResult, const char* location )
{
- tet_printf( "%s", description.c_str() );
+ tet_printf( "%s\n", description.c_str() );
// Create layout info for the input word.
Toolkit::Internal::TextView::RelayoutData relayoutData;
if( !inputLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
+ inputWordLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
if( !firstResultLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- firstResultWordLayout = *( *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
+ firstResultWordLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
if( !lastResultLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- lastResultWordLayout = *( *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
+ lastResultWordLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
// Test results
if( !TestEqual( inputWordLayout, firstResultWordLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different layout info. %s\n", location );
return false;
}
if( !TestEqual( lastWordLayoutInfo, lastResultWordLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
- return false;
- }
-
- return true;
-}
-
-/**
- * Splits the \e input group of words in two by the given \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
- *
- * If the test fails it prints a short description and the line where this function was called.
- *
- * @param description Short description of the experiment. i.e. "Split the group of words from the beginning. (wordPosition 0 and position 0)".
- * @param input The input word.
- * @param wordPosition Index to the word within the group where to split the group.
- * @param position Where to split the word.
- * @param firstResult First part of the split group of words.
- * @param lastResult Last part of the split group of words.
- * @param location Where this function has been called.
- *
- * @return \e true if the experiment is successful. Otherwise returns \e false.
- */
-bool TestSplitWordGroup( const std::string& description,
- const std::string& input,
- const size_t wordPosition,
- const size_t position,
- const std::string& firstResult,
- const std::string& lastResult,
- const char* location )
-{
- tet_printf( "%s", description.c_str() );
-
- // Create layout info for the input group of words.
- Toolkit::Internal::TextView::RelayoutData relayoutData;
- TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray inputStyledText;
- MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
-
- TextViewProcessor::CreateTextInfo( inputStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- relayoutData );
-
- // Get the input group of words
- TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
-
- if( !inputLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Create layout info for the first part of the result (after split the group of words)
-
- Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
- TextViewProcessor::TextLayoutInfo& firstResultLayout( firstRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray firstResultStyledText;
- MarkupProcessor::GetStyledTextArray( firstResult, firstResultStyledText, true );
-
- TextViewProcessor::CreateTextInfo( firstResultStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- firstRelayoutData );
-
- // Get the first result group of words
- TextViewProcessor::WordGroupLayoutInfo firstResultWordGroupLayout;
-
- if( !firstResultLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *firstResultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- firstResultWordGroupLayout = *( *firstResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Create layout info for the last part of the result (after split the group of words)
-
- Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
- TextViewProcessor::TextLayoutInfo& lastResultLayout( lastRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray lastResultStyledText;
- MarkupProcessor::GetStyledTextArray( lastResult, lastResultStyledText, true );
-
- TextViewProcessor::CreateTextInfo( lastResultStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- lastRelayoutData );
-
- // Get the last result group of words
- TextViewProcessor::WordGroupLayoutInfo lastResultWordGroupLayout;
-
- if( !lastResultLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *lastResultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- lastResultWordGroupLayout = *( *lastResultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Split the group of words.
-
- TextViewProcessor::WordGroupLayoutInfo lastWordGroupLayoutInfo;
-
- TextViewProcessor::TextInfoIndices indices( 0, 0, wordPosition, position );
- SplitWordGroup( indices,
- inputWordGroupLayout,
- lastWordGroupLayoutInfo );
-
- // Test results
- if( !TestEqual( inputWordGroupLayout, firstResultWordGroupLayout ) )
- {
- tet_printf( "Fail. different layout info. %s", location );
- return false;
- }
-
- if( !TestEqual( lastWordGroupLayoutInfo, lastResultWordGroupLayout ) )
- {
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different layout info. %s\n", location );
return false;
}
}
/**
- * Splits the \e input line in two by the given \e groupPosition, \e wordPosition and \e position and checks the results with \e firstResult and \e lastResult.
+ * Splits the \e input line in two by the given \e wordIndex and \e characterIndex and checks the results with \e firstResult and \e lastResult.
*
* If the test fails it prints a short description and the line where this function was called.
*
- * @param description Short description of the experiment. i.e. "Split the line from the beginning. (groupPosition 0, wordPosition 0 and position 0)".
+ * @param description Short description of the experiment. i.e. "Split the line from the beginning. (wordIndex 0 and characterIndex 0)".
* @param input The input word.
- * @param groupPosition Index to the group of words within the line where to split the line.
- * @param wordPosition Index to the word within the group where to split the group.
- * @param position Where to split the word.
+ * @param wordIndex Index to the word within the line where to split it.
+ * @param characterIndex Where to split the word.
* @param lineHeightOffset Offset between lines.
* @param firstResult First part of the split line.
* @param lastResult Last part of the split line.
*/
bool TestSplitLine( const std::string& description,
const std::string& input,
- const size_t groupPosition,
- const size_t wordPosition,
- const size_t position,
+ const size_t wordIndex,
+ const size_t characterIndex,
const float lineHeightOffset,
const std::string& firstResult,
const std::string& lastResult,
const char* location )
{
- tet_printf( "%s", description.c_str() );
+ tet_printf( "%s\n", description.c_str() );
// Create layout info for the input line.
Toolkit::Internal::TextView::RelayoutData relayoutData;
TextViewProcessor::LineLayoutInfo lastLineLayoutInfo;
- TextViewProcessor::TextInfoIndices indices( 0, groupPosition, wordPosition, position );
+ TextViewProcessor::TextInfoIndices indices( 0, wordIndex, characterIndex );
+
SplitLine( indices,
PointSize( lineHeightOffset ),
inputLineLayout,
// Test results
if( !TestEqual( inputLineLayout, firstResultLineLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different first layout info. %s\n", location );
return false;
}
if( !TestEqual( lastLineLayoutInfo, lastResultLineLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different last layout info. %s\n", location );
return false;
}
*/
bool TestMergeWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
{
- tet_printf( "%s", description.c_str() );
+ tet_printf( "%s\n", description.c_str() );
// Create layout info for the inputFirst word.
Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
if( !inputFirstLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- inputFirstWordLayout = *( *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
+ inputFirstWordLayout = *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
if( !inputLastLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- inputLastWordLayout = *( *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
+ inputLastWordLayout = *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
if( !resultLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
+ resultWordLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
if( !TestEqual( inputFirstWordLayout, resultWordLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
- return false;
- }
-
- return true;
-}
-
-/**
- * Merges the \e inputFirst group of words and the \e inputLast group of words, and checks the results with \e result.
- *
- * If the test fails it prints a short description and the line where this function was called.
- *
- * @param description Short description of the experiment.
- * @param inputFirst The first part of the group of words.
- * @param inputLast The last part of the group of words.
- * @param result The merged group of word.
- * @param location Where this function has been called.
- *
- * @return \e true if the experiment is successful. Otherwise returns \e false.
- */
-bool TestMergeGroupsOfWords( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const std::string& result, const char* location )
-{
- tet_printf( "%s", description.c_str() );
-
- // Create layout info for the inputFirst group of word.
- Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
- TextViewProcessor::TextLayoutInfo& inputFirstLayout( firstRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray inputFirstStyledText;
- MarkupProcessor::GetStyledTextArray( inputFirst, inputFirstStyledText, true );
-
- TextViewProcessor::CreateTextInfo( inputFirstStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- firstRelayoutData );
-
- // Get the input group of words.
- TextViewProcessor::WordGroupLayoutInfo inputFirstWordGroupLayout;
-
- if( !inputFirstLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *inputFirstLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- inputFirstWordGroupLayout = *( *inputFirstLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Create layout info for the inputLast group of words.
- Toolkit::Internal::TextView::RelayoutData lastRelayoutData;
- TextViewProcessor::TextLayoutInfo& inputLastLayout( lastRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray inputLastStyledText;
- MarkupProcessor::GetStyledTextArray( inputLast, inputLastStyledText, true );
-
- TextViewProcessor::CreateTextInfo( inputLastStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- lastRelayoutData );
-
- // Get the input group of words
- TextViewProcessor::WordGroupLayoutInfo inputLastWordGroupLayout;
-
- if( !inputLastLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *inputLastLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- inputLastWordGroupLayout = *( *inputLastLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- // Create layout info for the result group of words.
- Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
- TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray resultStyledText;
- MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
-
- TextViewProcessor::CreateTextInfo( resultStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- resultRelayoutData );
-
- // Get the result word
- TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
-
- if( !resultLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
- }
- }
-
- MergeWordGroup( inputFirstWordGroupLayout,
- inputLastWordGroupLayout );
-
- if( !TestEqual( inputFirstWordGroupLayout, resultWordGroupLayout ) )
- {
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different layout info. %s\n", location );
return false;
}
*/
bool TestMergeLines( const std::string& description, const std::string& inputFirst, const std::string& inputLast, const float lineHeightOffset, const std::string& result, const char* location )
{
- tet_printf( "%s", description.c_str() );
+ tet_printf( "%s\n", description.c_str() );
// Create layout info for the inputFirst line.
Toolkit::Internal::TextView::RelayoutData firstRelayoutData;
MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
TextViewProcessor::CreateTextInfo( resultStyledText,
- Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
- Toolkit::TextView::Original,
- Toolkit::TextView::Original,
- static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
- Toolkit::TextView::Center,
- PointSize( lineHeightOffset ),
- std::string( "..." ),
- true ),
- resultRelayoutData );
-
- // Get the result word
- TextViewProcessor::LineLayoutInfo resultLineLayout;
-
- if( !resultLayout.mLinesLayoutInfo.empty() )
- {
- resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
- }
-
- MergeLine( inputFirstLineLayout,
- inputLastLineLayout );
-
- if( !TestEqual( inputFirstLineLayout, resultLineLayout ) )
- {
- tet_printf( "Fail. different layout info. %s", location );
- return false;
- }
-
- return true;
-}
-
-/**
- * Removes from the \e input word the \e numberOfCharacters characters starting from the given \e position and checks the results with \e result.
- *
- * If the test fails it prints a short description and the line where this function was called.
- *
- * @param description Short description of the experiment. i.e. "Remove a whole group of characters. Merge".
- * @param input The input word.
- * @param position Where to start to remove characters
- * @param numberOfCharacters The number of characters to remove.
- * @param result The word without the removed characters.
- * @param location Where this function has been called.
- *
- * @return \e true if the experiment is successful. Otherwise returns \e false.
- */
-bool TestRemoveCharactersFromWord( const std::string& description, const std::string& input, const std::size_t position, const std::size_t numberOfCharacters, const std::string& result, const char* location )
-{
- tet_printf( "%s", description.c_str() );
-
- // Create layout info for the input word.
- Toolkit::Internal::TextView::RelayoutData relayoutData;
- TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray inputStyledText;
- MarkupProcessor::GetStyledTextArray( input, inputStyledText, true );
-
- TextViewProcessor::CreateTextInfo( inputStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
- relayoutData );
-
- // Get the input word
- TextViewProcessor::WordLayoutInfo inputWordLayout;
-
- if( !inputLayout.mLinesLayoutInfo.empty() )
- {
- const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- inputWordLayout = *( *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
- }
- }
-
- // Create layout info for the result word.
- Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
- TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
-
- MarkupProcessor::StyledTextArray resultStyledText;
- MarkupProcessor::GetStyledTextArray( result, resultStyledText, true );
-
- TextViewProcessor::CreateTextInfo( resultStyledText,
- DEFAULT_LAYOUT_PARAMETERS,
+ Toolkit::Internal::TextView::LayoutParameters( Toolkit::TextView::SplitByNewLineChar,
+ Toolkit::TextView::Original,
+ Toolkit::TextView::Original,
+ static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
+ Toolkit::TextView::Center,
+ PointSize( lineHeightOffset ),
+ std::string( "..." ),
+ true ),
resultRelayoutData );
// Get the result word
- TextViewProcessor::WordLayoutInfo resultWordLayout;
+ TextViewProcessor::LineLayoutInfo resultLineLayout;
if( !resultLayout.mLinesLayoutInfo.empty() )
{
- const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
- {
- const TextViewProcessor::WordGroupLayoutInfo& group( *line.mWordGroupsLayoutInfo.begin() );
- if( !group.mWordsLayoutInfo.empty() )
- {
- resultWordLayout = *( *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
- }
- }
+ resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
}
- RemoveCharactersFromWord( position,
- numberOfCharacters,
- inputWordLayout );
+ MergeLine( inputFirstLineLayout,
+ inputLastLineLayout );
- if( !TestEqual( inputWordLayout, resultWordLayout ) )
+ if( !TestEqual( inputFirstLineLayout, resultLineLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different layout info. %s\n", location );
return false;
}
}
/**
- * Removes from the \e input group of words the \e numberOfWords words starting from the given \e wordIndex and checks the results with \e result.
+ * Removes from the \e input word the \e numberOfCharacters characters starting from the given \e position and checks the results with \e result.
*
* If the test fails it prints a short description and the line where this function was called.
*
- * @param description Short description of the experiment.
- * @param input The input group of words.
- * @param wordIndex Where to start to remove words.
- * @param numberOfWords The number of words to remove.
- * @param result The group of words without the removed words.
+ * @param description Short description of the experiment. i.e. "Remove a whole word. Merge".
+ * @param input The input word.
+ * @param position Where to start to remove characters
+ * @param numberOfCharacters The number of characters to remove.
+ * @param result The word without the removed characters.
* @param location Where this function has been called.
*
* @return \e true if the experiment is successful. Otherwise returns \e false.
*/
-bool TestRemoveWordsFromGroup( const std::string& description, const std::string& input, const std::size_t wordIndex, const std::size_t numberOfWords, const std::string& result, const char* location )
+bool TestRemoveCharactersFromWord( const std::string& description, const std::string& input, const std::size_t position, const std::size_t numberOfCharacters, const std::string& result, const char* location )
{
- tet_printf( "%s", description.c_str() );
+ tet_printf( "%s\n", description.c_str() );
- // Create layout info for the input group of words.
+ // Create layout info for the input word.
Toolkit::Internal::TextView::RelayoutData relayoutData;
TextViewProcessor::TextLayoutInfo& inputLayout( relayoutData.mTextLayoutInfo );
DEFAULT_LAYOUT_PARAMETERS,
relayoutData );
- // Get the input group of words
- TextViewProcessor::WordGroupLayoutInfo inputWordGroupLayout;
+ // Get the input word
+ TextViewProcessor::WordLayoutInfo inputWordLayout;
if( !inputLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *inputLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- inputWordGroupLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ inputWordLayout = *( *inputLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
- // Create layout info for the result group of words.
+ // Create layout info for the result word.
Toolkit::Internal::TextView::RelayoutData resultRelayoutData;
TextViewProcessor::TextLayoutInfo& resultLayout( resultRelayoutData.mTextLayoutInfo );
DEFAULT_LAYOUT_PARAMETERS,
resultRelayoutData );
- // Get the result group of words.
- TextViewProcessor::WordGroupLayoutInfo resultWordGroupLayout;
+ // Get the result word
+ TextViewProcessor::WordLayoutInfo resultWordLayout;
if( !resultLayout.mLinesLayoutInfo.empty() )
{
const TextViewProcessor::LineLayoutInfo& line( *resultLayout.mLinesLayoutInfo.begin() );
- if( !line.mWordGroupsLayoutInfo.empty() )
+ if( !line.mWordsLayoutInfo.empty() )
{
- resultWordGroupLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
+ resultWordLayout = *( *resultLayout.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
}
}
- RemoveWordsFromWordGroup( wordIndex,
- numberOfWords,
- inputWordGroupLayout );
+ RemoveCharactersFromWord( position,
+ numberOfCharacters,
+ inputWordLayout );
- if( !TestEqual( inputWordGroupLayout, resultWordGroupLayout ) )
+ if( !TestEqual( inputWordLayout, resultWordLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different layout info. %s\n", location );
return false;
}
return true;
}
-
/**
- * Removes from the \e input line the \e numberOfGroups groups of words starting from the given \e groupIndex and checks the results with \e result.
+ * Removes from the \e input line the \e numberOfWords words starting from the given \e wordIndex and checks the results with \e result.
*
* If the test fails it prints a short description and the line where this function was called.
*
* @param description Short description of the experiment.
* @param input The input line.
- * @param groupIndex Where to start to remove groups of words
- * @param numberOfGroups The number of groups of words to remove.
+ * @param wordIndex Index within the line where to start to remove words.
+ * @param numberOfWords The number of words to remove.
* @param lineHeightOffset Offset between lines.
- * @param result The line without the removed groups of words.
+ * @param result The line without the removed words.
* @param location Where this function has been called.
*
* @return \e true if the experiment is successful. Otherwise returns \e false.
*/
-bool TestRemoveGroupsFromLine( const std::string& description, const std::string& input, const std::size_t groupIndex, const std::size_t numberOfGroups, const float lineHeightOffset, const std::string& result, const char* location )
+bool TestRemoveWordsFromLine( const std::string& description, const std::string& input, const std::size_t wordIndex, const std::size_t numberOfWords, const float lineHeightOffset, const std::string& result, const char* location )
{
- tet_printf( "%s", description.c_str() );
+ tet_printf( "%s\n", description.c_str() );
// Create layout info for the input line.
Toolkit::Internal::TextView::RelayoutData relayoutData;
resultLineLayout = *resultLayout.mLinesLayoutInfo.begin();
}
- RemoveWordGroupsFromLine( groupIndex,
- numberOfGroups,
- PointSize( lineHeightOffset ),
- inputLineLayout );
+ RemoveWordsFromLine( wordIndex,
+ numberOfWords,
+ lineHeightOffset,
+ inputLineLayout );
if( !TestEqual( inputLineLayout, resultLineLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different layout info. %s\n", location );
+ tet_printf( " input : [%s]\n", input.c_str() );
+ tet_printf( " result : [%s]\n", GetText( resultLineLayout ).c_str() );
+ tet_printf( " expected result : [%s]\n\n", result.c_str() );
+
+ Print(inputLineLayout); std::cout << std::endl << std::endl;
+ Print(resultLineLayout); std::cout << std::endl;
return false;
}
const std::string& result,
const char* location )
{
- tet_printf( "%s", description.c_str() );
+ tet_printf( "%s\n", description.c_str() );
// Create layout info for the input.
Toolkit::Internal::TextView::RelayoutData relayoutData;
}
default:
{
- tet_printf( "TestUpdateTextInfo: unknown update operation. %s", location );
+ tet_printf( "TestUpdateTextInfo: unknown update operation. %s\n", location );
return false;
}
}
if( !TestEqual( inputLayout, resultLayout ) )
{
- tet_printf( "Fail. different layout info. %s", location );
+ tet_printf( "Fail. different layout info. %s\n", location );
- std::cout << " result : "; Print( inputLayout );
- std::cout << " expected result : "; Print( resultLayout );
+ // std::cout << " result : "; Print( inputLayout );
+ // std::cout << " expected result : "; Print( resultLayout );
return false;
}
layoutInfo12.mAscender = ASCENDER_12;
TextStyle style10;
+ style10.SetFontName( "" );
style10.SetFontPointSize( PointSize( 10.f ) );
TextStyle style12;
- style12.SetFontPointSize( PointSize( 0.f ) ); // point size is set to zero because is a default point size.
+ style12.SetFontName( "" );
layoutInfo12.mStyledText.mStyle = style12;
layoutInfo10.mStyledText.mStyle = style10;
layoutInfo12.mSize.width = 0.f;
wordLayout4.mCharactersLayoutInfo.push_back( layoutInfo12 ); // (new line char)
- // Groups
-
- TextViewProcessor::WordGroupLayoutInfo groupLayout1, groupLayout2;
-
- groupLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
- groupLayout1.mAscender = ASCENDER_12;
- groupLayout1.mDirection = TextViewProcessor::LTR;
- groupLayout1.mNumberOfCharacters = 13;
- groupLayout1.mWordsLayoutInfo.push_back( wordLayout1 );
- groupLayout1.mWordsLayoutInfo.push_back( wordLayout2 );
- groupLayout1.mWordsLayoutInfo.push_back( wordLayout3 );
- groupLayout1.mWordsLayoutInfo.push_back( wordLayout4 );
-
- groupLayout2.mSize = Size( 0.f, HEIGHT_12 );
- groupLayout2.mAscender = ASCENDER_12;
- groupLayout2.mDirection = TextViewProcessor::LTR;
- groupLayout2.mNumberOfCharacters = 1;
- groupLayout2.mWordsLayoutInfo.push_back( wordLayout4 );
-
// Lines
TextViewProcessor::LineLayoutInfo lineLayout1, lineLayout2, lineLayout3;
lineLayout1.mSize = Size( 5.f * WIDTH_10 + 7.f * WIDTH_12, HEIGHT_12 );
lineLayout1.mAscender = ASCENDER_12;
lineLayout1.mNumberOfCharacters = 13;
- lineLayout1.mWordGroupsLayoutInfo.push_back( groupLayout1 );
+ lineLayout1.mWordsLayoutInfo.push_back( wordLayout1 );
+ lineLayout1.mWordsLayoutInfo.push_back( wordLayout2 );
+ lineLayout1.mWordsLayoutInfo.push_back( wordLayout3 );
+ lineLayout1.mWordsLayoutInfo.push_back( wordLayout4 );
lineLayout2.mSize = Size( 0.f, HEIGHT_12 );
lineLayout2.mAscender = ASCENDER_12;
lineLayout2.mNumberOfCharacters = 1;
- lineLayout2.mWordGroupsLayoutInfo.push_back( groupLayout2 );
+ lineLayout2.mWordsLayoutInfo.push_back( wordLayout4 );
lineLayout3.mSize = Size( 0.f, HEIGHT_12 );
std::string("hello world."),
},
// Remove within the same word:
- // * within the same group of characters.
+ // * within the same group of characters with same style.
{
- std::string( "Remove within the same word, within the same group of characters" ),
+ std::string( "Remove within the same word, within the same group of characters with same style" ),
Remove,
std::string("Hello <font size='30'>world\nhello</font> world"),
7,
0.f,
std::string( "Hello <font size='30'>w</font>orl<font size='10'>dhello</font> world" )
},
- // * Remove whole group of words
+ // * Remove RTL text within LTR
/* TODO check this when RTL text is working
{
- std::string( "Remove within the same line, whole group of words (merge groups)" ),
+ std::string( "Remove within the same line, RTL text within LTR." ),
Remove,
std::string("Hello world, שלום עולם, hello world"),
10,
END_TEST;
}
-int UtcDaliTextViewSplitWordGroup(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline("UtcDaliTextViewSplitWordGroup : ");
-
- struct SplitWordGroupTest splitWordGroupTests[] =
- {
- {
- std::string( "Split word group, wordPosition 0, position 0." ),
- std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
- 0,
- 0,
- std::string( "" ),
- std::string( "<u><font size='10'>He<font size='12'>ll</font>oooo wooorld</font></u>" ),
- },
- {
- std::string( "Split word group, wordPosition 2, position 8." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 2,
- 7,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- std::string( "" ),
- },
- {
- std::string( "Split word group, wordPosition 0, position 2." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 0,
- 2,
- std::string( "<font size='10'>He</font>" ),
- std::string( "<font size='12'>ll</font><font size='10'>oooo wooorld</font>" ),
- },
- {
- std::string( "Split word group, wordPosition 0, position 3." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 0,
- 3,
- std::string( "<font size='10'>He</font><font size='12'>l</font>" ),
- std::string( "<font size='12'>l</font><font size='10'>oooo wooorld</font>" ),
- },
- {
- std::string( "Split word group, wordPosition 0, position 4." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 0,
- 4,
- std::string( "<font size='10'>He</font><font size='12'>ll</font>" ),
- std::string( "<font size='10'>oooo wooorld</font>" ),
- },
- {
- std::string( "Split word group, wordPosition 1, position 0." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font>" ),
- 1,
- 0,
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo</font>" ),
- std::string( "<font size='10'> wooorld</font>" ),
- },
- };
- const std::size_t numberOfTests( 6 );
-
- for( std::size_t index = 0; index < numberOfTests; ++index )
- {
- const SplitWordGroupTest& test = splitWordGroupTests[index];
-
- if( !TestSplitWordGroup( test.description, test.input, test.wordPosition, test.position, test.firstResult, test.lastResult, TEST_LOCATION ) )
- {
- tet_result( TET_FAIL );
- }
- }
-
- tet_result( TET_PASS );
- END_TEST;
-}
-
int UtcDaliTextViewSplitLine(void)
{
ToolkitTestApplication application;
struct SplitLineTest splitLineTests[] =
{
{
- std::string( "Split line, groupPosition 0, wordPosition 0, position 0." ),
+ std::string( "Split line, wordPosition 0, position 0." ),
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
0,
0,
- 0,
3.f,
std::string( "" ),
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
},
{
- std::string( "Split line, groupPosition 2, wordPosition 2, position 4." ),
+ std::string( "Split line, wordPosition 10, position 4." ),
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 2,
- 2,
+ 10,
4,
0.f,
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
std::string( "" ),
},
- /* TODO check when RTL is working.
{
- std::string( "Split line, groupPosition 1, wordPosition 2, position 0." ),
- std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 1,
+ std::string( "Split line, wordPosition 2, position 4." ),
+ std::string("<font size='10'>Hello </font>wor<font size='12'>ld, hello wo</font>rld"),
2,
+ 4,
+ 0.f,
+ std::string("<font size='10'>Hello </font>wor<font size='12'>l</font>"),
+ std::string("<font size='12'>d, hello wo</font>rld")
+ }
+ /* TODO RTL
+ {
+ std::string( "Split line, wordPosition 6, position 0." ),
+ std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
+ 6,
0,
0.f,
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום" ),
std::string( " עולם text text" ),
},
{
- std::string( "Split line, groupPosition 1, wordPosition 0, position 0." ),
+ std::string( "Split line, wordPosition 4, position 0." ),
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 1,
- 0,
+ 4,
0,
0.f,
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> " ),
std::string( "שלום עולם text text" ),
},
- */
{
- std::string( "Split line, groupPosition 2, wordPosition 0, position 0." ),
+ std::string( "Split line2, wordPosition 8, position 0." ),
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם text text" ),
- 2,
- 0,
+ 8,
0,
6.f,
std::string( "<font size='10'>He<font size='12'>ll</font>oooo wooorld</font> שלום עולם " ),
std::string( "text text" ),
},
+ */
};
const std::size_t numberOfTests( 3 );
{
const SplitLineTest& test = splitLineTests[index];
- if( !TestSplitLine( test.description, test.input, test.groupPosition, test.wordPosition, test.position, test.lineHeightOffset, test.firstResult, test.lastResult, TEST_LOCATION ) )
+ if( !TestSplitLine( test.description,
+ test.input,
+ test.wordIndex,
+ test.characterIndex,
+ test.lineHeightOffset,
+ test.firstResult,
+ test.lastResult,
+ TEST_LOCATION ) )
{
tet_result( TET_FAIL );
}
TextViewProcessor::WordLayoutInfo wordLayoutInfo01;
- wordLayoutInfo01 = *( *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ wordLayoutInfo01 = *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
TextViewProcessor::CreateTextInfo( styledText02,
DEFAULT_LAYOUT_PARAMETERS,
TextViewProcessor::WordLayoutInfo wordLayoutInfo02;
- wordLayoutInfo02 = *( *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ wordLayoutInfo02 = *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
TextViewProcessor::CreateTextInfo( styledText03,
DEFAULT_LAYOUT_PARAMETERS,
TextViewProcessor::WordLayoutInfo wordLayoutInfo03;
- wordLayoutInfo03 = *( *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin() ).mWordsLayoutInfo.begin();
+ wordLayoutInfo03 = *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordsLayoutInfo.begin();
// Test MergeWord() asserts if white spaces or new line chars are merged.
bool assert1 = false;
END_TEST;
}
-int UtcDaliTextViewMergeGroup01(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline("UtcDaliTextViewMergeGroup01 : ");
-
- struct MergeWordGroupsTest mergeWordGroupssTests[] =
- {
- {
- std::string( "Merge a void first group." ),
- std::string( "" ),
- std::string( "Hello world" ),
- std::string( "Hello world" ),
- },
- {
- std::string( "Merge a void last group." ),
- std::string( "Hello world" ),
- std::string( "" ),
- std::string( "Hello world" ),
- },
- {
- std::string( "Merge groups and merge last and first words." ),
- std::string( "Hello wor" ),
- std::string( "ld, hello world" ),
- std::string( "Hello world, hello world" ),
- },
- {
- std::string( "Merge groups and don't merge last and first words." ),
- std::string( "Hello world, " ),
- std::string( "hello world" ),
- std::string( "Hello world, hello world" )
- },
- };
- const std::size_t numberOfTests( 4 );
-
- for( std::size_t index = 0; index < numberOfTests; ++index )
- {
- const MergeWordGroupsTest& test = mergeWordGroupssTests[index];
-
- if( !TestMergeGroupsOfWords( test.description, test.inputFirst, test.inputLast, test.result, TEST_LOCATION ) )
- {
- tet_result( TET_FAIL );
- }
- }
-
- tet_result(TET_PASS);
- END_TEST;
-}
-
-int UtcDaliTextViewMergeGroup02(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline("UtcDaliTextViewMergeGroup02 : ");
-
- Toolkit::Internal::TextView::RelayoutData relayoutData01;
- Toolkit::Internal::TextView::RelayoutData relayoutData02;
- Toolkit::Internal::TextView::RelayoutData relayoutData03;
- TextViewProcessor::TextLayoutInfo& textLayoutInfo01( relayoutData01.mTextLayoutInfo );
- TextViewProcessor::TextLayoutInfo& textLayoutInfo02( relayoutData02.mTextLayoutInfo );
- TextViewProcessor::TextLayoutInfo& textLayoutInfo03( relayoutData03.mTextLayoutInfo );
-
- std::string text01( "Hello \n" );
- std::string text02( "world" );
- std::string text03( "السلام عليكم" );
- MarkupProcessor::StyledTextArray styledText01;
- MarkupProcessor::StyledTextArray styledText02;
- MarkupProcessor::StyledTextArray styledText03;
- MarkupProcessor::GetStyledTextArray( text01, styledText01, true );
- MarkupProcessor::GetStyledTextArray( text02, styledText02, true );
- MarkupProcessor::GetStyledTextArray( text03, styledText03, true );
-
- TextViewProcessor::CreateTextInfo( styledText01,
- DEFAULT_LAYOUT_PARAMETERS,
- relayoutData01 );
-
- TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo01;
-
- wordGroupLayoutInfo01 = *( *textLayoutInfo01.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
-
- TextViewProcessor::CreateTextInfo( styledText02,
- DEFAULT_LAYOUT_PARAMETERS,
- relayoutData02 );
-
- TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo02;
-
- wordGroupLayoutInfo02 = *( *textLayoutInfo02.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
-
- TextViewProcessor::CreateTextInfo( styledText03,
- DEFAULT_LAYOUT_PARAMETERS,
- relayoutData03 );
-
- TextViewProcessor::WordGroupLayoutInfo wordGroupLayoutInfo03;
-
- wordGroupLayoutInfo03 = *( *textLayoutInfo03.mLinesLayoutInfo.begin() ).mWordGroupsLayoutInfo.begin();
-
- bool assert1 = false;
- bool assert2 = false;
-
- try
- {
- MergeWordGroup( wordGroupLayoutInfo01,
- wordGroupLayoutInfo02 );
- }
- catch( Dali::DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: A group of words can't be merged to another group which finishes with a new line character.\"", TEST_LOCATION );
- assert1 = true;
- }
-
- try
- {
- MergeWordGroup( wordGroupLayoutInfo03,
- wordGroupLayoutInfo02 );
- }
- catch( Dali::DaliException& e )
- {
- tet_printf( "Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str() );
- DALI_TEST_EQUALS( e.mCondition, "!\"TextViewProcessor::MergeWordGroup(). ERROR: groups with different direction can't be merged.\"", TEST_LOCATION );
- assert2 = true;
- }
-
- if( assert1 && assert2 )
- {
- tet_result( TET_PASS );
- }
- else
- {
- tet_result( TET_FAIL );
- }
- END_TEST;
-}
-
int UtcDaliTextViewMergeLine01(void)
{
ToolkitTestApplication application;
0.f,
std::string( "Hello world, this is a whole line" )
},
- /* TODO: check when RTL text is working.
+ /* TODO RTL
{
- std::string( "Merge lines and merge last and first groups" ),
+ std::string( "Merge lines: last starting with RTL text and first ending with RTL" ),
std::string( "Hello world, שלום" ),
std::string( " עולם, hello world." ),
6.f,
END_TEST;
}
-int UtcDaliTextViewRemoveWordsFromGroup(void)
+int UtcDaliTextViewRemoveWordsFromLine(void)
{
- // Note: Currently RemoveWordsFromWordGroup() function is only used to remove a number of words from the beginning, or
- // from a given index to the end. RemoveWordsFromWordGroup() doesn't merge words (if a white space is removed) so
- // tehere isn't any TET case to cover these cases. To be done if needed.
+ // Note: Currently RemoveWordsFromLine() function is only used to remove a number of words from the beginning, or
+ // from a given index to the end.
ToolkitTestApplication application;
- tet_infoline("UtcDaliTextViewRemoveWordsFromGroup : ");
- struct RemoveWordsFromGroupTest removeWordsFromGroupTests[] =
+ tet_infoline("UtcDaliTextViewRemoveWordsFromLine : ");
+ struct RemoveWordsFromLineTest removeWordsFromLineTest[] =
{
{
std::string( "Delete 0 words." ),
- std::string( "Hello world, hello world" ),
- 3,
- 0,
- std::string( "Hello world, hello world" ),
- },
- {
- std::string( "Delete some words in the middle. Don't merge words" ),
- std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
- 1,
- 4,
- std::string( "<font size='10'>Hel</font><font size='20'>lo</font><font size='30'> world</font>" ),
- },
- {
- std::string( "Delete words up to the end" ),
- std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello world</font>" ),
- 5,
- 2,
- std::string( "<font size='10'>Hel</font><font size='20'>lo wo</font><font size='30'>rld, hello</font>" ),
- },
- {
- std::string( "Delete words from the beginning." ),
- std::string( "Hello world, hello world" ),
- 0,
- 3,
- std::string( " hello world" ),
- },
- };
- const std::size_t numberOfTests( 4 );
-
- for( std::size_t index = 0; index < numberOfTests; ++index )
- {
- const RemoveWordsFromGroupTest& test = removeWordsFromGroupTests[index];
-
- if( !TestRemoveWordsFromGroup( test.description, test.input, test.wordIndex, test.numberOfWords, test.result, TEST_LOCATION ) )
- {
- tet_result( TET_FAIL );
- }
- }
-
- tet_result( TET_PASS );
- END_TEST;
-}
-
-int UtcDaliTextViewRemoveGroupsFromLine(void)
-{
- // Note: Currently RemoveWordGroupsFromLine() function is only used to remove a number of group of words from the beginning, or
- // from a given index to the end. RemoveWordGroupsFromLine() doesn't merge groups of words (if a whole group of words is removed) so
- // tehere isn't any TET case to cover these cases. To be done if needed.
-
- ToolkitTestApplication application;
-
- tet_infoline("UtcDaliTextViewRemoveGroupsFromLine : ");
- struct RemoveGroupsFromLineTest removeGroupsFromLineTests[] =
- {
- {
- std::string( "Delete 0 groups of words." ),
std::string( "Hello hello, שלום עולם hello hello" ),
- 1,
+ 0,
0,
2.f,
std::string( "Hello hello, שלום עולם hello hello" ),
{
std::string( "Delete from the middle to the end." ),
std::string( "Hello hello, שלום עולם hello hello" ),
- 1,
- 2,
+ 4,
+ 7,
0.f,
std::string( "Hello hello, " ),
},
std::string( "Delete from the beginning to the middle." ),
std::string( "Hello hello, שלום עולם hello hello" ),
0,
- 2,
+ 8,
6.f,
std::string( "hello hello" ),
},
for( std::size_t index = 0; index < numberOfTests; ++index )
{
- const RemoveGroupsFromLineTest& test = removeGroupsFromLineTests[index];
+ const RemoveWordsFromLineTest& test = removeWordsFromLineTest[index];
- if( !TestRemoveGroupsFromLine( test.description, test.input, test.groupIndex, test.numberOfGroups, test.lineHeightOffset, test.result, TEST_LOCATION ) )
+ if( !TestRemoveWordsFromLine( test.description, test.input, test.wordIndex, test.numberOfWords, test.lineHeightOffset, test.result, TEST_LOCATION ) )
{
tet_result( TET_FAIL );
}
ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
DALI_TEST_CHECK( registry );
- gNumberObjectCreated = 0;
+ gNumberObjectCreated = 0u;
registry.ObjectCreatedSignal().Connect(&TestCallback);
// Following string should create three text-actors ([Hel], [lo wo] and [rld]).
std::string text( "Hel<font size='10'>lo wo</font>rld!\n"
"\n" );
+ view.SetMarkupProcessingEnabled( true ); // Enables markup processing.
+
Stage::GetCurrent().Add( view );
view.SetText( text );
TextView textView = TextView::New();
textView.SetSnapshotModeEnabled( false ); // Disables offscreen rendering.
+ textView.SetMarkupProcessingEnabled( true ); // Enables markup processing.
Stage::GetCurrent().Add( textView );
// Avoids the frame buffer texture to throw an exception.
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TextView view = TextView::New( "Hel<font color='green'>lo world!</font> This <font color='green'>is</font> a sna<font color='green'>psho</font>t test." );
+ TextView view = TextView::New();
+ view.SetMarkupProcessingEnabled( true ); // Enables markup processing.
+ view.SetText( "Hel<font color='green'>lo world!</font> This <font color='green'>is</font> a sna<font color='green'>psho</font>t test." );
Stage::GetCurrent().Add( view );
tet_infoline("UtcDaliTextViewUnderlineText: ");
ToolkitTestApplication application;
- TextView textView = TextView::New( "<u><font size='10'>gg<font size='14'>gg<font size='18'>gg<font size='22'>gg</font>gg</font>gg</font>gg</font></u>" );
+ TextView textView = TextView::New();
textView.SetSnapshotModeEnabled( false );
+ textView.SetMarkupProcessingEnabled( true );
+ textView.SetText( "<u><font size='10'>gg<font size='14'>gg<font size='18'>gg<font size='22'>gg</font>gg</font>gg</font>gg</font></u>" );
textView.SetSize( 150.f, 100.f );
float endWhiteSpaceLength = 0.f;
- std::size_t wordIndex = indices.mWordIndex;
std::size_t characterIndex = indices.mCharacterIndex;
float lineOffset = 0.f;
bool found = false;
bool isFirstCharacter = true;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::const_iterator wordGroupIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin() + indices.mGroupIndex,
- wordGroupEndIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- ( wordGroupIt != wordGroupEndIt ) && !found;
- ++wordGroupIt )
+ for( TextViewProcessor::WordLayoutInfoContainer::const_iterator wordIt = lineLayoutInfo.mWordsLayoutInfo.begin() + indices.mWordIndex,
+ wordEndIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ ( wordIt != wordEndIt ) && !found;
+ ++wordIt )
{
- const TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *wordGroupIt );
+ const TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordIt );
- for( TextViewProcessor::WordLayoutInfoContainer::const_iterator wordIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin() + wordIndex,
- wordEndIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- ( wordIt != wordEndIt ) && !found;
- ++wordIt )
- {
- const TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordIt );
-
- const float shrunkWordWidth = wordLayoutInfo.mSize.width * shrinkFactor;
- const bool isWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
+ const float shrunkWordWidth = wordLayoutInfo.mSize.width * shrinkFactor;
+ const bool isWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
- bool splitByCharacter = false;
+ bool splitByCharacter = false;
- switch( splitPolicy )
+ switch( splitPolicy )
+ {
+ case WrapByCharacter:
+ {
+ splitByCharacter = true;
+ break;
+ }
+ case WrapByWord:
+ case WrapByLine: // Fall through
+ {
+ splitByCharacter = false;
+ break;
+ }
+ case WrapByWordAndSplit:
{
- case WrapByCharacter:
+ splitByCharacter = ( shrunkWordWidth > parentWidth );
+ break;
+ }
+ case WrapByLineAndSplit:
+ {
+ if( ( 0u != characterIndex ) ||
+ ( ( 0u == characterIndex ) && ( lineOffset + shrunkWordWidth > parentWidth ) ) )
{
splitByCharacter = true;
- break;
}
- case WrapByWord:
- case WrapByLine: // Fall through
+ else
{
+ lineOffset += shrunkWordWidth;
splitByCharacter = false;
- break;
- }
- case WrapByWordAndSplit:
- {
- splitByCharacter = ( shrunkWordWidth > parentWidth );
- break;
- }
- case WrapByLineAndSplit:
- {
- if( ( 0 != characterIndex ) ||
- ( ( 0 == characterIndex ) && ( lineOffset + shrunkWordWidth > parentWidth ) ) )
- {
- splitByCharacter = true;
- }
- else
- {
- lineOffset += shrunkWordWidth;
- splitByCharacter = false;
- }
}
}
+ }
- if( splitByCharacter )
+ if( splitByCharacter )
+ {
+ for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator charIt = wordLayoutInfo.mCharactersLayoutInfo.begin() + characterIndex,
+ charEndIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ ( charIt != charEndIt ) && !found;
+ ++charIt )
{
- for( TextViewProcessor::CharacterLayoutInfoContainer::const_iterator charIt = wordLayoutInfo.mCharactersLayoutInfo.begin() + characterIndex,
- charEndIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- ( charIt != charEndIt ) && !found;
- ++charIt )
+ const TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *charIt );
+ CalculateLineLength( isWhiteSpace, characterLayoutInfo.mSize.width * shrinkFactor, parentWidth, found, subLineInfo.mLineLength, endWhiteSpaceLength );
+ if( !found || isFirstCharacter )
{
- const TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *charIt );
- CalculateLineLength( isWhiteSpace, characterLayoutInfo.mSize.width * shrinkFactor, parentWidth, found, subLineInfo.mLineLength, endWhiteSpaceLength );
- if( !found || isFirstCharacter )
- {
- subLineInfo.mMaxCharHeight = std::max( subLineInfo.mMaxCharHeight, characterLayoutInfo.mSize.height );
- subLineInfo.mMaxAscender = std::max( subLineInfo.mMaxAscender, characterLayoutInfo.mAscender );
- }
-
- // All characters for word 'wordIndex' have been processed.
- // Next word need to process all characters, so the characterIndex is reset to 0.
- characterIndex = 0;
- isFirstCharacter = false;
+ subLineInfo.mMaxCharHeight = std::max( subLineInfo.mMaxCharHeight, characterLayoutInfo.mSize.height );
+ subLineInfo.mMaxAscender = std::max( subLineInfo.mMaxAscender, characterLayoutInfo.mAscender );
}
- lineOffset += subLineInfo.mLineLength;
+ // All characters for word 'wordIndex' have been processed.
+ // Next word need to process all characters, so the characterIndex is reset to 0.
+ characterIndex = 0u;
+ isFirstCharacter = false;
}
- else
+
+ lineOffset += subLineInfo.mLineLength;
+ }
+ else
+ {
+ CalculateLineLength( isWhiteSpace, shrunkWordWidth, parentWidth, found, subLineInfo.mLineLength, endWhiteSpaceLength );
+ if( !found || isFirstCharacter )
{
- CalculateLineLength( isWhiteSpace, shrunkWordWidth, parentWidth, found, subLineInfo.mLineLength, endWhiteSpaceLength );
- if( !found || isFirstCharacter )
- {
- subLineInfo.mMaxCharHeight = std::max( subLineInfo.mMaxCharHeight, wordLayoutInfo.mSize.height );
- subLineInfo.mMaxAscender = std::max( subLineInfo.mMaxAscender, wordLayoutInfo.mAscender );
- }
- isFirstCharacter = false;
+ subLineInfo.mMaxCharHeight = std::max( subLineInfo.mMaxCharHeight, wordLayoutInfo.mSize.height );
+ subLineInfo.mMaxAscender = std::max( subLineInfo.mMaxAscender, wordLayoutInfo.mAscender );
}
+ isFirstCharacter = false;
}
-
- // All words for group 'groupIndex' have been processed.
- // Next group need to process all words, so the wordIndex is reset to 0.
- wordIndex = 0;
}
subLineInfo.mMaxCharHeight *= shrinkFactor;
{
TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *lineLayoutIt );
- relayoutParameters.mIndices.mGroupIndex = 0;
float justificationOffset = 0.f;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt, ++relayoutParameters.mIndices.mGroupIndex )
+ relayoutParameters.mIndices.mWordIndex = 0;
+
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- relayoutParameters.mIndices.mWordIndex = 0;
+ relayoutParameters.mIndices.mCharacterIndex = 0;
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex, ++infoTableCharacterIndex )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- relayoutParameters.mIndices.mCharacterIndex = 0;
-
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex, ++infoTableCharacterIndex )
+ // Calculate line justification offset.
+ if( lineJustificationIndex < relayoutData.mLineJustificationInfo.size() )
{
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
+ const TextView::LineJustificationInfo lineJustificationInfo( *( relayoutData.mLineJustificationInfo.begin() + lineJustificationIndex ) );
- // Calculate line justification offset.
- if( lineJustificationIndex < relayoutData.mLineJustificationInfo.size() )
+ if( relayoutParameters.mIndices == lineJustificationInfo.mIndices )
{
- const TextView::LineJustificationInfo lineJustificationInfo( *( relayoutData.mLineJustificationInfo.begin() + lineJustificationIndex ) );
-
- if( relayoutParameters.mIndices == lineJustificationInfo.mIndices )
- {
- justificationOffset = CalculateJustificationOffset( layoutParameters.mLineJustification, relayoutData.mTextSizeForRelayoutOption.width, lineJustificationInfo.mLineLength );
- ++lineJustificationIndex; // increase the index to point the next position in the vector.
- }
+ justificationOffset = CalculateJustificationOffset( layoutParameters.mLineJustification, relayoutData.mTextSizeForRelayoutOption.width, lineJustificationInfo.mLineLength );
+ ++lineJustificationIndex; // increase the index to point the next position in the vector.
}
+ }
- // Deletes the offsets if the exceed policies are EllipsizeEnd.
- const float horizontalOffset = textHorizontalOffset + justificationOffset;
- characterLayoutInfo.mOffset.x = ( ellipsizeAlignToLeft && ( horizontalOffset < 0.f ) ) ? 0.f : horizontalOffset;
- characterLayoutInfo.mOffset.y = ( ellipsizeAlignToTop && ( textVerticalOffset < 0.f ) ) ? 0.f : textVerticalOffset;
+ // Deletes the offsets if the exceed policies are EllipsizeEnd.
+ const float horizontalOffset = textHorizontalOffset + justificationOffset;
+ characterLayoutInfo.mOffset.x = ( ellipsizeAlignToLeft && ( horizontalOffset < 0.f ) ) ? 0.f : horizontalOffset;
+ characterLayoutInfo.mOffset.y = ( ellipsizeAlignToTop && ( textVerticalOffset < 0.f ) ) ? 0.f : textVerticalOffset;
- // Updates the size and position table for text-input with the alignment offset.
- Vector3 positionOffset( characterLayoutInfo.mPosition );
+ // Updates the size and position table for text-input with the alignment offset.
+ Vector3 positionOffset( characterLayoutInfo.mPosition );
- std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator infoTableIt = relayoutData.mCharacterLayoutInfoTable.begin() + infoTableCharacterIndex;
- Toolkit::TextView::CharacterLayoutInfo& characterTableInfo( *infoTableIt );
+ std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator infoTableIt = relayoutData.mCharacterLayoutInfoTable.begin() + infoTableCharacterIndex;
+ Toolkit::TextView::CharacterLayoutInfo& characterTableInfo( *infoTableIt );
- characterTableInfo.mPosition.x = positionOffset.x + characterLayoutInfo.mOffset.x;
- characterTableInfo.mPosition.y = positionOffset.y + characterLayoutInfo.mOffset.y;
+ characterTableInfo.mPosition.x = positionOffset.x + characterLayoutInfo.mOffset.x;
+ characterTableInfo.mPosition.y = positionOffset.y + characterLayoutInfo.mOffset.y;
- positionOffset.x += characterLayoutInfo.mAdvance * relayoutData.mShrinkFactor;
- } // end characters
- } // end words
- } // end group of words
+ positionOffset.x += characterLayoutInfo.mAdvance * relayoutData.mShrinkFactor;
+ } // end characters
+ } // end words
} // end lines
}
}
void UpdateLayoutInfoTable( Vector4& minMaxXY,
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo,
TextViewProcessor::WordLayoutInfo& wordLayoutInfo,
TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo,
RelayoutParameters& relayoutParameters,
characterLayoutInfo.mHeight * relayoutData.mShrinkFactor ),
positionOffset,
( TextViewProcessor::LineSeparator == wordLayoutInfo.mType ),
- ( TextViewProcessor::RTL == wordGroupLayoutInfo.mDirection ),
+ false, // VCC set the correct direction if needed.
true,
descender );
ellipsizeParameters.mEllipsizeBoundary.width -= relayoutData.mTextLayoutInfo.mEllipsizeLayoutInfo.mSize.width;
for( TextViewProcessor::LineLayoutInfoContainer::iterator lineLayoutIt = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + firstIndices.mLineIndex,
- endLineLayoutIt = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + lastIndices.mLineIndex + 1;
+ endLineLayoutIt = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + lastIndices.mLineIndex + 1u;
lineLayoutIt != endLineLayoutIt;
++lineLayoutIt )
{
ellipsizeParameters.mEllipsizeBoundary.width = ellipsizeParameters.mLineWidth;
}
- bool firstGroup = true;
- bool lastGroup = false;
- std::size_t groupCount = 0;
-
bool firstWord = true;
bool lastWord = false;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin() + firstIndices.mGroupIndex,
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin() + lastIndices.mGroupIndex + 1;
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt, ++groupCount )
+ std::size_t wordCount = 0u;
+
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin() + firstIndices.mWordIndex,
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin() + lastIndices.mWordIndex + 1u;
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt, ++wordCount )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- if( groupCount == lastIndices.mGroupIndex - firstIndices.mGroupIndex )
+ if( wordCount == lastIndices.mWordIndex - firstIndices.mWordIndex )
{
- lastGroup = true;
+ lastWord = true;
}
- std::size_t wordCount = 0;
- const std::size_t firstWordIndex = firstGroup ? firstIndices.mWordIndex : 0u;
- const std::size_t lastWordIndex = lastGroup ? lastIndices.mWordIndex : wordGroupLayoutInfo.mWordsLayoutInfo.size() - 1;
-
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin() + firstWordIndex,
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin() + lastWordIndex + 1;
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt, ++wordCount )
+ const std::size_t firstCharacterIndex = firstWord ? firstIndices.mCharacterIndex : 0u;
+ const std::size_t lastCharacterIndex = lastWord ? lastIndices.mCharacterIndex : wordLayoutInfo.mCharactersLayoutInfo.size() - 1u;
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin() + firstCharacterIndex,
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin() + lastCharacterIndex + 1u;
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- if( lastGroup && ( wordCount == lastIndices.mWordIndex - firstWordIndex ) )
+ if( ellipsizeParameters.mEllipsizeLine )
{
- lastWord = true;
- }
+ // Calculates the character visibility and whether it needs to be replace by ellipsized text.
+ CalculateVisibilityForEllipsize( layoutParameters,
+ characterLayoutInfo,
+ ellipsizeParameters,
+ relayoutData );
- const std::size_t firstCharacterIndex = firstWord ? firstIndices.mCharacterIndex : 0u;
- const std::size_t lastCharacterIndex = lastWord ? lastIndices.mCharacterIndex : wordLayoutInfo.mCharactersLayoutInfo.size() - 1;
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin() + firstCharacterIndex,
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin() + lastCharacterIndex + 1;
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt )
- {
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
-
- if( ellipsizeParameters.mEllipsizeLine )
+ if( ellipsizeParameters.mCreateEllipsizedTextActors )
{
- // Calculates the character visibility and whether it needs to be replace by ellipsized text.
- CalculateVisibilityForEllipsize( layoutParameters,
- characterLayoutInfo,
- ellipsizeParameters,
- relayoutData );
-
- if( ellipsizeParameters.mCreateEllipsizedTextActors )
- {
- // Create ellipsize text-actors if the character needs to be replaced.
- CreateEllipsizeTextActor( ellipsizeParameters,
- relayoutData );
- }
+ // Create ellipsize text-actors if the character needs to be replaced.
+ CreateEllipsizeTextActor( ellipsizeParameters,
+ relayoutData );
}
- else
+ }
+ else
+ {
+ if( ( TextView::EllipsizeEnd == layoutParameters.mExceedPolicy ) ||
+ ( TextView::SplitEllipsizeEnd == layoutParameters.mExceedPolicy ))
{
- if( ( TextView::EllipsizeEnd == layoutParameters.mExceedPolicy ) ||
- ( TextView::SplitEllipsizeEnd == layoutParameters.mExceedPolicy ))
+ if( !ellipsizeParameters.mIsLineHeightFullyVisible )
{
- if( !ellipsizeParameters.mIsLineHeightFullyVisible )
- {
- // Make characters invisible.
- characterLayoutInfo.mIsVisible = false;
- }
+ // Make characters invisible.
+ characterLayoutInfo.mIsVisible = false;
}
}
- } // end characters
- firstWord = false;
- } // end words
- firstGroup = false;
- } // end groups
+ }
+ } // end characters
+ firstWord = false;
+ } // end words
} // end lines
}
{
TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *lineLayoutIt );
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
-
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt )
- {
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
-
- characterLayoutInfo.mIsVisible = true;
- characterLayoutInfo.mGradientColor = Vector4::ZERO;
- characterLayoutInfo.mStartPoint = Vector2::ZERO;
- characterLayoutInfo.mEndPoint = Vector2::ZERO;
- characterLayoutInfo.mColorAlpha = characterLayoutInfo.mStyledText.mStyle.GetTextColor().a;
- } // end characters
- } // end words
- } // end group of words
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
+
+ characterLayoutInfo.mIsVisible = true;
+ characterLayoutInfo.mGradientColor = Vector4::ZERO;
+ characterLayoutInfo.mStartPoint = Vector2::ZERO;
+ characterLayoutInfo.mEndPoint = Vector2::ZERO;
+ characterLayoutInfo.mColorAlpha = characterLayoutInfo.mStyledText.mStyle.GetTextColor().a;
+ } // end characters
+ } // end words
} // end lines
// Updates the visibility for text-input..
fadeParameters.mTopAlphaCoeficients = CalculateRectParameters( Vector2( fadeParameters.mTopFadeThresholdOffset, 1.f ), Vector2( 0.f, 0.f ) );
fadeParameters.mBottomAlphaCoeficients = CalculateRectParameters( Vector2( fadeParameters.mBottomFadeThresholdOffset, 1.f ), Vector2( relayoutData.mTextViewSize.height, 0.f ) );
- // Traverses all groups of characters and calculates the visibility.
+ // Traverses all characters and calculates the visibility.
std::size_t infoTableCharacterIndex = 0;
{
TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *lineLayoutIt );
- relayoutParameters.mIndices.mGroupIndex = 0;
+ relayoutParameters.mIndices.mWordIndex = 0;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt, ++relayoutParameters.mIndices.mGroupIndex )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- relayoutParameters.mIndices.mWordIndex = 0;
+ relayoutParameters.mIsFirstCharacterOfWord = true;
+ relayoutParameters.mWordSize = wordLayoutInfo.mSize;
+ relayoutParameters.mIndices.mCharacterIndex = 0;
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex, ++infoTableCharacterIndex )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
-
- relayoutParameters.mIsFirstCharacterOfWord = true;
- relayoutParameters.mWordSize = wordLayoutInfo.mSize;
- relayoutParameters.mIndices.mCharacterIndex = 0;
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex, ++infoTableCharacterIndex )
- {
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
-
- relayoutParameters.mIsVisible = true;
- fadeParameters.mIsPartiallyVisible = false;
+ relayoutParameters.mIsVisible = true;
+ fadeParameters.mIsPartiallyVisible = false;
- // Calculates the visibility for the current group of characters.
- CalculateVisibilityForFade( layoutParameters,
- characterLayoutInfo,
- relayoutParameters,
- fadeParameters,
- relayoutData );
+ // Calculates the visibility for the current character.
+ CalculateVisibilityForFade( layoutParameters,
+ characterLayoutInfo,
+ relayoutParameters,
+ fadeParameters,
+ relayoutData );
- // Updates the visibility for text-input..
- std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator it = relayoutData.mCharacterLayoutInfoTable.begin() + infoTableCharacterIndex;
+ // Updates the visibility for text-input..
+ std::vector<Toolkit::TextView::CharacterLayoutInfo>::iterator it = relayoutData.mCharacterLayoutInfoTable.begin() + infoTableCharacterIndex;
- Toolkit::TextView::CharacterLayoutInfo& characterLayoutTableInfo( *it );
+ Toolkit::TextView::CharacterLayoutInfo& characterLayoutTableInfo( *it );
- characterLayoutTableInfo.mIsVisible = relayoutParameters.mIsVisible;
+ characterLayoutTableInfo.mIsVisible = relayoutParameters.mIsVisible;
- relayoutParameters.mIsFirstCharacterOfWord = false;
- } // end group of character
- } // end words
- } // end group of words
+ relayoutParameters.mIsFirstCharacterOfWord = false;
+ } // end character
+ } // end words
} // end lines
}
{
TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *lineLayoutIt );
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt )
+ if( characterLayoutInfo.mIsColorGlyph )
{
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
+ ImageActor imageActor = ImageActor::DownCast( characterLayoutInfo.mGlyphActor );
- if( characterLayoutInfo.mIsColorGlyph )
+ if( characterLayoutInfo.mSetText )
{
- ImageActor imageActor = ImageActor::DownCast( characterLayoutInfo.mGlyphActor );
+ GlyphImage image = GlyphImage::New( characterLayoutInfo.mStyledText.mText[0] );
- if( characterLayoutInfo.mSetText )
+ if( image )
{
- GlyphImage image = GlyphImage::New( characterLayoutInfo.mStyledText.mText[0] );
-
- if( image )
- {
- imageActor.SetImage( image );
- }
- characterLayoutInfo.mSetText = false;
+ imageActor.SetImage( image );
}
+ characterLayoutInfo.mSetText = false;
+ }
- imageActor.SetPosition( Vector3( characterLayoutInfo.mPosition.x + characterLayoutInfo.mOffset.x,
- characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y,
- characterLayoutInfo.mPosition.z ) );
- imageActor.SetSize( characterLayoutInfo.mSize );
+ imageActor.SetPosition( Vector3( characterLayoutInfo.mPosition.x + characterLayoutInfo.mOffset.x,
+ characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y,
+ characterLayoutInfo.mPosition.z ) );
+ imageActor.SetSize( characterLayoutInfo.mSize );
- // Sets the sort modifier value.
- imageActor.SetSortModifier( visualParameters.mSortModifier );
- }
- else
+ // Sets the sort modifier value.
+ imageActor.SetSortModifier( visualParameters.mSortModifier );
+ }
+ else
+ {
+ TextActor textActor = TextActor::DownCast( characterLayoutInfo.mGlyphActor );
+ if( textActor )
{
- TextActor textActor = TextActor::DownCast( characterLayoutInfo.mGlyphActor );
- if( textActor )
+ // There is a new text-actor. Set text and everything to the previous one.
+ if( currentTextActorInfo.textActor )
{
- // There is a new text-actor. Set text and everything to the previous one.
- if( currentTextActorInfo.textActor )
- {
- currentTextActorInfo.textActor.SetText( currentTextActorInfo.text );
- currentTextActorInfo.textActor.SetPosition( currentTextActorInfo.position );
- currentTextActorInfo.textActor.SetSize( currentTextActorInfo.size );
-
- SetVisualParameters( currentTextActorInfo,
- visualParameters,
- relayoutData,
- lineLayoutInfo.mSize.height );
- }
+ currentTextActorInfo.textActor.SetText( currentTextActorInfo.text );
+ currentTextActorInfo.textActor.SetPosition( currentTextActorInfo.position );
+ currentTextActorInfo.textActor.SetSize( currentTextActorInfo.size );
+
+ SetVisualParameters( currentTextActorInfo,
+ visualParameters,
+ relayoutData,
+ lineLayoutInfo.mSize.height );
+ }
- currentTextActorInfo.text = characterLayoutInfo.mStyledText.mText;
- currentTextActorInfo.position = Vector3( characterLayoutInfo.mPosition.x + characterLayoutInfo.mOffset.x,
- characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y,
- characterLayoutInfo.mPosition.z );
- currentTextActorInfo.size = characterLayoutInfo.mSize * relayoutData.mShrinkFactor;
+ currentTextActorInfo.text = characterLayoutInfo.mStyledText.mText;
+ currentTextActorInfo.position = Vector3( characterLayoutInfo.mPosition.x + characterLayoutInfo.mOffset.x,
+ characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y,
+ characterLayoutInfo.mPosition.z );
+ currentTextActorInfo.size = characterLayoutInfo.mSize * relayoutData.mShrinkFactor;
- currentTextActorInfo.color = characterLayoutInfo.mStyledText.mStyle.GetTextColor();
- currentTextActorInfo.color.a = characterLayoutInfo.mColorAlpha;
+ currentTextActorInfo.color = characterLayoutInfo.mStyledText.mStyle.GetTextColor();
+ currentTextActorInfo.color.a = characterLayoutInfo.mColorAlpha;
- currentTextActorInfo.gradientColor = characterLayoutInfo.mGradientColor;
- currentTextActorInfo.startPoint = characterLayoutInfo.mStartPoint;
- currentTextActorInfo.endPoint = characterLayoutInfo.mEndPoint;
+ currentTextActorInfo.gradientColor = characterLayoutInfo.mGradientColor;
+ currentTextActorInfo.startPoint = characterLayoutInfo.mStartPoint;
+ currentTextActorInfo.endPoint = characterLayoutInfo.mEndPoint;
- // Update the current text-actor.
- currentTextActorInfo.textActor = textActor;
- }
- else
+ // Update the current text-actor.
+ currentTextActorInfo.textActor = textActor;
+ }
+ else
+ {
+ // If this character layout has no text-actor is because this character has the same style than previous one.
+ // Add the character to the current text-actor and update the size.
+ if( characterLayoutInfo.mIsVisible && ( TextViewProcessor::LineSeparator != wordLayoutInfo.mType ) )
{
- // If this character layout has no text-actor is because this character has the same style than previous one.
- // Add the character to the current text-actor and update the size.
- if( characterLayoutInfo.mIsVisible && ( TextViewProcessor::LineSeparator != wordLayoutInfo.mType ) )
- {
- currentTextActorInfo.text.Append( characterLayoutInfo.mStyledText.mText );
+ currentTextActorInfo.text.Append( characterLayoutInfo.mStyledText.mText );
- currentTextActorInfo.position.y = std::min( currentTextActorInfo.position.y, ( characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y ) );
- currentTextActorInfo.size.width += characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor;
- currentTextActorInfo.size.height = std::max( currentTextActorInfo.size.height, characterLayoutInfo.mSize.height * relayoutData.mShrinkFactor );
- }
+ currentTextActorInfo.position.y = std::min( currentTextActorInfo.position.y, ( characterLayoutInfo.mPosition.y + characterLayoutInfo.mOffset.y ) );
+ currentTextActorInfo.size.width += characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor;
+ currentTextActorInfo.size.height = std::max( currentTextActorInfo.size.height, characterLayoutInfo.mSize.height * relayoutData.mShrinkFactor );
}
}
- } // end characters
- } // end words
+ }
+ } // end characters
+ } // end words
- if( !currentTextActorInfo.text.IsEmpty() )
+ if( !currentTextActorInfo.text.IsEmpty() )
+ {
+ if( currentTextActorInfo.textActor )
{
- if( currentTextActorInfo.textActor )
- {
- currentTextActorInfo.textActor.SetText( currentTextActorInfo.text );
- currentTextActorInfo.textActor.SetPosition( currentTextActorInfo.position );
- currentTextActorInfo.textActor.SetSize( currentTextActorInfo.size );
-
- SetVisualParameters( currentTextActorInfo,
- visualParameters,
- relayoutData,
- lineLayoutInfo.mSize.height );
- }
+ currentTextActorInfo.textActor.SetText( currentTextActorInfo.text );
+ currentTextActorInfo.textActor.SetPosition( currentTextActorInfo.position );
+ currentTextActorInfo.textActor.SetSize( currentTextActorInfo.size );
+
+ SetVisualParameters( currentTextActorInfo,
+ visualParameters,
+ relayoutData,
+ lineLayoutInfo.mSize.height );
}
- } //end groups of words
+ }
} // end lines
for( std::vector<RenderableActor>::iterator it = relayoutData.mEllipsizedGlyphActors.begin(),
{
TextViewProcessor::LineLayoutInfo& line( *lineIt );
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupIt = line.mWordGroupsLayoutInfo.begin(), groupEndIt = line.mWordGroupsLayoutInfo.end();
- groupIt != groupEndIt;
- ++groupIt )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = line.mWordsLayoutInfo.begin(), wordEndIt = line.mWordsLayoutInfo.end();
+ wordIt != wordEndIt;
+ ++wordIt )
{
- TextViewProcessor::WordGroupLayoutInfo& group( *groupIt );
+ TextViewProcessor::WordLayoutInfo& word( *wordIt );
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = group.mWordsLayoutInfo.begin(), wordEndIt = group.mWordsLayoutInfo.end();
- wordIt != wordEndIt;
- ++wordIt )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
+ characterIt != characterEndIt;
+ ++characterIt )
{
- TextViewProcessor::WordLayoutInfo& word( *wordIt );
+ TextViewProcessor::CharacterLayoutInfo& character( *characterIt );
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
- characterIt != characterEndIt;
- ++characterIt )
+ // Check if current character is the first of a new laid-out line
+ const bool isNewLine = ( textUnderlineStatus.mLineGlobalIndex < relayoutData.mLines.size() ) &&
+ ( textUnderlineStatus.mCharacterGlobalIndex == ( *( relayoutData.mLines.begin() + textUnderlineStatus.mLineGlobalIndex ) ).mCharacterGlobalIndex );
+ if( isNewLine )
{
- TextViewProcessor::CharacterLayoutInfo& characterGroup( *characterIt );
+ ++textUnderlineStatus.mLineGlobalIndex; // If it's a new line, point to the next one.
+ }
- // Check if current character is the first of a new laid-out line
- const bool isNewLine = ( textUnderlineStatus.mLineGlobalIndex < relayoutData.mLines.size() ) &&
- ( textUnderlineStatus.mCharacterGlobalIndex == ( *( relayoutData.mLines.begin() + textUnderlineStatus.mLineGlobalIndex ) ).mCharacterGlobalIndex );
- if( isNewLine )
+ if( character.mStyledText.mStyle.IsUnderlineEnabled() )
+ {
+ if( !textUnderlineStatus.mCurrentUnderlineStatus || // Current character is underlined but previous one it wasn't.
+ isNewLine ) // Current character is underlined and is the first of current laid-out line.
{
- ++textUnderlineStatus.mLineGlobalIndex; // If it's a new line, point to the next one.
- }
+ // Create a new underline info for the current underlined characters.
+ UnderlineInfo underlineInfo;
+ underlineInfo.mMaxHeight = character.mSize.height;
+ underlineInfo.mMaxThickness = character.mUnderlineThickness;
+ underlineInfo.mPosition = character.mUnderlinePosition;
+
+ textUnderlineStatus.mUnderlineInfo.push_back( underlineInfo );
- if( characterGroup.mStyledText.mStyle.IsUnderlineEnabled() )
+ textUnderlineStatus.mCurrentUnderlineStatus = true; // Set the current text is underlined.
+ }
+ else
{
- if( !textUnderlineStatus.mCurrentUnderlineStatus || // Current character is underlined but previous one it wasn't.
- isNewLine ) // Current character is underlined and is the first of current laid-out line.
- {
- // Create a new underline info for the current underlined characters.
- UnderlineInfo underlineInfo;
- underlineInfo.mMaxHeight = characterGroup.mSize.height;
- underlineInfo.mMaxThickness = characterGroup.mUnderlineThickness;
- underlineInfo.mPosition = characterGroup.mUnderlinePosition;
+ // Retrieve last underline info and update it if current underline thickness is bigger.
+ UnderlineInfo& underlineInfo( *( textUnderlineStatus.mUnderlineInfo.end() - 1 ) );
- textUnderlineStatus.mUnderlineInfo.push_back( underlineInfo );
+ underlineInfo.mMaxHeight = std::max( underlineInfo.mMaxHeight, character.mSize.height );
- textUnderlineStatus.mCurrentUnderlineStatus = true; // Set the current text is underlined.
- }
- else
+ if( character.mUnderlineThickness > underlineInfo.mMaxThickness )
{
- // Retrieve last underline info and update it if current underline thickness is bigger.
- UnderlineInfo& underlineInfo( *( textUnderlineStatus.mUnderlineInfo.end() - 1 ) );
-
- underlineInfo.mMaxHeight = std::max( underlineInfo.mMaxHeight, characterGroup.mSize.height );
-
- if( characterGroup.mUnderlineThickness > underlineInfo.mMaxThickness )
- {
- underlineInfo.mMaxThickness = characterGroup.mUnderlineThickness;
- underlineInfo.mPosition = characterGroup.mUnderlinePosition;
- }
+ underlineInfo.mMaxThickness = character.mUnderlineThickness;
+ underlineInfo.mPosition = character.mUnderlinePosition;
}
}
- else
- {
- textUnderlineStatus.mCurrentUnderlineStatus = false;
- }
+ }
+ else
+ {
+ textUnderlineStatus.mCurrentUnderlineStatus = false;
+ }
- ++textUnderlineStatus.mCharacterGlobalIndex;
- } // end group of characters.
- } // end words.
- } // end group of words.
+ ++textUnderlineStatus.mCharacterGlobalIndex;
+ } // end characters.
+ } // end words.
} // end lines.
}
void SetUnderlineInfo( TextView::RelayoutData& relayoutData )
{
- // Stores for each group of consecutive underlined text in each laid-out line its maximum thicknes, its position of that thickness and the maximum character's height.
+ // Stores for each group of consecutive underlined characters in each laid-out line its maximum thicknes, its position of that thickness and the maximum character's height.
TextViewRelayout::TextUnderlineStatus textUnderlineStatus;
// Traverse the whole text to find all groups of consecutive underlined characters in the same laid-out line.
{
TextViewProcessor::LineLayoutInfo& line( *lineIt );
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupIt = line.mWordGroupsLayoutInfo.begin(), groupEndIt = line.mWordGroupsLayoutInfo.end();
- groupIt != groupEndIt;
- ++groupIt )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = line.mWordsLayoutInfo.begin(), wordEndIt = line.mWordsLayoutInfo.end();
+ wordIt != wordEndIt;
+ ++wordIt )
{
- TextViewProcessor::WordGroupLayoutInfo& group( *groupIt );
+ TextViewProcessor::WordLayoutInfo& word( *wordIt );
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = group.mWordsLayoutInfo.begin(), wordEndIt = group.mWordsLayoutInfo.end();
- wordIt != wordEndIt;
- ++wordIt )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
+ characterIt != characterEndIt;
+ ++characterIt )
{
- TextViewProcessor::WordLayoutInfo& word( *wordIt );
+ TextViewProcessor::CharacterLayoutInfo& character( *characterIt );
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
- characterIt != characterEndIt;
- ++characterIt )
- {
- TextViewProcessor::CharacterLayoutInfo& characterGroup( *characterIt );
+ // Check if current character is the first of a new laid-out line
- // Check if current character is the first of a new laid-out line
+ bool isNewLine = false;
- bool isNewLine = false;
+ if( textUnderlineStatus.mLineGlobalIndex < relayoutData.mLines.size() )
+ {
+ const Toolkit::TextView::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mLines.begin() + textUnderlineStatus.mLineGlobalIndex ) );
+ isNewLine = ( textUnderlineStatus.mCharacterGlobalIndex == lineLayoutInfo.mCharacterGlobalIndex );
- if( textUnderlineStatus.mLineGlobalIndex < relayoutData.mLines.size() )
+ if( isNewLine )
{
- const Toolkit::TextView::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mLines.begin() + textUnderlineStatus.mLineGlobalIndex ) );
- isNewLine = ( textUnderlineStatus.mCharacterGlobalIndex == lineLayoutInfo.mCharacterGlobalIndex );
-
- if( isNewLine )
- {
- currentLineHeight = lineLayoutInfo.mSize.height;
- currentLineAscender = lineLayoutInfo.mAscender;
- ++textUnderlineStatus.mLineGlobalIndex; // If it's a new line, point to the next one.
- }
+ currentLineHeight = lineLayoutInfo.mSize.height;
+ currentLineAscender = lineLayoutInfo.mAscender;
+ ++textUnderlineStatus.mLineGlobalIndex; // If it's a new line, point to the next one.
}
+ }
- if( characterGroup.mStyledText.mStyle.IsUnderlineEnabled() )
+ if( character.mStyledText.mStyle.IsUnderlineEnabled() )
+ {
+ if( textUnderlineStatus.mCurrentUnderlineStatus )
{
- if( textUnderlineStatus.mCurrentUnderlineStatus )
+ if( isNewLine )
{
- if( isNewLine )
+ // Retrieves the thickness and position for the next piece of underlined text.
+ if( underlineInfoIt < underlineInfoEndIt )
{
- // Retrieves the thickness and position for the next piece of underlined text.
+ ++underlineInfoIt;
if( underlineInfoIt < underlineInfoEndIt )
{
- ++underlineInfoIt;
- if( underlineInfoIt < underlineInfoEndIt )
- {
- underlineInfo = *underlineInfoIt;
- }
+ underlineInfo = *underlineInfoIt;
}
}
}
+ }
- textUnderlineStatus.mCurrentUnderlineStatus = true;
+ textUnderlineStatus.mCurrentUnderlineStatus = true;
- // Before setting the position it needs to be adjusted to match the base line.
- const float bearingOffset = ( currentLineHeight - currentLineAscender ) - ( characterGroup.mSize.height - characterGroup.mAscender );
- const float positionOffset = ( underlineInfo.mMaxHeight - characterGroup.mSize.height ) - bearingOffset;
+ // Before setting the position it needs to be adjusted to match the base line.
+ const float bearingOffset = ( currentLineHeight - currentLineAscender ) - ( character.mSize.height - character.mAscender );
+ const float positionOffset = ( underlineInfo.mMaxHeight - character.mSize.height ) - bearingOffset;
- // Sets the underline's parameters.
- characterGroup.mStyledText.mStyle.SetUnderline( true, underlineInfo.mMaxThickness, underlineInfo.mPosition - positionOffset );
+ // Sets the underline's parameters.
+ character.mStyledText.mStyle.SetUnderline( true, underlineInfo.mMaxThickness, underlineInfo.mPosition - positionOffset );
- // Mark the group of characters to be set the new style into the text-actor.
- characterGroup.mSetStyle = true;
- }
- else
+ // Mark the character to be set the new style into the text-actor.
+ character.mSetStyle = true;
+ }
+ else
+ {
+ if( textUnderlineStatus.mCurrentUnderlineStatus )
{
- if( textUnderlineStatus.mCurrentUnderlineStatus )
- {
- textUnderlineStatus.mCurrentUnderlineStatus = false;
+ textUnderlineStatus.mCurrentUnderlineStatus = false;
- // Retrieves the thickness and position for the next piece of underlined text.
+ // Retrieves the thickness and position for the next piece of underlined text.
+ if( underlineInfoIt < underlineInfoEndIt )
+ {
+ ++underlineInfoIt;
if( underlineInfoIt < underlineInfoEndIt )
{
- ++underlineInfoIt;
- if( underlineInfoIt < underlineInfoEndIt )
- {
- underlineInfo = *underlineInfoIt;
- }
+ underlineInfo = *underlineInfoIt;
}
}
}
+ }
- ++textUnderlineStatus.mCharacterGlobalIndex;
- } // end of group of characters.
- } // end of word.
- } // end of group of words.
+ ++textUnderlineStatus.mCharacterGlobalIndex;
+ } // end of characters.
+ } // end of word.
} // end of lines.
}
{
TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *lineLayoutIt );
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt )
+ if( characterLayoutInfo.mIsVisible && characterLayoutInfo.mGlyphActor ) // White spaces and '\n' characters doesn't have a text-actor.
{
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
-
- if( characterLayoutInfo.mIsVisible && characterLayoutInfo.mGlyphActor ) // White spaces and '\n' characters doesn't have a text-actor.
+ //Add to the text-view.
+ if( insertToTextView )
{
- //Add to the text-view.
- if( insertToTextView )
- {
- textView.Add( characterLayoutInfo.mGlyphActor );
- }
- if( insertToTextActorList )
- {
- relayoutData.mGlyphActors.push_back( characterLayoutInfo.mGlyphActor );
- }
+ textView.Add( characterLayoutInfo.mGlyphActor );
+ }
+ if( insertToTextActorList )
+ {
+ relayoutData.mGlyphActors.push_back( characterLayoutInfo.mGlyphActor );
}
- } // end group of character
- } // end words
- } // end group of words
+ }
+ } // end character
+ } // end words
} // end lines
for( std::vector<RenderableActor>::iterator it = relayoutData.mEllipsizedGlyphActors.begin(),
Size mLineSize; ///< Current line's size.
Size mWordSize; ///< Current word's size.
Size mCharacterSize; ///< Current character's size.
- TextViewProcessor::TextInfoIndices mIndices; ///< Current indices to line, group of words, word and character.
+ TextViewProcessor::TextInfoIndices mIndices; ///< Current indices to line, word and character.
std::size_t mCharacterGlobalIndex; ///< Index to a single character within the whole text.
bool mIsFirstCharacter:1; ///< Whether is the first character of the whole text.
bool mIsFirstCharacterOfWord:1; ///< Whether is the first character of the word.
* Calculates the layout info of the portion of the line which fits on the text-view width.
*
* @param[in] parentWidth Text-view width
- * @param[in] indices Indices to the word group, word and character.
+ * @param[in] indices Indices to the word and character.
* @param[in] lineLayoutInfo Layout info for the line.
* @param[in] splitPolicy Whether a line is wraped by word, by character or by word and character.
* @param[in] shrinkFactor Shrink factor used.
* This table is used to pass the size, the position and other layout info to other controls/actors.
*
* @param[in,out] minMaxXY The boundary box of the whole text.
+ * @param[in,out] wordLayoutInfo Word layout info.
* @param[in,out] characterLayoutInfo Character layout info.
+ * @param[in,out] relayoutParameters Temporary layout parameters.
* @param[in,out] relayoutData The text-view's data structures.
*/
void UpdateLayoutInfoTable( Vector4& minMaxXY,
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo,
TextViewProcessor::WordLayoutInfo& wordLayoutInfo,
- TextViewProcessor::CharacterLayoutInfo& characterGroupLayoutInfo,
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo,
RelayoutParameters& relayoutParameters,
TextView::RelayoutData& relayoutData );
relayoutParameters.mIsNewLine = true;
relayoutParameters.mLineSize = lineLayoutInfo.mSize;
- relayoutParameters.mIndices.mGroupIndex = 0;
+ relayoutParameters.mIndices.mWordIndex = 0;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt, ++relayoutParameters.mIndices.mGroupIndex )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
-
- relayoutParameters.mIndices.mWordIndex = 0;
-
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
+ relayoutParameters.mIsWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
+ relayoutParameters.mIsNewLineCharacter = TextViewProcessor::LineSeparator == wordLayoutInfo.mType;
+
+ relayoutParameters.mIsFirstCharacterOfWord = true;
+ relayoutParameters.mWordSize = wordLayoutInfo.mSize;
+ relayoutParameters.mIndices.mCharacterIndex = 0;
+
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- relayoutParameters.mIsWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
- relayoutParameters.mIsNewLineCharacter = TextViewProcessor::LineSeparator == wordLayoutInfo.mType;
-
- relayoutParameters.mIsFirstCharacterOfWord = true;
- relayoutParameters.mWordSize = wordLayoutInfo.mSize;
- relayoutParameters.mIndices.mCharacterIndex = 0;
-
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex )
- {
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
+ relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
- switch( layoutParameters.mExceedPolicy )
+ switch( layoutParameters.mExceedPolicy )
+ {
+ case TextView::OriginalShrink:
+ case TextView::SplitOriginal:
+ case TextView::SplitFade:
+ case TextView::SplitEllipsizeEnd:
+ case TextView::SplitShrink:
+ case TextView::ShrinkOriginal:
+ case TextView::ShrinkFade:
+ case TextView::Shrink:
+ case TextView::EllipsizeEndOriginal:
+ case TextView::EllipsizeEnd: // Fall Through
{
- case TextView::OriginalShrink:
- case TextView::SplitOriginal:
- case TextView::SplitFade:
- case TextView::SplitEllipsizeEnd:
- case TextView::SplitShrink:
- case TextView::ShrinkOriginal:
- case TextView::ShrinkFade:
- case TextView::Shrink:
- case TextView::EllipsizeEndOriginal:
- case TextView::EllipsizeEnd: // Fall Through
- {
- DALI_LOG_WARNING( "SplitByChar::CalculateSizeAndPosition() policy not implemented.\n" );
- break;
- }
- case TextView::OriginalFade:
- case TextView::FadeOriginal:
- case TextView::Original:
- case TextView::Fade: // Fall Through
- {
- characterLayoutInfo.mPosition = NoShrinkWhenExceedPosition( relayoutParameters,
- layoutParameters,
- relayoutData );
-
- relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
- break;
- }
- default:
- {
- DALI_LOG_WARNING( "SplitByChar::CalculateSizeAndPosition() policy combination not possible.\n" );
- }
+ DALI_LOG_WARNING( "SplitByChar::CalculateSizeAndPosition() policy not implemented.\n" );
+ break;
}
+ case TextView::OriginalFade:
+ case TextView::FadeOriginal:
+ case TextView::Original:
+ case TextView::Fade: // Fall Through
+ {
+ characterLayoutInfo.mPosition = NoShrinkWhenExceedPosition( relayoutParameters,
+ layoutParameters,
+ relayoutData );
- // Get last line info and calculate the bearing (used to align glyphs with the baseline).
- TextViewRelayout::CalculateBearing( characterLayoutInfo, relayoutData );
-
- // updates min and max position to calculate the text size for split by char.
- TextViewRelayout::UpdateLayoutInfoTable( minMaxXY,
- wordGroupLayoutInfo,
- wordLayoutInfo,
- characterLayoutInfo,
- relayoutParameters,
- relayoutData );
-
- ++relayoutParameters.mCharacterGlobalIndex;
- relayoutParameters.mIsFirstCharacter = false;
- relayoutParameters.mIsNewLine = false;
- } // end characters
- } // end words
- } // end group of words
+ relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
+ break;
+ }
+ default:
+ {
+ DALI_LOG_WARNING( "SplitByChar::CalculateSizeAndPosition() policy combination not possible.\n" );
+ }
+ }
+
+ // Get last line info and calculate the bearing (used to align glyphs with the baseline).
+ TextViewRelayout::CalculateBearing( characterLayoutInfo, relayoutData );
+
+ // updates min and max position to calculate the text size for split by char.
+ TextViewRelayout::UpdateLayoutInfoTable( minMaxXY,
+ wordLayoutInfo,
+ characterLayoutInfo,
+ relayoutParameters,
+ relayoutData );
+
+ ++relayoutParameters.mCharacterGlobalIndex;
+ relayoutParameters.mIsFirstCharacter = false;
+ relayoutParameters.mIsNewLine = false;
+ } // end characters
+ } // end words
} // end lines
if( relayoutData.mCharacterLayoutInfoTable.empty() )
{
const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1 ) );
- if( lineLayoutInfo.mWordGroupsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
+ if( lineLayoutInfo.mWordsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
{
relayoutData.mTextSizeForRelayoutOption.height += lineLayoutInfo.mSize.height;
}
relayoutParameters.mLineSize = lineLayoutInfo.mSize * relayoutData.mShrinkFactor;
relayoutParameters.mIsNewLine = true;
- relayoutParameters.mIndices.mGroupIndex = 0;
+ relayoutParameters.mIndices.mWordIndex = 0;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt, ++relayoutParameters.mIndices.mGroupIndex )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
+ relayoutParameters.mIsWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
+ relayoutParameters.mIsNewLineCharacter = TextViewProcessor::LineSeparator == wordLayoutInfo.mType;
- relayoutParameters.mIndices.mWordIndex = 0;
+ relayoutParameters.mIsFirstCharacterOfWord = true;
+ relayoutParameters.mWordSize = wordLayoutInfo.mSize;
+ relayoutParameters.mIndices.mCharacterIndex = 0;
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
+ if( relayoutParameters.mIsNewLine )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- relayoutParameters.mIsWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
- relayoutParameters.mIsNewLineCharacter = TextViewProcessor::LineSeparator == wordLayoutInfo.mType;
+ // Stores some info to calculate the line justification in a post-process.
+ const bool isSplitOriginal = layoutParameters.mExceedPolicy == TextView::SplitOriginal;
- relayoutParameters.mIsFirstCharacterOfWord = true;
- relayoutParameters.mWordSize = wordLayoutInfo.mSize;
- relayoutParameters.mIndices.mCharacterIndex = 0;
-
- if( relayoutParameters.mIsNewLine )
+ if( !isSplitOriginal )
{
- // Stores some info to calculate the line justification in a post-process.
- const bool isSplitOriginal = layoutParameters.mExceedPolicy == TextView::SplitOriginal;
-
- if( !isSplitOriginal )
- {
- TextView::LineJustificationInfo justificationInfo;
+ TextView::LineJustificationInfo justificationInfo;
- justificationInfo.mIndices = relayoutParameters.mIndices;
- justificationInfo.mLineLength = relayoutParameters.mLineSize.width;
+ justificationInfo.mIndices = relayoutParameters.mIndices;
+ justificationInfo.mLineLength = relayoutParameters.mLineSize.width;
- relayoutData.mLineJustificationInfo.push_back( justificationInfo );
- }
+ relayoutData.mLineJustificationInfo.push_back( justificationInfo );
}
+ }
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterLayoutIt != endCharacterLayoutIt;
- ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex )
- {
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
+ characterLayoutIt != endCharacterLayoutIt;
+ ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex )
+ {
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
+ relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
- relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
+ relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
- switch( layoutParameters.mExceedPolicy )
+ switch( layoutParameters.mExceedPolicy )
+ {
+ case TextView::OriginalShrink:
+ case TextView::SplitShrink:
+ case TextView::ShrinkFade: // Fall Through
{
- case TextView::OriginalShrink:
- case TextView::SplitShrink:
- case TextView::ShrinkFade: // Fall Through
- {
- DALI_LOG_WARNING( "SplitByNewLineChar::CalculateSizeAndPosition() policy not implemented.\n" );
- break;
- }
- case TextView::Original: // Fall Through
- case TextView::ShrinkOriginal: // Fall Through
- case TextView::Shrink: // Fall Through
- case TextView::OriginalFade: // Fall Through
- case TextView::FadeOriginal: // Fall Through
- case TextView::Fade: // Fall Through
- case TextView::EllipsizeEndOriginal: // Fall Through
- case TextView::EllipsizeEnd: // Fall Through
+ DALI_LOG_WARNING( "SplitByNewLineChar::CalculateSizeAndPosition() policy not implemented.\n" );
+ break;
+ }
+ case TextView::Original: // Fall Through
+ case TextView::ShrinkOriginal: // Fall Through
+ case TextView::Shrink: // Fall Through
+ case TextView::OriginalFade: // Fall Through
+ case TextView::FadeOriginal: // Fall Through
+ case TextView::Fade: // Fall Through
+ case TextView::EllipsizeEndOriginal: // Fall Through
+ case TextView::EllipsizeEnd: // Fall Through
+ {
+ if( relayoutParameters.mIsNewLine )
{
- if( relayoutParameters.mIsNewLine )
- {
- relayoutParameters.mPositionOffset.x = 0.f;
- relayoutParameters.mPositionOffset.y += lineLayoutInfo.mSize.height * relayoutData.mShrinkFactor;
- }
-
- characterLayoutInfo.mPosition = relayoutParameters.mPositionOffset;
-
- relayoutParameters.mPositionOffset.x += characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor;
-
- if( relayoutParameters.mIsNewLine ||
- relayoutParameters.mIsFirstCharacter )
- {
- Toolkit::TextView::LineLayoutInfo lineInfo;
- lineInfo.mCharacterGlobalIndex = relayoutParameters.mCharacterGlobalIndex; // Index to the first character of the next line.
- lineInfo.mSize = relayoutParameters.mLineSize; // Size of this piece of line.
- lineInfo.mAscender = lineLayoutInfo.mAscender * relayoutData.mShrinkFactor; // Ascender of this piece of line.
- relayoutData.mLines.push_back( lineInfo );
- }
- break;
+ relayoutParameters.mPositionOffset.x = 0.f;
+ relayoutParameters.mPositionOffset.y += lineLayoutInfo.mSize.height * relayoutData.mShrinkFactor;
}
- case TextView::SplitOriginal:
- case TextView::SplitFade:
- case TextView::SplitEllipsizeEnd: // Fall Through
- {
- characterLayoutInfo.mPosition = SplitPosition( relayoutParameters,
- layoutParameters,
- relayoutData );
- relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
- break;
- }
- default:
+ characterLayoutInfo.mPosition = relayoutParameters.mPositionOffset;
+
+ relayoutParameters.mPositionOffset.x += characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor;
+
+ if( relayoutParameters.mIsNewLine ||
+ relayoutParameters.mIsFirstCharacter )
{
- DALI_LOG_WARNING( "SplitByNewLineChar::CalculateSizeAndPosition() Layout configuration not possible.\n" );
- break;
+ Toolkit::TextView::LineLayoutInfo lineInfo;
+ lineInfo.mCharacterGlobalIndex = relayoutParameters.mCharacterGlobalIndex; // Index to the first character of the next line.
+ lineInfo.mSize = relayoutParameters.mLineSize; // Size of this piece of line.
+ lineInfo.mAscender = lineLayoutInfo.mAscender * relayoutData.mShrinkFactor; // Ascender of this piece of line.
+ relayoutData.mLines.push_back( lineInfo );
}
+ break;
+ }
+ case TextView::SplitOriginal:
+ case TextView::SplitFade:
+ case TextView::SplitEllipsizeEnd: // Fall Through
+ {
+ characterLayoutInfo.mPosition = SplitPosition( relayoutParameters,
+ layoutParameters,
+ relayoutData );
+
+ relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
+ break;
}
+ default:
+ {
+ DALI_LOG_WARNING( "SplitByNewLineChar::CalculateSizeAndPosition() Layout configuration not possible.\n" );
+ break;
+ }
+ }
- // Get last line info and calculate the bearing (used to align glyphs with the baseline).
- TextViewRelayout::CalculateBearing( characterLayoutInfo, relayoutData );
-
- // updates min and max position to calculate the text size for split by new line char.
- TextViewRelayout::UpdateLayoutInfoTable( minMaxXY,
- wordGroupLayoutInfo,
- wordLayoutInfo,
- characterLayoutInfo,
- relayoutParameters,
- relayoutData );
-
- ++relayoutParameters.mCharacterGlobalIndex;
- relayoutParameters.mIsFirstCharacter = false;
- relayoutParameters.mIsNewLine = false;
- } // end characters
- } // end words
- } // end group of words
+ // Get last line info and calculate the bearing (used to align glyphs with the baseline).
+ TextViewRelayout::CalculateBearing( characterLayoutInfo, relayoutData );
+
+ // updates min and max position to calculate the text size for split by new line char.
+ TextViewRelayout::UpdateLayoutInfoTable( minMaxXY,
+ wordLayoutInfo,
+ characterLayoutInfo,
+ relayoutParameters,
+ relayoutData );
+
+ ++relayoutParameters.mCharacterGlobalIndex;
+ relayoutParameters.mIsFirstCharacter = false;
+ relayoutParameters.mIsNewLine = false;
+ } // end characters
+ } // end words
} // end lines
if( relayoutData.mCharacterLayoutInfoTable.empty() )
{
const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1 ) );
- if( lineLayoutInfo.mWordGroupsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
+ if( lineLayoutInfo.mWordsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
{
relayoutData.mTextSizeForRelayoutOption.height += lineLayoutInfo.mSize.height * relayoutData.mShrinkFactor;
}
{
// It may mean there is a word which is actually longer than the width of the text-view.
// In that case the length of this word is needed.
- if( !lineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ if( !lineLayoutInfo.mWordsLayoutInfo.empty() )
{
- const TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *( lineLayoutInfo.mWordGroupsLayoutInfo.begin() + relayoutParameters.mIndices.mGroupIndex ) );
- if( !wordGroupLayoutInfo.mWordsLayoutInfo.empty() )
- {
- const TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *( wordGroupLayoutInfo.mWordsLayoutInfo.begin() + relayoutParameters.mIndices.mWordIndex ) );
- subLineInfo.mLineLength = wordLayoutInfo.mSize.width;
- }
+ const TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *( lineLayoutInfo.mWordsLayoutInfo.begin() + relayoutParameters.mIndices.mWordIndex ) );
+ subLineInfo.mLineLength = wordLayoutInfo.mSize.width;
}
}
// The next character is in a new line.
bool isNewLine = true;
- // Reset the index of groups of words.
- indices.mGroupIndex = 0;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(), groupEndIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupIt != groupEndIt;
- ++groupIt, ++indices.mGroupIndex )
+ // Reset the index of words.
+ indices.mWordIndex = 0;
+
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = lineLayoutInfo.mWordsLayoutInfo.begin(), wordEndIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordIt != wordEndIt;
+ ++wordIt, ++indices.mWordIndex )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordIt );
- // Reset the index of words.
- indices.mWordIndex = 0;
+ // Reset the index of the character.
+ indices.mCharacterIndex = 0;
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(), wordEndIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordIt != wordEndIt;
- ++wordIt, ++indices.mWordIndex )
- {
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordIt );
+ // Whether current character is the first of the word.
+ bool isFirstCharOfWord = true;
+ const float wordOffset = previousPosition.x + previousSize.width;
- // Reset the index of the character.
- indices.mCharacterIndex = 0;
+ isLastCharacterNewLineChar = ( TextViewProcessor::LineSeparator == wordLayoutInfo.mType );
- // Whether current character is the first of the word.
- bool isFirstCharOfWord = true;
- const float wordOffset = previousPosition.x + previousSize.width;
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator charIt = wordLayoutInfo.mCharactersLayoutInfo.begin(), charEndIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ charIt != charEndIt;
+ ++charIt, ++indices.mCharacterIndex )
+ {
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *charIt );
+ lastCharHeight = characterLayoutInfo.mSize.height * shrinkFactor;
- isLastCharacterNewLineChar = ( TextViewProcessor::LineSeparator == wordLayoutInfo.mType );
+ const float previousPositionY = isFirstChar ? 0.f : previousPosition.y;
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator charIt = wordLayoutInfo.mCharactersLayoutInfo.begin(), charEndIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- charIt != charEndIt;
- ++charIt, ++indices.mCharacterIndex )
+ if( ( isNewLine || isFirstChar ) ||
+ ( isFirstCharOfWord && ( wordOffset + wordLayoutInfo.mSize.width * shrinkFactor > parentWidth ) ) )
{
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *charIt );
- lastCharHeight = characterLayoutInfo.mSize.height * shrinkFactor;
-
- const float previousPositionY = isFirstChar ? 0.f : previousPosition.y;
-
- if( ( isNewLine || isFirstChar ) ||
- ( isFirstCharOfWord && ( wordOffset + wordLayoutInfo.mSize.width * shrinkFactor > parentWidth ) ) )
- {
- isFirstChar = false;
+ isFirstChar = false;
- // Calculates the line length and the max character height for the current line.
- TextViewRelayout::SubLineLayoutInfo subLineInfo;
- subLineInfo.mLineLength = 0.f;
- subLineInfo.mMaxCharHeight = 0.f;
- subLineInfo.mMaxAscender = 0.f;
- TextViewRelayout::CalculateSubLineLayout( parentWidth,
- indices,
- lineLayoutInfo,
- TextViewRelayout::WrapByWord,
- shrinkFactor,
- subLineInfo );
+ // Calculates the line length and the max character height for the current line.
+ TextViewRelayout::SubLineLayoutInfo subLineInfo;
+ subLineInfo.mLineLength = 0.f;
+ subLineInfo.mMaxCharHeight = 0.f;
+ subLineInfo.mMaxAscender = 0.f;
+ TextViewRelayout::CalculateSubLineLayout( parentWidth,
+ indices,
+ lineLayoutInfo,
+ TextViewRelayout::WrapByWord,
+ shrinkFactor,
+ subLineInfo );
- characterLayoutInfo.mPosition = Vector3( 0.f, previousPositionY + subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset * shrinkFactor, 0.f );
+ characterLayoutInfo.mPosition = Vector3( 0.f, previousPositionY + subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset * shrinkFactor, 0.f );
- newTextHeight += subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset * shrinkFactor;
+ newTextHeight += subLineInfo.mMaxCharHeight + layoutParameters.mLineHeightOffset * shrinkFactor;
- Toolkit::TextView::LineLayoutInfo lineInfo;
- lineInfo.mCharacterGlobalIndex = characterGlobalIndex; // Index to the first character of the next line.
- lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of line.
- lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of line.
- relayoutData.mLines.push_back( lineInfo );
+ Toolkit::TextView::LineLayoutInfo lineInfo;
+ lineInfo.mCharacterGlobalIndex = characterGlobalIndex; // Index to the first character of the next line.
+ lineInfo.mSize = Size( subLineInfo.mLineLength, subLineInfo.mMaxCharHeight ); // Size of this piece of line.
+ lineInfo.mAscender = subLineInfo.mMaxAscender; // Ascender of this piece of line.
+ relayoutData.mLines.push_back( lineInfo );
- // Stores some info to calculate the line justification in a post-process.
- TextView::LineJustificationInfo justificationInfo;
+ // Stores some info to calculate the line justification in a post-process.
+ TextView::LineJustificationInfo justificationInfo;
- justificationInfo.mIndices = indices;
- justificationInfo.mLineLength = subLineInfo.mLineLength;
+ justificationInfo.mIndices = indices;
+ justificationInfo.mLineLength = subLineInfo.mLineLength;
- relayoutData.mLineJustificationInfo.push_back( justificationInfo );
- }
- else
- {
- characterLayoutInfo.mPosition = previousPosition + Vector3( previousSize.width, 0.f, 0.f );
- }
+ relayoutData.mLineJustificationInfo.push_back( justificationInfo );
+ }
+ else
+ {
+ characterLayoutInfo.mPosition = previousPosition + Vector3( previousSize.width, 0.f, 0.f );
+ }
- // Get last line info and calculate the bearing.
- const Toolkit::TextView::LineLayoutInfo& lineInfo( *( relayoutData.mLines.end() - 1 ) );
- const float bearingOffset = ( ( lineInfo.mSize.height - lineInfo.mAscender ) - ( characterLayoutInfo.mSize.height - characterLayoutInfo.mAscender ) ) * shrinkFactor;
+ // Get last line info and calculate the bearing.
+ const Toolkit::TextView::LineLayoutInfo& lineInfo( *( relayoutData.mLines.end() - 1 ) );
+ const float bearingOffset = ( ( lineInfo.mSize.height - lineInfo.mAscender ) - ( characterLayoutInfo.mSize.height - characterLayoutInfo.mAscender ) ) * shrinkFactor;
- previousSize = characterLayoutInfo.mSize * shrinkFactor;
- previousPosition = characterLayoutInfo.mPosition;
- characterLayoutInfo.mPosition.y -= bearingOffset;
- isFirstCharOfWord = false;
- isNewLine = false;
+ previousSize = characterLayoutInfo.mSize * shrinkFactor;
+ previousPosition = characterLayoutInfo.mPosition;
+ characterLayoutInfo.mPosition.y -= bearingOffset;
+ isFirstCharOfWord = false;
+ isNewLine = false;
- ++characterGlobalIndex;
- }
+ ++characterGlobalIndex;
}
}
}
relayoutParameters.mIsNewLine = true;
relayoutParameters.mLineSize = lineLayoutInfo.mSize;
- relayoutParameters.mIndices.mGroupIndex = 0;
+ relayoutParameters.mIndices.mWordIndex = 0;
- for( TextViewProcessor::WordGroupLayoutInfoContainer::iterator groupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- endGroupLayoutIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- groupLayoutIt != endGroupLayoutIt;
- ++groupLayoutIt, ++relayoutParameters.mIndices.mGroupIndex )
+ for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ endWordLayoutIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ wordLayoutIt != endWordLayoutIt;
+ ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
{
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo( *groupLayoutIt );
+ TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
+ relayoutParameters.mIsWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
+ relayoutParameters.mIsNewLineCharacter = TextViewProcessor::LineSeparator == wordLayoutInfo.mType;
- relayoutParameters.mIndices.mWordIndex = 0;
+ relayoutParameters.mIsFirstCharacterOfWord = true;
+ relayoutParameters.mWordSize = wordLayoutInfo.mSize;
+ relayoutParameters.mIndices.mCharacterIndex = 0;
- for( TextViewProcessor::WordLayoutInfoContainer::iterator wordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- endWordLayoutIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- wordLayoutIt != endWordLayoutIt;
- ++wordLayoutIt, ++relayoutParameters.mIndices.mWordIndex )
+ for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
+ endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ ( characterLayoutIt != endCharacterLayoutIt );
+ ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex )
{
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo( *wordLayoutIt );
- relayoutParameters.mIsWhiteSpace = TextViewProcessor::WordSeparator == wordLayoutInfo.mType;
- relayoutParameters.mIsNewLineCharacter = TextViewProcessor::LineSeparator == wordLayoutInfo.mType;
+ TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
- relayoutParameters.mIsFirstCharacterOfWord = true;
- relayoutParameters.mWordSize = wordLayoutInfo.mSize;
- relayoutParameters.mIndices.mCharacterIndex = 0;
+ relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
- for( TextViewProcessor::CharacterLayoutInfoContainer::iterator characterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.begin(),
- endCharacterLayoutIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- ( characterLayoutIt != endCharacterLayoutIt );
- ++characterLayoutIt, ++relayoutParameters.mIndices.mCharacterIndex )
+ switch( layoutParameters.mExceedPolicy )
{
- TextViewProcessor::CharacterLayoutInfo& characterLayoutInfo( *characterLayoutIt );
-
- relayoutParameters.mCharacterSize = characterLayoutInfo.mSize;
+ case TextView::OriginalShrink:
+ case TextView::SplitShrink:
+ case TextView::ShrinkFade:
+ {
+ DALI_LOG_WARNING( "SplitByWord::CalculateSizeAndPosition() policy not implemented.\n" );
+ break;
+ }
+ case TextView::Original:
+ case TextView::OriginalFade:
+ case TextView::FadeOriginal:
+ case TextView::Fade:
+ case TextView::EllipsizeEndOriginal:
+ case TextView::EllipsizeEnd: // Fall Through
+ {
+ characterLayoutInfo.mPosition = OriginalPosition( relayoutParameters,
+ layoutParameters,
+ relayoutData );
- switch( layoutParameters.mExceedPolicy )
+ relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
+ break;
+ }
+ case TextView::SplitOriginal:
+ case TextView::SplitFade:
+ case TextView::SplitEllipsizeEnd:
{
- case TextView::OriginalShrink:
- case TextView::SplitShrink:
- case TextView::ShrinkFade:
- {
- DALI_LOG_WARNING( "SplitByWord::CalculateSizeAndPosition() policy not implemented.\n" );
- break;
- }
- case TextView::Original:
- case TextView::OriginalFade:
- case TextView::FadeOriginal:
- case TextView::Fade:
- case TextView::EllipsizeEndOriginal:
- case TextView::EllipsizeEnd: // Fall Through
- {
- characterLayoutInfo.mPosition = OriginalPosition( relayoutParameters,
- layoutParameters,
- relayoutData );
-
- relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
- break;
- }
- case TextView::SplitOriginal:
- case TextView::SplitFade:
- case TextView::SplitEllipsizeEnd:
- {
- characterLayoutInfo.mPosition = SplitWhenExceedPosition( relayoutParameters,
- layoutParameters,
- relayoutData );
-
- relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
- break;
- }
- case TextView::ShrinkOriginal:
- {
- characterLayoutInfo.mPosition = ShrinkWidthWhenExceedPosition( relayoutParameters,
- layoutParameters,
- relayoutData );
-
- relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor, 0.f, 0.f );
- break;
- }
- case TextView::Shrink:
- {
- // Does nothing. All the job has been done in the RelayoutForShrinkToFit() function.
- break;
- }
- default:
- {
- DALI_LOG_WARNING( "SplitByWord::CalculateSizeAndPosition() policy combination not possible.\n" );
- }
+ characterLayoutInfo.mPosition = SplitWhenExceedPosition( relayoutParameters,
+ layoutParameters,
+ relayoutData );
+
+ relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width, 0.f, 0.f );
+ break;
}
+ case TextView::ShrinkOriginal:
+ {
+ characterLayoutInfo.mPosition = ShrinkWidthWhenExceedPosition( relayoutParameters,
+ layoutParameters,
+ relayoutData );
- // Get last line info and calculate the bearing (used to align glyphs with the baseline).
- if( TextView::Shrink != layoutParameters.mExceedPolicy )
+ relayoutParameters.mPositionOffset = characterLayoutInfo.mPosition + Vector3( characterLayoutInfo.mSize.width * relayoutData.mShrinkFactor, 0.f, 0.f );
+ break;
+ }
+ case TextView::Shrink:
+ {
+ // Does nothing. All the job has been done in the RelayoutForShrinkToFit() function.
+ break;
+ }
+ default:
{
- TextViewRelayout::CalculateBearing( characterLayoutInfo, relayoutData );
+ DALI_LOG_WARNING( "SplitByWord::CalculateSizeAndPosition() policy combination not possible.\n" );
}
+ }
+
+ // Get last line info and calculate the bearing (used to align glyphs with the baseline).
+ if( TextView::Shrink != layoutParameters.mExceedPolicy )
+ {
+ TextViewRelayout::CalculateBearing( characterLayoutInfo, relayoutData );
+ }
- // updates min and max position to calculate the text size for split by word.
- TextViewRelayout::UpdateLayoutInfoTable( minMaxXY,
- wordGroupLayoutInfo,
- wordLayoutInfo,
- characterLayoutInfo,
- relayoutParameters,
- relayoutData );
-
- ++relayoutParameters.mCharacterGlobalIndex;
- relayoutParameters.mIsFirstCharacter = false;
- relayoutParameters.mIsFirstCharacterOfWord = false;
- relayoutParameters.mIsNewLine = false;
- } // end characters
- } // end words
- } // end group of words
+ // updates min and max position to calculate the text size for split by word.
+ TextViewRelayout::UpdateLayoutInfoTable( minMaxXY,
+ wordLayoutInfo,
+ characterLayoutInfo,
+ relayoutParameters,
+ relayoutData );
+
+ ++relayoutParameters.mCharacterGlobalIndex;
+ relayoutParameters.mIsFirstCharacter = false;
+ relayoutParameters.mIsFirstCharacterOfWord = false;
+ relayoutParameters.mIsNewLine = false;
+ } // end characters
+ } // end words
} // end lines
if( relayoutData.mCharacterLayoutInfoTable.empty() )
{
const TextViewProcessor::LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1 ) );
- if( lineLayoutInfo.mWordGroupsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
+ if( lineLayoutInfo.mWordsLayoutInfo.empty() ) // if it's empty, it means the last character is a new line character.
{
relayoutData.mTextSizeForRelayoutOption.height += lineLayoutInfo.mSize.height * relayoutData.mShrinkFactor;
}
}
void ConvertBidirectionalText( const MarkupProcessor::StyledTextArray& line,
- std::vector<MarkupProcessor::StyledTextArray>& convertedText,
+ MarkupProcessor::StyledTextArray& convertedText,
std::vector<int>& logicalToVisualMap,
std::vector<int>& visualToLogicalMap )
{
// To assign the original style is needed to use the characterLogicalToVisualMap table.
Text text( &bidiTextConverted[0] );
- // Split the line in groups of words.
- // Words are grouped if they can be displayed left to right or right to left.
+ // Split the line in words.
// Add the correct styles for the characters after they are reordered.
- MarkupProcessor::StyledTextArray groupOfWords;
-
- Character::CharacterDirection previousDirection = ( BeginsRightToLeftCharacter( line ) ? Character::RightToLeft : Character::LeftToRight );
for( size_t i = 0; i < length; ++i )
{
const Character character( text[i] );
- Character::CharacterDirection currentDirection = character.GetCharacterDirection();
- if( Character::Neutral == currentDirection )
- {
- currentDirection = previousDirection;
- }
-
MarkupProcessor::StyledText styledText;
styledText.mText.Append( character );
styledText.mStyle = line[visualToLogicalMap[i]].mStyle;
- if( currentDirection != previousDirection )
- {
- if( !groupOfWords.empty() )
- {
- convertedText.push_back( groupOfWords );
- groupOfWords.clear();
- }
- }
-
- groupOfWords.push_back( styledText );
-
- previousDirection = currentDirection;
- }
-
- if( !groupOfWords.empty() )
- {
- convertedText.push_back( groupOfWords );
+ convertedText.push_back( styledText );
}
}
}
* Convert the text as specified by the Unicode Bidirectional Algorithm.
* The text is converted only if it is bidirectional.
* @param[in] line The line of text to be converted.
- * @param[out] convertedText The text converted. Text is grouped in chunks which only have one direction.
+ * @param[out] convertedText The text converted.
* @param[out] logicalToVisualMap The character position map from the logical input text to the visual output text.
* @param[out] visualToLogicalMap The character position map from the visual output text to the logical input text.
*/
void ConvertBidirectionalText( const MarkupProcessor::StyledTextArray& line,
- std::vector<MarkupProcessor::StyledTextArray>& convertedText,
+ MarkupProcessor::StyledTextArray& convertedText,
std::vector<int>& logicalToVisualMap,
std::vector<int>& visualToLogicalMap );
TextView& operator=( const TextView& rhs );
/**
- * Executes synchronously relayout operations such as set, insert, remove or replace text, or
- * split groups of characters, etc.
+ * Executes synchronously relayout operations such as set, insert, remove or replace text, etc.
*/
void PerformTextViewProcessorOperations();
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
#include <dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h>
#include <dali-toolkit/internal/controls/text-view/text-processor.h>
: mSize(),
mAscender( 0.f ),
mLineHeightOffset( 0.f ),
- mWordGroupsLayoutInfo(),
+ mWordsLayoutInfo(),
mNumberOfCharacters( 0 )
{
}
: mSize( line.mSize ),
mAscender( line.mAscender ),
mLineHeightOffset( line.mLineHeightOffset ),
- mWordGroupsLayoutInfo( line.mWordGroupsLayoutInfo ),
+ mWordsLayoutInfo( line.mWordsLayoutInfo ),
mNumberOfCharacters( line.mNumberOfCharacters )
{
}
mSize = line.mSize;
mAscender = line.mAscender;
mLineHeightOffset = line.mLineHeightOffset;
- mWordGroupsLayoutInfo = line.mWordGroupsLayoutInfo;
+ mWordsLayoutInfo = line.mWordsLayoutInfo;
mNumberOfCharacters = line.mNumberOfCharacters;
return *this;
}
-void UpdateLineLayoutInfo( TextViewProcessor::LineLayoutInfo& lineLayoutInfo, const float lineHeightOffset )
+void UpdateLineLayoutInfo( LineLayoutInfo& lineLayoutInfo, const float lineHeightOffset )
{
- lineLayoutInfo.mSize = Size();
-
- for( WordGroupLayoutInfoContainer::iterator it = lineLayoutInfo.mWordGroupsLayoutInfo.begin(), endIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
+ // Update layout info.
+ lineLayoutInfo.mSize = Size::ZERO;
+ lineLayoutInfo.mAscender = 0.f;
+ lineLayoutInfo.mNumberOfCharacters = 0u;
+ for( WordLayoutInfoContainer::iterator it = lineLayoutInfo.mWordsLayoutInfo.begin(), endIt = lineLayoutInfo.mWordsLayoutInfo.end();
it != endIt;
++it )
{
- WordGroupLayoutInfo& layoutInfo( *it );
+ WordLayoutInfo& word( *it );
- UpdateSize( lineLayoutInfo.mSize, layoutInfo.mSize );
+ UpdateSize( lineLayoutInfo.mSize, word.mSize );
+ lineLayoutInfo.mAscender = std::max( lineLayoutInfo.mAscender, word.mAscender );
+ lineLayoutInfo.mNumberOfCharacters += word.mCharactersLayoutInfo.size();
}
+
lineLayoutInfo.mSize.height += lineHeightOffset;
+ lineLayoutInfo.mLineHeightOffset = lineHeightOffset;
}
void CreateLineInfo( const MarkupProcessor::StyledTextArray& line,
TextView::RelayoutData& relayoutData,
- TextViewProcessor::LineLayoutInfo& lineLayoutInfo )
+ LineLayoutInfo& lineLayoutInfo )
{
- // TODO: Split the line in group of words. Each group of words has only left to right characters or right to left characters but not a mix of both.
- // TODO: set the wordgroup direction (LTR or RTL)
- std::vector<MarkupProcessor::StyledTextArray> wordGroups;
+ // Split the line in words.
+ // TODO: Proper RTL support.
+ MarkupProcessor::StyledTextArray convertedLine;
if( TextProcessor::ContainsRightToLeftCharacter( line ) )
{
// If the text is bidirectional, the characters will be converted and reordered
// as specified by the Unicode Bidirectional Algorithm.
// Reorders the line and converts arabic glyphs (if any).
- // It also split words in different groups if there are a mix of left to right
- // and right to left text.
- // If the whole line is left to right or right to left all words are grouped in the same group.
TextProcessor::ConvertBidirectionalText( line,
- wordGroups,
+ convertedLine,
relayoutData.mCharacterLogicalToVisualMap,
relayoutData.mCharacterVisualToLogicalMap);
}
else
{
// No bidirectional text to process.
+ convertedLine = line;
- if( !line.empty() )
+ // Create trivial bidirectional map tables.
+ std::size_t index = 0;
+ for( MarkupProcessor::StyledTextArray::const_iterator it = convertedLine.begin(), endIt = convertedLine.end(); it != endIt; ++it )
{
- // Add all words in a group.
- wordGroups.push_back( line );
+ const MarkupProcessor::StyledText& styledText( *it );
- // Create trivial bidirectional map tables.
- std::size_t index = 0;
- for( MarkupProcessor::StyledTextArray::const_iterator it = line.begin(), endIt = line.end(); it != endIt; ++it )
+ for( std::size_t i = 0, length = styledText.mText.GetLength(); i < length; ++i )
{
- const MarkupProcessor::StyledText& styledText( *it );
+ relayoutData.mCharacterLogicalToVisualMap.push_back( relayoutData.mTextLayoutInfo.mNumberOfCharacters + index );
+ relayoutData.mCharacterVisualToLogicalMap.push_back( relayoutData.mTextLayoutInfo.mNumberOfCharacters + index );
+ ++index;
+ }
+ }
+ }
+
+ // Split the line in words
+ std::vector<MarkupProcessor::StyledTextArray> words;
+ TextProcessor::SplitInWords( convertedLine, words );
- for( std::size_t i = 0, length = styledText.mText.GetLength(); i < length; ++i )
+ // if last word has a new line separator, create a new word.
+ if( !words.empty() )
+ {
+ MarkupProcessor::StyledTextArray& word( *( words.end() - 1u ) );
+ if( word.size() > 1u )
+ {
+ // do nothing if the word has only one character.
+ MarkupProcessor::StyledText& styledText( *( word.end() - 1u ) );
+ if( !styledText.mText.IsEmpty() )
+ {
+ const std::size_t length = styledText.mText.GetLength();
+ if( styledText.mText[length-1u].IsNewLine() )
{
- relayoutData.mCharacterLogicalToVisualMap.push_back( relayoutData.mTextLayoutInfo.mNumberOfCharacters + index );
- relayoutData.mCharacterVisualToLogicalMap.push_back( relayoutData.mTextLayoutInfo.mNumberOfCharacters + index );
- ++index;
+ // Last character of this word is a new line character.
+
+ // Remove line separator character from current word.
+ styledText.mText.Remove( length - 1u, 1u );
+
+ // Create a new word with the line separator character.
+ MarkupProcessor::StyledText newLineText( Text( styledText.mText[length-1u] ), styledText.mStyle );
+
+ MarkupProcessor::StyledTextArray newLineWord;
+ newLineWord.push_back( newLineText );
+
+ words.push_back( newLineWord );
}
}
}
}
- // Traverse all group of words.
- for( std::vector<MarkupProcessor::StyledTextArray>::const_iterator groupIt = wordGroups.begin(), groupEndIt = wordGroups.end(); groupIt != groupEndIt; ++groupIt )
+ std::string lastCharacterFont; // Keeps the font used by the last character. It's used to set the font to a word separator.
+
+ // Traverse all words.
+ for( std::vector<MarkupProcessor::StyledTextArray>::const_iterator wordIt = words.begin(), wordEndIt = words.end(); wordIt != wordEndIt; ++wordIt )
{
- const MarkupProcessor::StyledTextArray& wordGroup( *groupIt );
+ const MarkupProcessor::StyledTextArray& word( *wordIt );
+
+ // Data structures for the new word.
+ WordLayoutInfo wordLayoutInfo;
- // Data structures for the new group of words.
- WordGroupLayoutInfo wordGroupLayoutInfo;
+ CreateWordTextInfo( word,
+ wordLayoutInfo );
+
+ // White space's size could be different depending on the type of font. It's important to use the same font than the previous character to
+ // avoid 'jumps' of characters when there is a switch between one text-actor per character and one text-actor per line and/or style.
+ if( WordSeparator == wordLayoutInfo.mType )
+ {
+ // If current word is a word separator (white space) then the font of the last character is set.
+ for( CharacterLayoutInfoContainer::iterator characterIt = wordLayoutInfo.mCharactersLayoutInfo.begin(), characterEndIt = wordLayoutInfo.mCharactersLayoutInfo.end();
+ characterIt != characterEndIt;
+ ++characterIt )
+ {
+ CharacterLayoutInfo& characterLayout( *characterIt );
+
+ characterLayout.mStyledText.mStyle.SetFontName( lastCharacterFont );
+ }
+ }
+ else
+ {
+ // kepps the font of the last character.
+ if( !wordLayoutInfo.mCharactersLayoutInfo.empty() )
+ {
+ lastCharacterFont = ( *( wordLayoutInfo.mCharactersLayoutInfo.end() - 1 ) ).mStyledText.mStyle.GetFontName();
+ }
+ }
- CreateWordGroupInfo( wordGroup,
- relayoutData.mTextLayoutInfo,
- wordGroupLayoutInfo );
+ // Update the max word width figure.
+ relayoutData.mTextLayoutInfo.mMaxWordWidth = std::max( relayoutData.mTextLayoutInfo.mMaxWordWidth, wordLayoutInfo.mSize.width );
// Update layout info for the current line.
- lineLayoutInfo.mAscender = std::max( lineLayoutInfo.mAscender, wordGroupLayoutInfo.mAscender );
- lineLayoutInfo.mNumberOfCharacters += wordGroupLayoutInfo.mNumberOfCharacters;
- UpdateSize( lineLayoutInfo.mSize, wordGroupLayoutInfo.mSize );
+ lineLayoutInfo.mAscender = std::max( lineLayoutInfo.mAscender, wordLayoutInfo.mAscender );
+ lineLayoutInfo.mNumberOfCharacters += wordLayoutInfo.mCharactersLayoutInfo.size();
+ UpdateSize( lineLayoutInfo.mSize, wordLayoutInfo.mSize );
- // Add the group of words to the current line.
- lineLayoutInfo.mWordGroupsLayoutInfo.push_back( wordGroupLayoutInfo );
- } // end of group of words
+ // Add the word to the current line.
+ lineLayoutInfo.mWordsLayoutInfo.push_back( wordLayoutInfo );
+ } // end of words
}
-void RemoveWordGroupsFromLine( const std::size_t groupIndex,
- const std::size_t numberOfGroups,
- const PointSize& lineHeightOffset,
- LineLayoutInfo& lineLayout )
+void RemoveWordsFromLine( std::size_t wordIndex,
+ std::size_t numberOfWords,
+ float lineHeightOffset,
+ LineLayoutInfo& lineLayout )
{
- // Removes groups of words from a line.
+ // Removes words from a line.
- // * Check if words or lines can be merged after removing a group of words or a line separator have to be done outside this method.
+ // * Check if words or lines can be merged after removing a number of words or a line separator needs to be done outside this method.
- // * Note: Currently it's only used to remove a number of groups of words from the beginning, or
- // from groupIndex index to the end. This function doesn't merge groups of words (if a whole group is removed)
- // TODO: merge groups of words if required.
+ // Remove words from layout info.
+ lineLayout.mWordsLayoutInfo.erase( lineLayout.mWordsLayoutInfo.begin() + wordIndex,
+ lineLayout.mWordsLayoutInfo.begin() + ( wordIndex + numberOfWords ) );
- const std::size_t groupEndIndex = groupIndex + numberOfGroups;
+ UpdateLineLayoutInfo( lineLayout, lineHeightOffset );
+}
- // Remove word groups from layout info.
- lineLayout.mWordGroupsLayoutInfo.erase( lineLayout.mWordGroupsLayoutInfo.begin() + groupIndex,
- lineLayout.mWordGroupsLayoutInfo.begin() + groupEndIndex );
+void RemoveCharactersFromLineInfo( TextView::RelayoutData& relayoutData,
+ const std::size_t numberOfCharacters,
+ bool& mergeWords,
+ bool& mergeLines,
+ TextInfoIndices& textInfoIndicesBegin,
+ TextInfoIndices& textInfoIndicesEnd,
+ TextInfoIndices& textInfoMergeIndicesBegin,
+ TextInfoIndices& textInfoMergeIndicesEnd,
+ LineLayoutInfo& lineLayout,
+ std::vector<TextActor>& removedTextActorsFromFirstWord,
+ std::vector<TextActor>& removedTextActorsFromLastWord )
+{
+ const TextLayoutInfo& textLayoutInfo = relayoutData.mTextLayoutInfo;
- // Update layout info.
- lineLayout.mSize = Size();
- lineLayout.mAscender = 0.f;
- lineLayout.mNumberOfCharacters = 0;
- for( WordGroupLayoutInfoContainer::const_iterator it = lineLayout.mWordGroupsLayoutInfo.begin(), endIt = lineLayout.mWordGroupsLayoutInfo.end();
- it != endIt;
- ++it )
+ if( textInfoIndicesBegin.mWordIndex < textInfoIndicesEnd.mWordIndex )
{
- const WordGroupLayoutInfo& group( *it );
+ // Deleted text is from different words. The two different words may be merged.
+
+ // Get first word.
+ WordLayoutInfo& firstWordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex ) );
+
+ // Get last word.
+ WordLayoutInfo& lastWordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
+
+ // whether first or last word need to be split and merged.
+ bool mergeFromBegin = false;
+ bool mergeToEnd = false;
+
+ if( textInfoIndicesBegin.mCharacterIndex > 0u )
+ {
+ // First word is going to be split. It could be merged with the last word.
+ mergeFromBegin = true;
+ textInfoMergeIndicesBegin.mWordIndex = textInfoIndicesBegin.mWordIndex;
+ }
+ else if( ( textInfoIndicesBegin.mCharacterIndex == 0u ) && ( textInfoIndicesBegin.mWordIndex > 0u ) )
+ {
+ // First word is going to be removed completely.
+ // Check if previous word could be merged.
+
+ // Get word before.
+ WordLayoutInfo& previousWordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex - 1u ) );
+ if( WordSeparator != previousWordLayout.mType )
+ {
+ // Previous word is not a word separator, so could be merged.
+ mergeFromBegin = true;
+ textInfoMergeIndicesBegin.mWordIndex = textInfoIndicesBegin.mWordIndex - 1u;
+ }
+ }
- UpdateSize( lineLayout.mSize, group.mSize );
- lineLayout.mAscender = std::max( lineLayout.mAscender, group.mAscender );
- lineLayout.mNumberOfCharacters += group.mNumberOfCharacters;
+ if( mergeFromBegin )
+ {
+ // First word (or previous one) could be merged. Check if last one could be merged as well.
+
+ if( textInfoIndicesEnd.mCharacterIndex + 1u < lastWordLayout.mCharactersLayoutInfo.size() )
+ {
+ // Last word is going to be split. It could be merged with the first word.
+ mergeToEnd = true;
+ textInfoMergeIndicesEnd.mWordIndex = textInfoIndicesEnd.mWordIndex;
+ }
+ else if( ( textInfoIndicesEnd.mCharacterIndex + 1u == lastWordLayout.mCharactersLayoutInfo.size() ) && ( textInfoIndicesEnd.mWordIndex + 1u < lineLayout.mWordsLayoutInfo.size() ) )
+ {
+ // Last word is going to be removed completely.
+ // Check if the word after could be merged.
+
+ // Get word after.
+ WordLayoutInfo& afterWordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex + 1u ) );
+ if( WordSeparator != afterWordLayout.mType )
+ {
+ // The word after is not a word separator, so could be merged.
+ mergeToEnd = true;
+ textInfoMergeIndicesEnd.mWordIndex = textInfoIndicesEnd.mWordIndex + 1u;
+ }
+ }
+
+ // Merge words only if both words could be merged.
+ mergeWords = mergeFromBegin && mergeToEnd;
+ }
+
+ if( ( textInfoIndicesEnd.mCharacterIndex + 1u == lastWordLayout.mCharactersLayoutInfo.size() ) && ( textInfoIndicesEnd.mWordIndex + 1u == lineLayout.mWordsLayoutInfo.size() ) )
+ {
+ // Last word of the line is going to be removed completely.
+ // Check if it's a line separator.
+
+ if( LineSeparator == lastWordLayout.mType )
+ {
+ // The line separator is going to be removed.
+ if( textInfoIndicesBegin.mLineIndex + 1u < textLayoutInfo.mLinesLayoutInfo.size() )
+ {
+ // Line need to be merged.
+ textInfoMergeIndicesBegin.mLineIndex = textInfoIndicesBegin.mLineIndex;
+ textInfoMergeIndicesEnd.mLineIndex = textInfoIndicesBegin.mLineIndex + 1u;
+ mergeLines= true;
+
+ ++textInfoIndicesBegin.mLineIndex; // increase both indices,
+ textInfoIndicesEnd.mLineIndex +=2u; // will delete last line.
+ }
+ }
+ }
+
+ if( textInfoIndicesBegin.mCharacterIndex > 0u )
+ {
+ // First word needs to be split.
+
+ // Store text-actors before removing them.
+ CollectTextActors( removedTextActorsFromFirstWord, firstWordLayout, textInfoIndicesBegin.mCharacterIndex, firstWordLayout.mCharactersLayoutInfo.size() );
+
+ RemoveCharactersFromWord( textInfoIndicesBegin.mCharacterIndex,
+ firstWordLayout.mCharactersLayoutInfo.size() - textInfoIndicesBegin.mCharacterIndex,
+ firstWordLayout );
+
+ ++textInfoIndicesBegin.mWordIndex; // will delete from the word after.
+ }
+
+ if( textInfoIndicesEnd.mCharacterIndex + 1u < lastWordLayout.mCharactersLayoutInfo.size() )
+ {
+ // Last word needs to be split.
+
+ // Store text-actors before removing them.
+ CollectTextActors( removedTextActorsFromLastWord, lastWordLayout, 0u, textInfoIndicesEnd.mCharacterIndex + 1u );
+
+ RemoveCharactersFromWord( 0u,
+ textInfoIndicesEnd.mCharacterIndex + 1u,
+ lastWordLayout );
+
+ if( mergeWords )
+ {
+ // This word is going to be merged, so is not needed.
+ ++textInfoIndicesEnd.mWordIndex; // will delete the last word.
+ }
+ }
+ else if( textInfoIndicesEnd.mCharacterIndex + 1u == lastWordLayout.mCharactersLayoutInfo.size() )
+ {
+ // The whole last word is going to be removed.
+ ++textInfoIndicesEnd.mWordIndex; // will delete the last word.
+
+ if( ( WordSeparator == lastWordLayout.mType ) && mergeWords )
+ {
+ // The last word is a word separator and the word after is going to be merged so is not needed.
+ ++textInfoIndicesEnd.mWordIndex; // will delete the word after the last one.
+ }
+ }
}
- lineLayout.mSize.height += lineHeightOffset;
- lineLayout.mLineHeightOffset = lineHeightOffset;
+ else
+ {
+ // Chraracters to be removed are from the same word.
+
+ RemoveCharactersFromWordInfo( relayoutData,
+ numberOfCharacters,
+ mergeWords,
+ mergeLines,
+ textInfoIndicesBegin,
+ textInfoIndicesEnd,
+ textInfoMergeIndicesBegin,
+ textInfoMergeIndicesEnd,
+ lineLayout,
+ removedTextActorsFromFirstWord );
+ } // word indices
}
void SplitLine( const TextInfoIndices& indices,
LineLayoutInfo& lastLineLayoutInfo )
{
// Splits a line in two.
- // A group of words and a word may be split in two as well.
+ // A word may be split in two as well.
- // * Split the group of words within the line.
- // * Add last part of the group of words to the new line.
- // * Add groups of words from groupPosition + 1 to the end.
+ // * Split the word within the line.
+ // * Add last part of the word to the new line.
+ // * Add words from wordPosition + 1 to the end.
// * Update layout info of the last line.
- // * Remove groups of words added to the last part of the line from the first line.
+ // * Remove words added to the last part of the line from the first line.
// early returns!!
- if( ( 0 == indices.mGroupIndex ) && ( 0 == indices.mWordIndex ) && ( 0 == indices.mCharacterIndex ) )
+ if( ( 0 == indices.mWordIndex ) && ( 0 == indices.mCharacterIndex ) )
{
// the whole line goes to the last part.
lastLineLayoutInfo = firstLineLayoutInfo;
return;
}
- if( !firstLineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ if( !firstLineLayoutInfo.mWordsLayoutInfo.empty() )
{
- const std::size_t numberOfGroups = firstLineLayoutInfo.mWordGroupsLayoutInfo.size();
- if( indices.mGroupIndex == numberOfGroups - 1 )
+ const std::size_t numberOfWords = firstLineLayoutInfo.mWordsLayoutInfo.size();
+ if( indices.mWordIndex == numberOfWords - 1u )
{
- const WordGroupLayoutInfo& group( *( firstLineLayoutInfo.mWordGroupsLayoutInfo.end() - 1 ) );
-
- const std::size_t numberOfWords = group.mWordsLayoutInfo.size();
- if( indices.mWordIndex == numberOfWords - 1 )
+ const WordLayoutInfo& word( *( firstLineLayoutInfo.mWordsLayoutInfo.end() - 1u ) );
+ if( indices.mCharacterIndex == word.mCharactersLayoutInfo.size() )
{
- const WordLayoutInfo& word( *( group.mWordsLayoutInfo.end() - 1 ) );
- if( indices.mCharacterIndex == word.mCharactersLayoutInfo.size() )
- {
- // the whole line goes to the first part.
+ // the whole line goes to the first part.
- // Just delete whatever there is in the last part of the line.
- lastLineLayoutInfo = LineLayoutInfo();
+ // Just delete whatever there is in the last part of the line.
+ lastLineLayoutInfo = LineLayoutInfo();
- return;
- }
+ return;
}
}
}
lastLineLayoutInfo = LineLayoutInfo();
- // 1) Split the group of words whitin the line.
- WordGroupLayoutInfo& firstWordGroupLayoutInfo( *( firstLineLayoutInfo.mWordGroupsLayoutInfo.begin() + indices.mGroupIndex ) );
- WordGroupLayoutInfo lastWordGroupLayoutInfo;
+ // 1) Split the word whitin the line.
+ WordLayoutInfo& firstWordLayoutInfo( *( firstLineLayoutInfo.mWordsLayoutInfo.begin() + indices.mWordIndex ) );
+ WordLayoutInfo lastWordLayoutInfo;
- SplitWordGroup( indices,
- firstWordGroupLayoutInfo,
- lastWordGroupLayoutInfo );
+ SplitWord( indices.mCharacterIndex,
+ firstWordLayoutInfo,
+ lastWordLayoutInfo );
- // 2) Add last part of the group of words to the new line.
- if( !lastWordGroupLayoutInfo.mWordsLayoutInfo.empty() )
+ // 2) Add last part of the word to the new line.
+ if( !lastWordLayoutInfo.mCharactersLayoutInfo.empty() )
{
- lastLineLayoutInfo.mWordGroupsLayoutInfo.push_back( lastWordGroupLayoutInfo );
+ lastLineLayoutInfo.mWordsLayoutInfo.push_back( lastWordLayoutInfo );
}
- // 3) Add groups from group-position + 1 to the end.
- lastLineLayoutInfo.mWordGroupsLayoutInfo.insert( lastLineLayoutInfo.mWordGroupsLayoutInfo.end(),
- firstLineLayoutInfo.mWordGroupsLayoutInfo.begin() + indices.mGroupIndex + 1, firstLineLayoutInfo.mWordGroupsLayoutInfo.end() );
+ // 3) Add words from word-position + 1 to the end.
+ lastLineLayoutInfo.mWordsLayoutInfo.insert( lastLineLayoutInfo.mWordsLayoutInfo.end(),
+ firstLineLayoutInfo.mWordsLayoutInfo.begin() + indices.mWordIndex + 1u,
+ firstLineLayoutInfo.mWordsLayoutInfo.end() );
// 4) update layout info of the last line.
- for( WordGroupLayoutInfoContainer::iterator it = lastLineLayoutInfo.mWordGroupsLayoutInfo.begin(), endIt = lastLineLayoutInfo.mWordGroupsLayoutInfo.end();
+ for( WordLayoutInfoContainer::iterator it = lastLineLayoutInfo.mWordsLayoutInfo.begin(), endIt = lastLineLayoutInfo.mWordsLayoutInfo.end();
it != endIt;
++it )
{
- WordGroupLayoutInfo& layoutInfo( *it );
+ WordLayoutInfo& layoutInfo( *it );
- lastLineLayoutInfo.mNumberOfCharacters += layoutInfo.mNumberOfCharacters;
UpdateSize( lastLineLayoutInfo.mSize, layoutInfo.mSize );
+ lastLineLayoutInfo.mNumberOfCharacters += layoutInfo.mCharactersLayoutInfo.size();
lastLineLayoutInfo.mAscender = std::max( lastLineLayoutInfo.mAscender, layoutInfo.mAscender );
}
lastLineLayoutInfo.mSize.height += lineHeightOffset;
lastLineLayoutInfo.mLineHeightOffset = lineHeightOffset;
- // 5) Remove groups of words added to the last part of the line from the first line.
+ // 5) Remove words added to the last part of the line from the first line.
- // if the number of characters of the last group of words of the first line is zero, it should be removed.
- const std::size_t index = ( 0 == firstWordGroupLayoutInfo.mNumberOfCharacters ? indices.mGroupIndex : indices.mGroupIndex + 1 );
+ // if the number of characters of the last word of the first line is zero, it should be removed.
+ const std::size_t index = ( firstWordLayoutInfo.mCharactersLayoutInfo.empty() ? indices.mWordIndex : indices.mWordIndex + 1u );
- firstLineLayoutInfo.mWordGroupsLayoutInfo.erase( firstLineLayoutInfo.mWordGroupsLayoutInfo.begin() + index, firstLineLayoutInfo.mWordGroupsLayoutInfo.end() );
+ firstLineLayoutInfo.mWordsLayoutInfo.erase( firstLineLayoutInfo.mWordsLayoutInfo.begin() + index, firstLineLayoutInfo.mWordsLayoutInfo.end() );
// 6) update layout info of the first line.
- firstLineLayoutInfo.mNumberOfCharacters = 0;
- firstLineLayoutInfo.mSize = Size();
- firstLineLayoutInfo.mAscender = 0.f;
- for( WordGroupLayoutInfoContainer::iterator it = firstLineLayoutInfo.mWordGroupsLayoutInfo.begin(), endIt = firstLineLayoutInfo.mWordGroupsLayoutInfo.end();
- it != endIt;
- ++it )
- {
- WordGroupLayoutInfo& layoutInfo( *it );
-
- firstLineLayoutInfo.mNumberOfCharacters += layoutInfo.mNumberOfCharacters;
- UpdateSize( firstLineLayoutInfo.mSize, layoutInfo.mSize );
- firstLineLayoutInfo.mAscender = std::max( firstLineLayoutInfo.mAscender, layoutInfo.mAscender );
- }
- firstLineLayoutInfo.mSize.height += lineHeightOffset;
- firstLineLayoutInfo.mLineHeightOffset = lineHeightOffset;
+ UpdateLineLayoutInfo( firstLineLayoutInfo, lineHeightOffset );
}
void MergeLine( LineLayoutInfo& firstLineLineLayoutInfo,
// Early returns.
- if( lastLineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ if( lastLineLayoutInfo.mWordsLayoutInfo.empty() )
{
// Nothing to merge if last line is empty.
return;
}
- if( firstLineLineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ if( firstLineLineLayoutInfo.mWordsLayoutInfo.empty() )
{
// If first line is empty, just copy the last line to the first one.
firstLineLineLayoutInfo = lastLineLayoutInfo;
- return;
+ return;
}
- if( 1 == firstLineLineLayoutInfo.mWordGroupsLayoutInfo.size() )
- {
- WordGroupLayoutInfo& wordGroupLayout( *firstLineLineLayoutInfo.mWordGroupsLayoutInfo.begin() );
-
- if( wordGroupLayout.mWordsLayoutInfo.empty() )
- {
- // If first line is empty, just copy the last line to the first one.
- firstLineLineLayoutInfo = lastLineLayoutInfo;
-
- return;
- }
- }
-
- // Check the last word of the last group of the first line doesn't finish with a new line character.
- WordGroupLayoutInfo& lastWordGroupLayout( *( firstLineLineLayoutInfo.mWordGroupsLayoutInfo.end() - 1 ) );
- WordLayoutInfo& lastWordLayout( *( lastWordGroupLayout.mWordsLayoutInfo.end() - 1 ) );
+ // Check the last word of the first line doesn't finish with a new line character.
+ WordLayoutInfo& lastWordLayout( *( firstLineLineLayoutInfo.mWordsLayoutInfo.end() - 1u ) );
if( LineSeparator == lastWordLayout.mType )
{
DALI_ASSERT_ALWAYS( !"TextViewProcessor::MergeLine(). ERROR: A line can't be merged to another line which finishes with a new line character." );
}
- // If the last group of the first line has the same direction than the first group of the last line, both lines can be concatenated.
- // Otherwise, both groups have to be merged first.
- const WordGroupLayoutInfo& firstWordGroupLayout( *lastLineLayoutInfo.mWordGroupsLayoutInfo.begin() );
+ // If the las word of the first line or the first word of the last line is a white space, both lines can be concatenated.
+ // Otherwise both words need to be merged first.
+ const WordLayoutInfo& firstWordLayout( *lastLineLayoutInfo.mWordsLayoutInfo.begin() );
- std::size_t index = 0;
- if( lastWordGroupLayout.mDirection == firstWordGroupLayout.mDirection )
+ std::size_t index = 0u;
+ if( ( WordSeparator != lastWordLayout.mType ) && ( WordSeparator != firstWordLayout.mType ) && ( LineSeparator != firstWordLayout.mType ) )
{
- // Both groups of words have the same direction. They need to be merged.
- MergeWordGroup( lastWordGroupLayout,
- firstWordGroupLayout );
+ // Last word of the first line is not a word separator and first word of the last line is not a word or line separator.
+ // Words need to be merged.
+
+ MergeWord( lastWordLayout,
+ firstWordLayout );
- // After merging two groups of words, the rest of groups need to be added.
- ++index; // By increasing this index the group of words already merged won't be added again.
+ // After merging two words, the rest of the words need to be added.
+ ++index; // By increasing this index the word already merged won't be added again.
}
// Merge layout info
- firstLineLineLayoutInfo.mWordGroupsLayoutInfo.insert( firstLineLineLayoutInfo.mWordGroupsLayoutInfo.end(),
- lastLineLayoutInfo.mWordGroupsLayoutInfo.begin() + index, lastLineLayoutInfo.mWordGroupsLayoutInfo.end() );
+
+ // Insert the layout of the words.
+ firstLineLineLayoutInfo.mWordsLayoutInfo.insert( firstLineLineLayoutInfo.mWordsLayoutInfo.end(),
+ lastLineLayoutInfo.mWordsLayoutInfo.begin() + index, lastLineLayoutInfo.mWordsLayoutInfo.end() );
+
+ // Update the size and other layout parameters.
UpdateSize( firstLineLineLayoutInfo.mSize, lastLineLayoutInfo.mSize );
firstLineLineLayoutInfo.mAscender = std::max( firstLineLineLayoutInfo.mAscender, lastLineLayoutInfo.mAscender );
firstLineLineLayoutInfo.mLineHeightOffset = std::max( firstLineLineLayoutInfo.mLineHeightOffset, lastLineLayoutInfo.mLineHeightOffset );
firstLineLineLayoutInfo.mNumberOfCharacters += lastLineLayoutInfo.mNumberOfCharacters;
-
}
WordLayoutInfo GetLastWordLayoutInfo( const LineLayoutInfo& lineLayoutInfo )
{
WordLayoutInfo layoutInfo;
- if( !lineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ if( !lineLayoutInfo.mWordsLayoutInfo.empty() )
{
- const WordGroupLayoutInfo& groupInfo( *( lineLayoutInfo.mWordGroupsLayoutInfo.end() - 1 ) );
-
- if( !groupInfo.mWordsLayoutInfo.empty() )
- {
- layoutInfo = *( groupInfo.mWordsLayoutInfo.end() - 1 );
- }
+ layoutInfo = *( lineLayoutInfo.mWordsLayoutInfo.end() - 1u );
}
return layoutInfo;
{
CharacterLayoutInfo layoutInfo;
- if( !lineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ if( !lineLayoutInfo.mWordsLayoutInfo.empty() )
{
- const WordGroupLayoutInfo& groupInfo( *lineLayoutInfo.mWordGroupsLayoutInfo.begin() );
+ const WordLayoutInfo& wordInfo( *lineLayoutInfo.mWordsLayoutInfo.begin() );
- if( !groupInfo.mWordsLayoutInfo.empty() )
- {
- const WordLayoutInfo& wordInfo( *groupInfo.mWordsLayoutInfo.begin() );
-
- layoutInfo = GetFirstCharacterLayoutInfo( wordInfo );
- }
+ layoutInfo = GetFirstCharacterLayoutInfo( wordInfo );
}
return layoutInfo;
{
const LineLayoutInfo& line( *lineIt );
- CollectTextActorsFromGroups( textActors, line, 0, line.mWordGroupsLayoutInfo.size() );
+ CollectTextActorsFromWords( textActors, line, 0u, line.mWordsLayoutInfo.size() );
}
}
* @param[in,out] lineLayoutInfo The line layout info.
* @param[in] lineHeightOffset The line height offset.
*/
-void UpdateLineLayoutInfo( TextViewProcessor::LineLayoutInfo& lineLayoutInfo, float lineHeightOffset );
+void UpdateLineLayoutInfo( LineLayoutInfo& lineLayoutInfo, float lineHeightOffset );
/**
* Creates a data structure with info to layout the line, and data structures with useful info to modify the layout data structure if characters are added or removed.
*/
void CreateLineInfo( const MarkupProcessor::StyledTextArray& line,
TextView::RelayoutData& relayoutData,
- TextViewProcessor::LineLayoutInfo& lineLayoutInfo );
+ LineLayoutInfo& lineLayoutInfo );
/**
- * Removes a given number of groups of words from the given line.
+ * Removes a given number of words from the given line.
*
- * @pre \e groupIndex and \e groupIndex + \e numberOfGroups can't exceed the bounds of the line.
+ * @pre \e wordIndex and \e wordIndex + \e numberOfWords can't exceed the bounds of the line.
*
- * @param[in] groupIndex Index to the group of words within the line with the starting position to be deleted.
- * @param[in] numberOfGroups The number of group of words to be deleted.
+ * @param[in] wordIndex Index to the word within the line with the starting position to be deleted.
+ * @param[in] numberOfWords The number of words to be deleted.
* @param[in] lineHeightOffset Additional space between lines. Needed to update layout info.
- * @param[in,out] lineLayout The input is the layout info of the line. The output is the layout info of the line without the removed group of words.
+ * @param[in,out] lineLayout The input is the layout info of the line. The output is the layout info of the line without the removed words.
*/
-void RemoveWordGroupsFromLine( std::size_t groupIndex,
- std::size_t numberOfGroups,
- const PointSize& lineHeightOffset,
- LineLayoutInfo& lineLayout );
+void RemoveWordsFromLine( std::size_t wordIndex,
+ std::size_t numberOfWords,
+ float lineHeightOffset,
+ LineLayoutInfo& lineLayout );
+
+/**
+ * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
+ * @param[in] numberOfCharacters The number of characters to be deleted.
+ * @param[out] mergeWords Whether words need to be merged after removing characters.
+ * @param[out] mergeLines Whether current line need to be merged with the next one.
+ * @param[in,out] textInfoIndicesBegin Indices to the line, word and characters from where to delete characters. It returns from where words need to be removed.
+ * @param[out] textInfoIndicesEnd If lines or words need to be merged it returns info to delete them (If a word is merged, it has to be removed. Equal for lines).
+ * @param[out] textInfoMergeIndicesBegin The indices to the first part of the line and word to be merged.
+ * @param[out] textInfoMergeIndicesEnd The indices to the last part of the line and word to be merged.
+ * @param[in,out] lineLayout Layout info of the line where the word is located.
+ * @param[out] removedTextActorsFromFirstWord Stores removed text-actors of the word pointed by the 'begin' index.
+ * @param[out] removedTextActorsFromLastWord Stores removed text-actors of the word pointed by the 'end' index.
+ */
+void RemoveCharactersFromLineInfo( TextView::RelayoutData& relayoutData,
+ std::size_t numberOfCharacters,
+ bool& mergeWords,
+ bool& mergeLines,
+ TextInfoIndices& textInfoIndicesBegin,
+ TextInfoIndices& textInfoIndicesEnd,
+ TextInfoIndices& textInfoMergeIndicesBegin,
+ TextInfoIndices& textInfoMergeIndicesEnd,
+ LineLayoutInfo& lineLayout,
+ std::vector<TextActor>& removedTextActorsFromFirstWord,
+ std::vector<TextActor>& removedTextActorsFromLastWord );
/**
* Splits a given line in two.
*
* @note It deletes whatever there is in the last part of the line.
*
- * @param[in] indices Index to the group of words within the line, index to the word and index to the character within the word to split the line.
+ * @param[in] indices Index to the word within the line and index to the character within the word to split the line.
* @param[in] lineHeightOffset Additional space between lines. Needed to update layout info.
- * @param[in,out] firstLineLayoutInfo The input is the layout info of the given line. The output is the first part of the input line (from the group of words \e 0 to the group of words \e groupPosition).
- * @param[in,out] lastLineLayoutInfo Layout info of the last part of the given line ( from the group of words \e groupPosition + \e 1 to the end of the line).
+ * @param[in,out] firstLineLayoutInfo The input is the layout info of the given line. The output is the first part of the input line.
+ * @param[in,out] lastLineLayoutInfo Layout info of the last part of the given line.
*/
void SplitLine( const TextInfoIndices& indices,
const PointSize& lineHeightOffset,
LineLayoutInfo& lastLineLayoutInfo );
/**
- * Merges the two given lines by adding groups of words of the last line to the firs one.
+ * Merges the two given lines by adding words of the last line to the firs one.
*
* @note Does nothing if last part of the line is empty.
* @note If the first part of the line is empty it just copy the last part to it.
- * @note it asserts if the last word of the first group is a line separator (new line character)
+ * @note it asserts if the last word of the first line is a line separator (new line character)
*
* @param[in,out] firstLineLineLayoutInfo The input is the layout info of the first line. The output is the layout info of the merged line.
* @param[in] lastLineLayoutInfo Layout info of the last line.
}
}
-void dbgPrint( const WordGroupLayoutInfo& group )
-{
- std::cout << "( ";
- std::cout << group.mSize;
- std::cout << group.mNumberOfCharacters;
- for( WordLayoutInfoContainer::const_iterator wordIt = group.mWordsLayoutInfo.begin(), endWordIt = group.mWordsLayoutInfo.end();
- wordIt != endWordIt;
- ++wordIt )
- {
- dbgPrint( *wordIt );
- }
- std::cout << " )";
-}
-
void dbgPrint( const LineLayoutInfo& line )
{
std::cout << "< ";
std::cout << line.mSize;
- for( WordGroupLayoutInfoContainer::const_iterator groupIt = line.mWordGroupsLayoutInfo.begin(), endGroupIt = line.mWordGroupsLayoutInfo.end();
- groupIt != endGroupIt;
- ++groupIt )
+ for( WordLayoutInfoContainer::const_iterator wordIt = line.mWordsLayoutInfo.begin(), endWordIt = line.mWordsLayoutInfo.end();
+ wordIt != endWordIt;
+ ++wordIt )
{
- dbgPrint( *groupIt );
+ dbgPrint( *wordIt );
}
std::cout << " >";
std::cout << std::endl;
void dbgPrint( const TextStyle& style )
{
- std::cout << " font name : " << style.GetFontName() << std::endl;
- std::cout << " font style : " << style.GetFontStyle() << std::endl;
- std::cout << " font point size : " << style.GetFontPointSize() << std::endl;
- std::cout << " weight : " << style.GetWeight() << std::endl;
- std::cout << " text color : " << style.GetTextColor() << std::endl;
- std::cout << " italics : " << style.IsItalicsEnabled() << std::endl;
- std::cout << " underline : " << style.IsUnderlineEnabled() << std::endl;
- std::cout << " shadow : " << style.IsShadowEnabled() << std::endl;
- std::cout << " shadow color : " << style.GetShadowColor() << std::endl;
- std::cout << " shadow offset : " << style.GetShadowOffset() << std::endl;
- std::cout << " glow : " << style.IsGlowEnabled() << std::endl;
- std::cout << " italics angle : " << style.GetItalicsAngle() << std::endl;
- std::cout << " glow color : " << style.GetGlowColor() << std::endl;
- std::cout << " glow intensity : " << style.GetGlowIntensity() << std::endl;
- std::cout << " smooth edge : " << style.GetSmoothEdge() << std::endl;
- std::cout << " outline : " << style.IsOutlineEnabled() << std::endl;
- std::cout << " outline color : " << style.GetOutlineColor() << std::endl;
- std::cout << " outline thickness : " << style.GetOutlineThickness() << std::endl;
- std::cout << " gradient : " << style.IsGradientEnabled() << std::endl;
- std::cout << " gradient color : " << style.GetGradientColor() << std::endl;
- std::cout << " gradient start point : " << style.GetGradientStartPoint() << std::endl;
- std::cout << " gradient end point : " << style.GetGradientEndPoint() << std::endl;
+ std::cout << " font name : " << style.GetFontName() << std::endl;
+ std::cout << " font style : " << style.GetFontStyle() << std::endl;
+ std::cout << " font point size : " << style.GetFontPointSize() << std::endl;
+ std::cout << " weight : " << style.GetWeight() << std::endl;
+ std::cout << " text color : " << style.GetTextColor() << std::endl;
+ std::cout << " italics : " << style.IsItalicsEnabled() << std::endl;
+ std::cout << " italics angle : " << style.GetItalicsAngle() << std::endl;
+ std::cout << " underline : " << style.IsUnderlineEnabled() << std::endl;
+ std::cout << " underline thickness : " << style.GetUnderlineThickness() << std::endl;
+ std::cout << " underline position : " << style.GetUnderlinePosition() << std::endl;
+ std::cout << " shadow : " << style.IsShadowEnabled() << std::endl;
+ std::cout << " shadow color : " << style.GetShadowColor() << std::endl;
+ std::cout << " shadow offset : " << style.GetShadowOffset() << std::endl;
+ std::cout << " shadow size : " << style.GetShadowSize() << std::endl;
+ std::cout << " glow : " << style.IsGlowEnabled() << std::endl;
+ std::cout << " glow color : " << style.GetGlowColor() << std::endl;
+ std::cout << " glow intensity : " << style.GetGlowIntensity() << std::endl;
+ std::cout << " smooth edge : " << style.GetSmoothEdge() << std::endl;
+ std::cout << " outline : " << style.IsOutlineEnabled() << std::endl;
+ std::cout << " outline color : " << style.GetOutlineColor() << std::endl;
+ std::cout << " outline thickness : " << style.GetOutlineThickness() << std::endl;
+ std::cout << " gradient : " << style.IsGradientEnabled() << std::endl;
+ std::cout << " gradient color : " << style.GetGradientColor() << std::endl;
+ std::cout << " gradient start point : " << style.GetGradientStartPoint() << std::endl;
+ std::cout << " gradient end point : " << style.GetGradientEndPoint() << std::endl;
+ std::cout << " is font name default : " << style.IsFontNameDefault() << std::endl;
+ std::cout << " is font style default : " << style.IsFontStyleDefault() << std::endl;
+ std::cout << " is font size default : " << style.IsFontSizeDefault() << std::endl;
+ std::cout << " is text color default : " << style.IsTextColorDefault() << std::endl;
+ std::cout << " is font weight default : " << style.IsFontWeightDefault() << std::endl;
+ std::cout << " is smooth edge default : " << style.IsSmoothEdgeDefault() << std::endl;
+ std::cout << " is italics default : " << style.IsItalicsDefault() << std::endl;
+ std::cout << " is underline default : " << style.IsUnderlineDefault() << std::endl;
+ std::cout << " is shadow default : " << style.IsShadowDefault() << std::endl;
+ std::cout << " is glow default : " << style.IsGlowDefault() << std::endl;
+ std::cout << " is outline default : " << style.IsOutlineDefault() << std::endl;
+ std::cout << " is gradient default : " << style.IsGradientDefault() << std::endl;
}
void dbgPrint( const TextInfoIndices& indices )
{
std::cout << " line : " << indices.mLineIndex << std::endl;
- std::cout << " group : " << indices.mGroupIndex << std::endl;
std::cout << " word : " << indices.mWordIndex << std::endl;
std::cout << " char : " << indices.mCharacterIndex << std::endl;
}
#endif
void dbgPrint( const WordLayoutInfo& word );
-void dbgPrint( const WordGroupLayoutInfo& group );
void dbgPrint( const LineLayoutInfo& line );
void dbgPrint( const TextLayoutInfo& textInfo );
void dbgPrint( const TextStyle& style );
const TextLayoutInfo& textLayoutInfo,
TextInfoIndices& indices )
{
- // TODO : Check for mixed LTR and RTL.
-
// clear all indices
indices = TextInfoIndices();
return;
}
- std::size_t currentIndex = 0; // stores how many characters have been traversed.
+ std::size_t currentIndex = 0; // stores how many characters have been traversed (within the whole text).
- // Traverse all lines, groups of words and words until global index is found.
+ // Traverse all lines and words until global index is found.
bool found = false;
for( LineLayoutInfoContainer::const_iterator lineIt = textLayoutInfo.mLinesLayoutInfo.begin(),
lineEndIt = textLayoutInfo.mLinesLayoutInfo.end();
if( currentIndex + lineLayoutInfo.mNumberOfCharacters > index )
{
// The character is in this line
- for( WordGroupLayoutInfoContainer::const_iterator groupIt = lineLayoutInfo.mWordGroupsLayoutInfo.begin(),
- groupEndIt = lineLayoutInfo.mWordGroupsLayoutInfo.end();
- ( !found ) && ( groupIt != groupEndIt );
- ++groupIt, ++indices.mGroupIndex )
+ for( WordLayoutInfoContainer::const_iterator wordIt = lineLayoutInfo.mWordsLayoutInfo.begin(),
+ wordEndIt = lineLayoutInfo.mWordsLayoutInfo.end();
+ ( !found ) && ( wordIt != wordEndIt );
+ ++wordIt, ++indices.mWordIndex )
{
- const WordGroupLayoutInfo& wordGroupLayoutInfo( *groupIt );
+ const WordLayoutInfo& wordLayoutInfo( *wordIt );
- if( currentIndex + wordGroupLayoutInfo.mNumberOfCharacters > index )
+ if( currentIndex + wordLayoutInfo.mCharactersLayoutInfo.size() > index )
{
- // The character is in this group of words.
- for( WordLayoutInfoContainer::const_iterator wordIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- wordEndIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- ( !found ) && ( wordIt != wordEndIt );
- ++wordIt, ++indices.mWordIndex )
- {
- const WordLayoutInfo& wordLayoutInfo( *wordIt );
-
- if( currentIndex + wordLayoutInfo.mCharactersLayoutInfo.size() > index )
- {
- // The character is in this word
- indices.mCharacterIndex = index - currentIndex;
- found = true;
- }
- else
- {
- // check in the next word.
- currentIndex += wordLayoutInfo.mCharactersLayoutInfo.size();
- }
- } // end words.
- if( !wordGroupLayoutInfo.mWordsLayoutInfo.empty() )
- {
- --indices.mWordIndex;
- }
+ // The character is in this word
+ indices.mCharacterIndex = index - currentIndex;
+ found = true;
}
else
{
- // check in the next group of words
- currentIndex += wordGroupLayoutInfo.mNumberOfCharacters;
+ // check in the next word.
+ currentIndex += wordLayoutInfo.mCharactersLayoutInfo.size();
}
- } // end groups of words.
- if( !lineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ } // end words.
+ if( !lineLayoutInfo.mWordsLayoutInfo.empty() )
{
- --indices.mGroupIndex;
+ --indices.mWordIndex;
}
}
else
};
/**
- * Updates the size of a group of characters, word, group of words, line or the whole text with a given size.
+ * Updates the size of a character, word, line or the whole text with a given size.
*
- * For group of characters, words, groups of words and lines the new height will be the maximum of both sizes
+ * For characters, words, and lines the new height will be the maximum of both sizes
* and the new width will be the sum of both.
*
* For the whole text, the new height will be the sum of both and the new width the max of both.
* The \e type parameter speficies which type of update is required.
*
* @param[in,out] size1 The current size to be updated.
- * @param[in] size2 The size of a group of characters, word, group of words or a line.
+ * @param[in] size2 The size of a character, word, or a line.
* @param[in] type Type of update.
*/
void UpdateSize( Size& size1, const Size& size2, SizeGrowType type = GrowWidth );
void ChooseFontFamilyName( MarkupProcessor::StyledText& text );
/**
- * Retrieves the line, word group, word and character indices for the given global character's index.
+ * Retrieves the line, word and character indices for the given global character's index.
*
* i.e. The retrieved indices for the character 18 (j) for the following text would be: 2, 0, 2, 0
*
* m n o p
*
* @param[in] index The global character index.
- * @param[in] textLayoutInfo Contains info about the number of characters per word, group and line.
- * @param[out] indices Index to the line, group of words, word and character within the word where the given character is located.
+ * @param[in] textLayoutInfo Contains info about the number of characters per word, and line.
+ * @param[out] indices Index to the line, word and character within the word where the given character is located.
*/
void GetIndicesFromGlobalCharacterIndex( std::size_t index,
const TextLayoutInfo& textLayoutInfo,
{
/**
- * Whether the direction is Right To Left or Left To Right.
- */
-enum Direction
-{
- LTR, ///< Left To Right direction.
- RTL ///< Right To Left direction.
-};
-
-/**
* Whether the text is a new line character, a white space or normal text.
*/
enum TextSeparatorType
* Constructor.
*/
TextInfoIndices( std::size_t lineIndex,
- std::size_t groupIndex,
std::size_t wordIndex,
std::size_t characterIndex );
bool operator==( const TextInfoIndices& indices ) const;
std::size_t mLineIndex;
- std::size_t mGroupIndex;
std::size_t mWordIndex;
std::size_t mCharacterIndex;
};
typedef std::vector<WordLayoutInfo> WordLayoutInfoContainer;
/**
- * Layout information for a group of words.
- */
-struct WordGroupLayoutInfo
-{
- /**
- * Default constructor.
- *
- * Initializes all members to their default values.
- */
- WordGroupLayoutInfo();
-
- /**
- * Copy constructor.
- */
- WordGroupLayoutInfo( const WordGroupLayoutInfo& group );
-
- /**
- * Assignment operator.
- */
- WordGroupLayoutInfo& operator=( const WordGroupLayoutInfo& group );
-
- Size mSize; ///< Size of the group of words.
- float mAscender; ///< Max of all ascenders of all words.
- Direction mDirection; ///< Whether this group of words is Right To Left or Left To Right.
- WordLayoutInfoContainer mWordsLayoutInfo; ///< Layout info for all words.
- std::size_t mNumberOfCharacters; ///< Stores the number of characters.
-};
-typedef std::vector<WordGroupLayoutInfo> WordGroupLayoutInfoContainer;
-
-/**
* Layout information for a line.
*/
struct LineLayoutInfo
*/
LineLayoutInfo& operator=( const LineLayoutInfo& line );
- Size mSize; ///< Size of the line.
- float mAscender; ///< Max of all ascenders of all groups of words.
- float mLineHeightOffset; ///< Line height offset.
- WordGroupLayoutInfoContainer mWordGroupsLayoutInfo; ///< Layout info for all groups of words.
- std::size_t mNumberOfCharacters; ///< Stores the number of characters.
+ Size mSize; ///< Size of the line.
+ float mAscender; ///< Max of all ascenders of all words.
+ float mLineHeightOffset; ///< Line height offset.
+ WordLayoutInfoContainer mWordsLayoutInfo; ///< Layout info for all words.
+ std::size_t mNumberOfCharacters; ///< Stores the number of characters.
};
typedef std::vector<LineLayoutInfo> LineLayoutInfoContainer;
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
#include <dali-toolkit/internal/controls/text-view/text-view-line-processor.h>
#include <dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h>
#include <dali-toolkit/internal/controls/text-view/text-processor.h>
// Updates number of characters.
textLayoutInfo.mNumberOfCharacters += line.mNumberOfCharacters;
- // Updates the max word's width.
- for( WordGroupLayoutInfoContainer::const_iterator groupIt = line.mWordGroupsLayoutInfo.begin(), groupEndIt = line.mWordGroupsLayoutInfo.end();
- groupIt != groupEndIt;
- ++groupIt )
+ for( WordLayoutInfoContainer::const_iterator wordIt = line.mWordsLayoutInfo.begin(), wordEndIt = line.mWordsLayoutInfo.end();
+ wordIt != wordEndIt;
+ ++wordIt )
{
- const WordGroupLayoutInfo& group( *groupIt );
- for( WordLayoutInfoContainer::const_iterator wordIt = group.mWordsLayoutInfo.begin(), wordEndIt = group.mWordsLayoutInfo.end();
- wordIt != wordEndIt;
- ++wordIt )
- {
- const WordLayoutInfo& word( *wordIt );
+ const WordLayoutInfo& word( *wordIt );
- textLayoutInfo.mMaxWordWidth = std::max( textLayoutInfo.mMaxWordWidth, word.mSize.width );
- }
+ textLayoutInfo.mMaxWordWidth = std::max( textLayoutInfo.mMaxWordWidth, word.mSize.width );
}
}
}
TextInfoIndices::TextInfoIndices()
: mLineIndex( 0 ),
- mGroupIndex( 0 ),
mWordIndex( 0 ),
mCharacterIndex( 0 )
{
}
TextInfoIndices::TextInfoIndices( const std::size_t lineIndex,
- const std::size_t groupIndex,
const std::size_t wordIndex,
const std::size_t characterIndex )
: mLineIndex( lineIndex ),
- mGroupIndex( groupIndex ),
mWordIndex( wordIndex ),
mCharacterIndex( characterIndex )
{
bool TextInfoIndices::operator==( const TextInfoIndices& indices ) const
{
return ( ( mLineIndex == indices.mLineIndex ) &&
- ( mGroupIndex == indices.mGroupIndex ) &&
( mWordIndex == indices.mWordIndex ) &&
( mCharacterIndex == indices.mCharacterIndex ) );
}
const TextView::LayoutParameters& layoutParameters,
TextView::RelayoutData& relayoutData )
{
- // * Traverse the given text spliting it in lines, each line in groups of words and each group of words in words.
- // * If possible, it joins characters with same style in one text-actor.
+ // * Traverse the given text spliting it in lines and each line in words.
// * White spaces and new line characters are alone in one word.
// * Bidirectional text is processed in each line.
- // * A group of words contains text in only one direction (Left to Right or Right to Left but not a mix of both).
// * Generates a layout data structure to store layout information (size, position, ascender, text direction, etc) and metrics of all characters.
// * Generates a text-actor data structure to store text, style and text-actors.
// TODO: finish and test the bidirectional implementation.
// If a line is split, it stores the last part of the line.
LineLayoutInfo lastLineLayoutInfo;
- // Stores indices to the line, group of words, word and character of the given position.
+ // Stores indices to the line, word and character of the given position.
TextInfoIndices textInfoIndices;
if( position < relayoutData.mTextLayoutInfo.mNumberOfCharacters )
{
- // Get line, group, word and character indices for given position.
+ // Get line, word and character indices for given position.
GetIndicesFromGlobalCharacterIndex( position,
relayoutData.mTextLayoutInfo,
textInfoIndices );
textInfoIndices.mLineIndex = relayoutData.mTextLayoutInfo.mLinesLayoutInfo.size() - 1;
const LineLayoutInfo& lineLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1 ) );
- if( !lineLayoutInfo.mWordGroupsLayoutInfo.empty() )
+ if( !lineLayoutInfo.mWordsLayoutInfo.empty() )
{
- textInfoIndices.mGroupIndex = lineLayoutInfo.mWordGroupsLayoutInfo.size() - 1;
- const WordGroupLayoutInfo& groupLayoutInfo( *( lineLayoutInfo.mWordGroupsLayoutInfo.end() - 1 ) );
-
- if( !groupLayoutInfo.mWordsLayoutInfo.empty() )
- {
- textInfoIndices.mWordIndex = groupLayoutInfo.mWordsLayoutInfo.size() - 1;
+ textInfoIndices.mWordIndex = lineLayoutInfo.mWordsLayoutInfo.size() - 1;
- const WordLayoutInfo& wordLayoutInfo( *( groupLayoutInfo.mWordsLayoutInfo.end() - 1 ) );
- textInfoIndices.mCharacterIndex = wordLayoutInfo.mCharactersLayoutInfo.size();
- }
+ const WordLayoutInfo& wordLayoutInfo( *( lineLayoutInfo.mWordsLayoutInfo.end() - 1 ) );
+ textInfoIndices.mCharacterIndex = wordLayoutInfo.mCharactersLayoutInfo.size();
}
}
}
// * It checks if text to be deleted is in the same line or not:
// * If it is not, check which lines need to be split/merged or deleted.
// * If it is but all characters of the line are going to be deleted, just delete the line (nothing needs to be split/merged)
- // * If only some characters of the same line are going to be deleted, proceed similarly: check if text to be deleted is in the same group of words.
- // * If it is not, check which groups of words need to be split/merged or deleted. Two groups of words can't be merged if they contain text with different direction (Left to Right / Right to Left)
- // * If it is but all characters of the group are going to be deleted, delete the group. TODO: Check if previous and following group need to be merged.
- // * If only some characters of the same group of words need to be deleted, proceed similarly: check if text to be deleted is in the same word.
- // * If it is not, split/merge words.
- // * Check if the whole word needs to be deleted.
- // * Check if only some characters of the word need to be deleted.
+ // * If only some characters of the same line are going to be deleted, proceed similarly: check if text to be deleted is in the same word.
+ // * If it is not, split/merge words.
+ // * Check if the whole word needs to be deleted.
+ // * Check if only some characters of the word need to be deleted.
// * Updates layout info.
// * The algorithm checks if a word separator is deleted (in that case, different words need to be merged) and if a new line separator is deleted (two lines need to be merged).
// Early return
- if( 0 == numberOfCharacters )
+ if( 0u == numberOfCharacters )
{
- DALI_ASSERT_DEBUG( !"TextViewProcessor::UpdateTextInfo. WARNING: trying to delete 0 characters!" )
+ DALI_ASSERT_DEBUG( !"TextViewProcessor::UpdateTextInfo. WARNING: trying to delete 0 characters!" );
// nothing to do if no characters are deleted.
return;
relayoutData.mCharacterLogicalToVisualMap.erase( relayoutData.mCharacterLogicalToVisualMap.end() - numberOfCharacters, relayoutData.mCharacterLogicalToVisualMap.end() );
relayoutData.mCharacterVisualToLogicalMap.erase( relayoutData.mCharacterVisualToLogicalMap.end() - numberOfCharacters, relayoutData.mCharacterVisualToLogicalMap.end() );
- // Get line, group of words, word and character indices for the given start position.
+ // Get line, word and character indices for the given start position.
TextInfoIndices textInfoIndicesBegin;
GetIndicesFromGlobalCharacterIndex( position,
relayoutData.mTextLayoutInfo,
textInfoIndicesBegin );
- // Get line, group of words, word and character indices for the given end position (start position + number of characters to be deleted).
+ // Get line, word and character indices for the given end position (start position + number of characters to be deleted).
TextInfoIndices textInfoIndicesEnd;
- GetIndicesFromGlobalCharacterIndex( position + numberOfCharacters - 1,
+ GetIndicesFromGlobalCharacterIndex( position + numberOfCharacters - 1u,
relayoutData.mTextLayoutInfo,
textInfoIndicesEnd );
std::vector<TextActor> removedTextActorsFromMid;
std::vector<TextActor> removedTextActorsFromEnd;
- // Whether lines, group of words and words need to be merged.
+ // Whether lines and words need to be merged.
bool mergeLines = false;
- bool mergeGroups = false;
bool mergeWords = false;
- // Indices of the lines, group of words and words to be merged.
+ // Indices of the lines and words to be merged.
TextInfoIndices textInfoMergeIndicesBegin;
TextInfoIndices textInfoMergeIndicesEnd;
textInfoMergeIndicesBegin.mLineIndex = textInfoIndicesBegin.mLineIndex;
textInfoMergeIndicesEnd.mLineIndex = textInfoIndicesEnd.mLineIndex;
- if( ( textInfoIndicesBegin.mGroupIndex > 0 ) || ( textInfoIndicesBegin.mWordIndex > 0 ) || ( textInfoIndicesBegin.mCharacterIndex > 0 ) )
+ if( ( textInfoIndicesBegin.mWordIndex > 0u ) || ( textInfoIndicesBegin.mCharacterIndex > 0u ) )
{
// first character to be deleted is not the first one of the current line.
++textInfoIndicesBegin.mLineIndex; // won't delete current line
}
// Check if all characters of the last line are going to be deleted.
- bool wholeLinedeleted = false;
+ bool wholeLineDeleted = false;
const LineLayoutInfo& lastLineLayout( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + textInfoIndicesEnd.mLineIndex ) );
- if( textInfoIndicesEnd.mGroupIndex + 1 == lastLineLayout.mWordGroupsLayoutInfo.size() )
+ if( textInfoIndicesEnd.mWordIndex + 1u == lastLineLayout.mWordsLayoutInfo.size() )
{
- const WordGroupLayoutInfo& lastGroupLayout( *( lastLineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesEnd.mGroupIndex ) );
- if( textInfoIndicesEnd.mWordIndex + 1 == lastGroupLayout.mWordsLayoutInfo.size() )
+ const WordLayoutInfo& lastWordLayout( *( lastLineLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
+ if( textInfoIndicesEnd.mCharacterIndex + 1u == lastWordLayout.mCharactersLayoutInfo.size() )
{
- const WordLayoutInfo& lastWordLayout( *( lastGroupLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
- if( textInfoIndicesEnd.mCharacterIndex + 1 == lastWordLayout.mCharactersLayoutInfo.size() )
- {
- // All characters of the last line are going to be deleted.
- ++textInfoIndicesEnd.mLineIndex; // will delete the last line.
+ // All characters of the last line are going to be deleted.
+ ++textInfoIndicesEnd.mLineIndex; // will delete the last line.
- // the whole last line is deleted. Need to check if the next line could be merged.
- mergeLastLine = false;
- wholeLinedeleted = true;
- }
+ // the whole last line is deleted. Need to check if the next line could be merged.
+ mergeLastLine = false;
+ wholeLineDeleted = true;
}
}
- if( wholeLinedeleted )
+ if( wholeLineDeleted )
{
// It means the whole last line is deleted completely.
// It's needed to check if there is another line after that could be merged.
if( textInfoIndicesEnd.mLineIndex < relayoutData.mTextLayoutInfo.mLinesLayoutInfo.size() )
{
- mergeLastLine = true;
+ mergeLastLine = true;
- // Point the first characters of the next line.
- textInfoIndicesEnd.mGroupIndex = 0;
- textInfoIndicesEnd.mWordIndex = 0;
- textInfoIndicesEnd.mCharacterIndex = 0;
- textInfoMergeIndicesEnd.mLineIndex = textInfoIndicesEnd.mLineIndex;
+ // Point the first characters of the next line.
+ textInfoIndicesEnd.mWordIndex = 0u;
+ textInfoIndicesEnd.mCharacterIndex = 0u;
+ textInfoMergeIndicesEnd.mLineIndex = textInfoIndicesEnd.mLineIndex;
}
}
// Three vectors are needed because text-actors are not removed in order
// but insert them in order is required to reuse them later.
std::vector<TextActor> removedTextActorsFromFirstWord;
- std::vector<TextActor> removedTextActorsFromFirstGroup;
- std::vector<TextActor> removedTextActorsFromGroups;
+ std::vector<TextActor> removedTextActorsFromFirstLine;
// As lineIndexBegin has been increased just to not to remove the line, decrease now is needed to access it.
- LineLayoutInfo& lineLayout( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + textInfoIndicesBegin.mLineIndex - 1 ) );
-
- if( textInfoIndicesBegin.mGroupIndex + 1 < lineLayout.mWordGroupsLayoutInfo.size() )
- {
- // Store text-actors before removing them.
- CollectTextActorsFromGroups( removedTextActorsFromGroups, lineLayout, textInfoIndicesBegin.mGroupIndex + 1, lineLayout.mWordGroupsLayoutInfo.size() );
-
- // Remove extra groups. If a line has left to right and right to left text, groups after current one could be removed.
- RemoveWordGroupsFromLine( textInfoIndicesBegin.mGroupIndex + 1,
- lineLayout.mWordGroupsLayoutInfo.size() - ( textInfoIndicesBegin.mGroupIndex + 1 ),
- PointSize( layoutParameters.mLineHeightOffset ),
- lineLayout );
- }
+ LineLayoutInfo& lineLayout( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + textInfoIndicesBegin.mLineIndex - 1u ) );
- WordGroupLayoutInfo& groupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesBegin.mGroupIndex ) );
-
- if( ( textInfoIndicesBegin.mWordIndex + 1 < groupLayout.mWordsLayoutInfo.size() ) || ( 0 == textInfoIndicesBegin.mCharacterIndex ) )
+ if( ( textInfoIndicesBegin.mWordIndex + 1u < lineLayout.mWordsLayoutInfo.size() ) || ( 0u == textInfoIndicesBegin.mCharacterIndex ) )
{
- // Remove extra words within current group of words. (and current word if whole characters are removed)
+ // Remove extra words within current line. (and current word if whole characters are removed)
// 0 == characterIndexBegin means the whole word is deleted.
- const std::size_t wordIndex = ( ( 0 == textInfoIndicesBegin.mCharacterIndex ) ? textInfoIndicesBegin.mWordIndex : textInfoIndicesBegin.mWordIndex + 1 );
+ const std::size_t wordIndex = ( ( 0u == textInfoIndicesBegin.mCharacterIndex ) ? textInfoIndicesBegin.mWordIndex : textInfoIndicesBegin.mWordIndex + 1u );
// Store text-actors before removing them.
- CollectTextActorsFromWords( removedTextActorsFromFirstGroup, groupLayout, wordIndex, groupLayout.mWordsLayoutInfo.size() );
-
- const std::size_t groupNumberCharacters = groupLayout.mNumberOfCharacters;
- RemoveWordsFromWordGroup( wordIndex,
- groupLayout.mWordsLayoutInfo.size() - wordIndex,
- groupLayout );
+ CollectTextActorsFromWords( removedTextActorsFromFirstLine, lineLayout, wordIndex, lineLayout.mWordsLayoutInfo.size() );
- // discount the removed number of characters.
- lineLayout.mNumberOfCharacters -= ( groupNumberCharacters - groupLayout.mNumberOfCharacters );
+ RemoveWordsFromLine( wordIndex,
+ lineLayout.mWordsLayoutInfo.size() - wordIndex,
+ layoutParameters.mLineHeightOffset,
+ lineLayout );
}
- if( ( textInfoIndicesBegin.mWordIndex < groupLayout.mWordsLayoutInfo.size() ) && ( textInfoIndicesBegin.mCharacterIndex > 0 ) )
+ if( ( textInfoIndicesBegin.mWordIndex < lineLayout.mWordsLayoutInfo.size() ) && ( textInfoIndicesBegin.mCharacterIndex > 0u ) )
{
// Only some characters of the word need to be removed.
- WordLayoutInfo& wordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex ) );
+ WordLayoutInfo& wordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex ) );
// Store text-actors before removing them.
CollectTextActors( removedTextActorsFromFirstWord, wordLayout, textInfoIndicesBegin.mCharacterIndex, wordLayout.mCharactersLayoutInfo.size() );
// discount the removed number of characters.
const std::size_t removedNumberOfCharacters = ( wordNumberCharacters - wordLayout.mCharactersLayoutInfo.size() );
- groupLayout.mNumberOfCharacters -= removedNumberOfCharacters;
lineLayout.mNumberOfCharacters -= removedNumberOfCharacters;
}
UpdateLineLayoutInfo( lineLayout, layoutParameters.mLineHeightOffset );
// Insert the text-actors in order.
removedTextActorsFromBegin.insert( removedTextActorsFromBegin.end(), removedTextActorsFromFirstWord.begin(), removedTextActorsFromFirstWord.end() );
- removedTextActorsFromBegin.insert( removedTextActorsFromBegin.end(), removedTextActorsFromFirstGroup.begin(), removedTextActorsFromFirstGroup.end() );
- removedTextActorsFromBegin.insert( removedTextActorsFromBegin.end(), removedTextActorsFromGroups.begin(), removedTextActorsFromGroups.end() );
+ removedTextActorsFromBegin.insert( removedTextActorsFromBegin.end(), removedTextActorsFromFirstLine.begin(), removedTextActorsFromFirstLine.end() );
}
- if( mergeLastLine && !wholeLinedeleted )
+ if( mergeLastLine && !wholeLineDeleted )
{
// Some characters from the last line need to be removed.
- // Vectors used to temporary store text-actors removed from the group.
+ // Vectors used to temporary store text-actors removed from the line.
// Three vectors are needed because text-actors are not removed in order
// but insert them in order is required to reuse them later.
std::vector<TextActor> removedTextActorsFromFirstWord;
- std::vector<TextActor> removedTextActorsFromFirstGroup;
- std::vector<TextActor> removedTextActorsFromGroups;
+ std::vector<TextActor> removedTextActorsFromFirstLine;
// lineIndexEnd was increased to delete the last line if lines need to be merged.
// To access now the last line we need to decrease the index.
- const std::size_t lineIndex = ( mergeLines ? textInfoIndicesEnd.mLineIndex - 1 : textInfoIndicesEnd.mLineIndex );
+ const std::size_t lineIndex = ( mergeLines ? textInfoIndicesEnd.mLineIndex - 1u : textInfoIndicesEnd.mLineIndex );
// Get the last line.
LineLayoutInfo& lineLayout( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + lineIndex ) );
- if( textInfoIndicesEnd.mGroupIndex > 0 )
- {
- // Store text-actors before removing them.
- CollectTextActorsFromGroups( removedTextActorsFromGroups, lineLayout, 0, textInfoIndicesEnd.mGroupIndex );
-
- // Remove extra groups from the beginning of the line to the current group of words.
- RemoveWordGroupsFromLine( 0,
- textInfoIndicesEnd.mGroupIndex,
- PointSize( layoutParameters.mLineHeightOffset ),
- lineLayout );
- }
-
- // The group of characters which contains the characters to be removed is now the first one.
- WordGroupLayoutInfo& groupLayout( *lineLayout.mWordGroupsLayoutInfo.begin() );
-
// Check if is needed remove the whole word. (If the character index is pointing just after the end of the word)
- const WordLayoutInfo& wordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
- bool removeWholeWord = wordLayout.mCharactersLayoutInfo.size() == textInfoIndicesEnd.mCharacterIndex + 1;
+ const WordLayoutInfo& wordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
+ bool removeWholeWord = wordLayout.mCharactersLayoutInfo.size() == textInfoIndicesEnd.mCharacterIndex + 1u;
- if( ( textInfoIndicesEnd.mWordIndex > 0 ) || ( removeWholeWord ) )
+ if( ( textInfoIndicesEnd.mWordIndex > 0u ) || ( removeWholeWord ) )
{
// Store text-actors before removing them.
- CollectTextActorsFromWords( removedTextActorsFromFirstGroup, groupLayout, 0, ( removeWholeWord ) ? textInfoIndicesEnd.mWordIndex + 1 : textInfoIndicesEnd.mWordIndex );
+ CollectTextActorsFromWords( removedTextActorsFromFirstLine,
+ lineLayout,
+ 0u,
+ ( removeWholeWord ) ? textInfoIndicesEnd.mWordIndex + 1u : textInfoIndicesEnd.mWordIndex );
// Remove extra words. (and current word if whole characters are removed)
- const std::size_t groupNumberCharacters = groupLayout.mNumberOfCharacters;
- RemoveWordsFromWordGroup( 0,
- ( removeWholeWord ) ? textInfoIndicesEnd.mWordIndex + 1 : textInfoIndicesEnd.mWordIndex,
- groupLayout );
-
- // discount the removed number of characters.
- lineLayout.mNumberOfCharacters -= ( groupNumberCharacters - groupLayout.mNumberOfCharacters );
+ RemoveWordsFromLine( 0u,
+ ( removeWholeWord ) ? textInfoIndicesEnd.mWordIndex + 1u : textInfoIndicesEnd.mWordIndex,
+ layoutParameters.mLineHeightOffset,
+ lineLayout );
}
if( !removeWholeWord )
// Only some characters of the word need to be deleted.
// After removing all extra words. The word with the characters to be removed is the first one.
- WordLayoutInfo& wordLayout( *groupLayout.mWordsLayoutInfo.begin() );
+ WordLayoutInfo& wordLayout( *lineLayout.mWordsLayoutInfo.begin() );
// Store text-actors before removing them.
- CollectTextActors( removedTextActorsFromFirstWord, wordLayout, 0, textInfoIndicesEnd.mCharacterIndex + 1 );
+ CollectTextActors( removedTextActorsFromFirstWord, wordLayout, 0u, textInfoIndicesEnd.mCharacterIndex + 1u );
const std::size_t wordNumberCharacters = wordLayout.mCharactersLayoutInfo.size();
- RemoveCharactersFromWord( 0,
- textInfoIndicesEnd.mCharacterIndex + 1,
+ RemoveCharactersFromWord( 0u,
+ textInfoIndicesEnd.mCharacterIndex + 1u,
wordLayout );
// discount the removed number of characters.
const std::size_t removedNumberOfCharacters = ( wordNumberCharacters - wordLayout.mCharactersLayoutInfo.size() );
- groupLayout.mNumberOfCharacters -= removedNumberOfCharacters;
lineLayout.mNumberOfCharacters -= removedNumberOfCharacters;
- UpdateGroupLayoutInfo( groupLayout );
}
UpdateLineLayoutInfo( lineLayout, layoutParameters.mLineHeightOffset );
// Insert the text-actors in order.
removedTextActorsFromEnd.insert( removedTextActorsFromEnd.end(), removedTextActorsFromFirstWord.begin(), removedTextActorsFromFirstWord.end() );
- removedTextActorsFromEnd.insert( removedTextActorsFromEnd.end(), removedTextActorsFromFirstGroup.begin(), removedTextActorsFromFirstGroup.end() );
- removedTextActorsFromEnd.insert( removedTextActorsFromEnd.end(), removedTextActorsFromGroups.begin(), removedTextActorsFromGroups.end() );
+ removedTextActorsFromEnd.insert( removedTextActorsFromEnd.end(), removedTextActorsFromFirstLine.begin(), removedTextActorsFromFirstLine.end() );
}
} // end delete text from different lines
else if( ( textInfoIndicesBegin.mLineIndex == textInfoIndicesEnd.mLineIndex ) && ( lineLayout.mNumberOfCharacters == numberOfCharacters ) )
// Line which contains the characters to be deleted.
LineLayoutInfo& lineLayout( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.begin() + textInfoIndicesBegin.mLineIndex ) );
- const WordGroupLayoutInfo& groupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesBegin.mGroupIndex ) ); // used to check the number of characters of the group of words
- // if all characters to be deleted are in the same group of words.
- if( textInfoIndicesBegin.mGroupIndex < textInfoIndicesEnd.mGroupIndex )
+ // Remove the characters from the line layout info. It returns whether the current line can be merged with the next one.
+ RemoveCharactersFromLineInfo( relayoutData,
+ numberOfCharacters,
+ mergeWords,
+ mergeLines,
+ textInfoIndicesBegin,
+ textInfoIndicesEnd,
+ textInfoMergeIndicesBegin,
+ textInfoMergeIndicesEnd,
+ lineLayout,
+ removedTextActorsFromBegin,
+ removedTextActorsFromEnd );
+
+ if( mergeWords )
{
- // Deleted text is from different group of words. The two different group of words may be merged if they have text with same direction.
-
- // whether first or last group of words need to be split and merged with the last part.
- bool splitFirstGroup = false;
- bool splitLastGroup = true;
-
- textInfoMergeIndicesBegin.mGroupIndex = textInfoIndicesBegin.mGroupIndex;
- textInfoMergeIndicesEnd.mGroupIndex = textInfoIndicesEnd.mGroupIndex;
-
- if( ( textInfoIndicesBegin.mWordIndex > 0 ) || ( textInfoIndicesBegin.mCharacterIndex > 0 ) )
- {
- // first character to be deleted is not the first one of the current group.
- ++textInfoIndicesBegin.mGroupIndex; // won't delete current group
-
- // As some characters remain, this group needs to be split and could be merged with the last one.
- splitFirstGroup = true;
- }
-
- // Check if all characters of the last group are going to be deleted.
- const WordGroupLayoutInfo& lastGroupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesEnd.mGroupIndex ) );
- if( textInfoIndicesEnd.mWordIndex + 1 == lastGroupLayout.mWordsLayoutInfo.size() )
- {
- const WordLayoutInfo& lastWordLayout( *( lastGroupLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
- if( textInfoIndicesEnd.mCharacterIndex + 1 == lastWordLayout.mCharactersLayoutInfo.size() )
- {
- // All characters of the last group are going to be deleted.
- ++textInfoIndicesEnd.mGroupIndex; // will delete the last group.
-
- // The whole last group is deleted. No need to merge groups.
- splitLastGroup = false;
- }
- }
-
- // Only merge two groups if they are not deleted completely and they have same direction.
- mergeGroups = ( splitFirstGroup && splitLastGroup ) && ( groupLayout.mDirection == lastGroupLayout.mDirection );
-
- if( mergeGroups )
- {
- // last group is going to be merged.
- ++textInfoIndicesEnd.mGroupIndex; // will delete the last group.
- }
-
- if( splitFirstGroup )
- {
- // Remove characters from the first group.
-
- // As wordGroupIndexBegin has been increased just to not to remove the group of words, decrease now is needed to access it.
- WordGroupLayoutInfo& groupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesBegin.mGroupIndex - 1 ) );
-
- if( ( textInfoIndicesBegin.mWordIndex + 1 < groupLayout.mWordsLayoutInfo.size() ) || ( 0 == textInfoIndicesBegin.mCharacterIndex ) )
- {
- // Remove extra words within current group of words. (and current word if whole characters are removed)
- // 0 == characterIndexBegin means the whole word is deleted.
- const std::size_t wordIndex = ( ( 0 == textInfoIndicesBegin.mCharacterIndex ) ? textInfoIndicesBegin.mWordIndex : textInfoIndicesBegin.mWordIndex + 1 );
-
- // Store text-actors before removing them.
- CollectTextActorsFromWords( removedTextActorsFromBegin, groupLayout, wordIndex, groupLayout.mWordsLayoutInfo.size() );
-
- RemoveWordsFromWordGroup( wordIndex,
- groupLayout.mWordsLayoutInfo.size() - wordIndex,
- groupLayout );
- }
+ // Merges words pointed by textInfoMergeIndicesBegin.mWordIndex and textInfoMergeIndicesEnd.mWordIndex calculated previously.
+ DALI_ASSERT_DEBUG( ( textInfoMergeIndicesBegin.mWordIndex < lineLayout.mWordsLayoutInfo.size() ) && "TextViewProcessor::UpdateTextInfo (delete). Word index (begin) out of bounds." );
+ DALI_ASSERT_DEBUG( ( textInfoMergeIndicesEnd.mWordIndex < lineLayout.mWordsLayoutInfo.size() ) && "TextViewProcessor::UpdateTextInfo (delete). Word index (end) out of bounds." );
- if( ( textInfoIndicesBegin.mWordIndex < groupLayout.mWordsLayoutInfo.size() ) && ( textInfoIndicesBegin.mCharacterIndex > 0 ) )
- {
- // Only some characters of the word need to be removed.
- WordLayoutInfo& wordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex ) );
-
- // Store text-actors before removing them.
- CollectTextActors( removedTextActorsFromBegin, wordLayout, textInfoIndicesBegin.mCharacterIndex, wordLayout.mCharactersLayoutInfo.size() );
-
- RemoveCharactersFromWord( textInfoIndicesBegin.mCharacterIndex,
- wordLayout.mCharactersLayoutInfo.size() - textInfoIndicesBegin.mCharacterIndex,
- wordLayout );
- }
- }
-
- if( splitLastGroup )
- {
- // Some characters from the last group of words need to be removed.
-
- // textInfoIndicesEnd.mGroupIndex was increased to delete the last group of words if groups need to be merged.
- // To access now the last group of words we need to decrease the index.
- std::size_t index = mergeGroups ? textInfoIndicesEnd.mGroupIndex - 1 : textInfoIndicesEnd.mGroupIndex;
-
- // Get the last group of words.
- WordGroupLayoutInfo& groupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + index ) );
-
- // Check if is needed remove the whole word. (If the character index is pointing just after the end of the word)
- const WordLayoutInfo& wordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
- bool removeWholeWord = wordLayout.mCharactersLayoutInfo.size() == textInfoIndicesEnd.mCharacterIndex + 1;
-
- if( ( textInfoIndicesEnd.mWordIndex > 0 ) || ( removeWholeWord ) )
- {
- // Store text-actors before removing them.
- CollectTextActorsFromWords( removedTextActorsFromBegin, groupLayout, 0, ( removeWholeWord ) ? textInfoIndicesEnd.mWordIndex + 1 : textInfoIndicesEnd.mWordIndex );
-
- // Remove extra words. (and current word if whole characters are removed)
- RemoveWordsFromWordGroup( 0,
- ( removeWholeWord ) ? textInfoIndicesEnd.mWordIndex + 1 : textInfoIndicesEnd.mWordIndex,
- groupLayout );
- }
-
- if( !removeWholeWord )
- {
- // Only some characters of the word need to be deleted.
+ WordLayoutInfo& firstWordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoMergeIndicesBegin.mWordIndex ) );
+ WordLayoutInfo& lastWordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoMergeIndicesEnd.mWordIndex ) );
- // After removing all extra words. The word with the characters to be removed is the first one.
- WordLayoutInfo& wordLayout( *groupLayout.mWordsLayoutInfo.begin() );
-
- // Store text-actors before removing them.
- CollectTextActors( removedTextActorsFromBegin, wordLayout, 0, textInfoIndicesEnd.mCharacterIndex + 1 );
-
- RemoveCharactersFromWord( 0,
- textInfoIndicesEnd.mCharacterIndex + 1,
- wordLayout );
- }
- }
- } // end of remove from different groups
- else if( ( textInfoIndicesBegin.mGroupIndex == textInfoIndicesEnd.mGroupIndex ) && ( groupLayout.mNumberOfCharacters == numberOfCharacters ) )
- {
- // The whole group is deleted.
- ++textInfoIndicesEnd.mGroupIndex; // will delete current group.
- // TODO group before and group after need to be merged!!!
+ MergeWord( firstWordLayout,
+ lastWordLayout );
}
- else
- {
- // characters to be deleted are on the same group of words. (words may need to be merged)
-
- // Group of words which contains the characters to be deleted.
- WordGroupLayoutInfo& groupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesBegin.mGroupIndex ) );
-
- RemoveCharactersFromWordGroupInfo( relayoutData,
- numberOfCharacters,
- mergeWords,
- mergeLines,
- textInfoIndicesBegin,
- textInfoIndicesEnd,
- textInfoMergeIndicesBegin,
- textInfoMergeIndicesEnd,
- groupLayout,
- removedTextActorsFromBegin,
- removedTextActorsFromEnd );
-
- if( mergeWords )
- {
- // Merges words pointed by textInfoMergeIndicesBegin.mWordIndex and textInfoMergeIndicesEnd.mWordIndex calculated previously.
- DALI_ASSERT_DEBUG( ( textInfoMergeIndicesBegin.mWordIndex < groupLayout.mWordsLayoutInfo.size() ) && "TextViewProcessor::UpdateTextInfo (delete). Word index (begin) out of bounds." );
- DALI_ASSERT_DEBUG( ( textInfoMergeIndicesEnd.mWordIndex < groupLayout.mWordsLayoutInfo.size() ) && "TextViewProcessor::UpdateTextInfo (delete). Word index (end) out of bounds." );
-
- WordLayoutInfo& firstWordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoMergeIndicesBegin.mWordIndex ) );
- WordLayoutInfo& lastWordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoMergeIndicesEnd.mWordIndex ) );
-
- MergeWord( firstWordLayout,
- lastWordLayout );
- }
-
- // Store text-actors before removing them.
- const std::size_t endIndex = ( mergeWords && ( textInfoIndicesEnd.mWordIndex > 0 ) ) ? textInfoIndicesEnd.mWordIndex - 1 : textInfoIndicesEnd.mWordIndex; // text-actors from the last word may have been added in the merge above.
- CollectTextActorsFromWords( removedTextActorsFromMid, groupLayout, textInfoIndicesBegin.mWordIndex, endIndex );
-
- // Remove unwanted words using previously calculated indices. (including the last part of the merged word)
- groupLayout.mWordsLayoutInfo.erase( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex, groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex );
-
- // Update group of words info
- groupLayout.mNumberOfCharacters -= numberOfCharacters;
- groupLayout.mSize = Size();
- groupLayout.mAscender = 0;
- for( WordLayoutInfoContainer::const_iterator it = groupLayout.mWordsLayoutInfo.begin(), endIt = groupLayout.mWordsLayoutInfo.end();
- it != endIt;
- ++it )
- {
- const WordLayoutInfo& layoutInfo( *it );
- UpdateSize( groupLayout.mSize, layoutInfo.mSize );
- groupLayout.mAscender = std::max( groupLayout.mAscender, layoutInfo.mAscender );
- }
- } // end of remove from same group
- if( mergeGroups )
- {
- // Merges group of words pointed by textInfoMergeIndicesBegin.mGroupIndex and textInfoMergeIndicesEnd.mGroupIndex calculated previously.
-
- WordGroupLayoutInfo& firstGroupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoMergeIndicesBegin.mGroupIndex ) );
-
- const WordGroupLayoutInfo& lastGroupLayout( *( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoMergeIndicesEnd.mGroupIndex ) );
-
- MergeWordGroup( firstGroupLayout,
- lastGroupLayout );
- }
+ // Store text-actors before removing them.
+ const std::size_t endIndex = ( mergeWords && ( textInfoIndicesEnd.mWordIndex > 0u ) ) ? textInfoIndicesEnd.mWordIndex - 1u : textInfoIndicesEnd.mWordIndex; // text-actors from the last word may have been added in the merge above.
+ CollectTextActorsFromWords( removedTextActorsFromMid, lineLayout, textInfoIndicesBegin.mWordIndex, endIndex );
- // Remove unwanted groups of words using previously calculated indices. (including the last part of the merged group of words)
- lineLayout.mWordGroupsLayoutInfo.erase( lineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesBegin.mGroupIndex, lineLayout.mWordGroupsLayoutInfo.begin() + textInfoIndicesEnd.mGroupIndex );
+ // Remove unwanted words using previously calculated indices. (including the last part of the merged word)
+ lineLayout.mWordsLayoutInfo.erase( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex, lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex );
// Update line info.
- lineLayout.mNumberOfCharacters -= numberOfCharacters;
- lineLayout.mSize = Size();
- lineLayout.mAscender = 0;
- for( WordGroupLayoutInfoContainer::const_iterator it = lineLayout.mWordGroupsLayoutInfo.begin(), endIt = lineLayout.mWordGroupsLayoutInfo.end();
- it != endIt;
- ++it )
- {
- const WordGroupLayoutInfo& layoutInfo( *it );
- UpdateSize( lineLayout.mSize, layoutInfo.mSize );
- lineLayout.mAscender = std::max( lineLayout.mAscender, layoutInfo.mAscender );
- }
- lineLayout.mSize.height += layoutParameters.mLineHeightOffset;
- lineLayout.mLineHeightOffset = layoutParameters.mLineHeightOffset;
+ UpdateLineLayoutInfo( lineLayout, layoutParameters.mLineHeightOffset );
}// end delete text from same line.
if( mergeLines )
}
// Store text-actors before removing them.
- const std::size_t endIndex = ( mergeLines && ( textInfoIndicesEnd.mLineIndex > 0 ) ) ? textInfoIndicesEnd.mLineIndex - 1 : textInfoIndicesEnd.mLineIndex; // text-actors from the last line may have been added in the merge above.
+ const std::size_t endIndex = ( mergeLines && ( textInfoIndicesEnd.mLineIndex > 0u ) ) ? textInfoIndicesEnd.mLineIndex - 1u : textInfoIndicesEnd.mLineIndex; // text-actors from the last line may have been added in the merge above.
CollectTextActorsFromLines( removedTextActorsFromMid,
relayoutData.mTextLayoutInfo,
textInfoIndicesBegin.mLineIndex,
// If the last character of the last line is a new line character, an empty line need to be added.
if( !relayoutData.mTextLayoutInfo.mLinesLayoutInfo.empty() )
{
- const WordLayoutInfo lastWordLayout = GetLastWordLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1 ) );
+ const WordLayoutInfo lastWordLayout = GetLastWordLayoutInfo( *( relayoutData.mTextLayoutInfo.mLinesLayoutInfo.end() - 1u ) );
if( LineSeparator == lastWordLayout.mType )
{
{
LineLayoutInfo& line( *lineIt );
- for( WordGroupLayoutInfoContainer::iterator groupIt = line.mWordGroupsLayoutInfo.begin(), groupEndIt = line.mWordGroupsLayoutInfo.end();
- groupIt != groupEndIt;
- ++groupIt )
+ for( WordLayoutInfoContainer::iterator wordIt = line.mWordsLayoutInfo.begin(), wordEndIt = line.mWordsLayoutInfo.end();
+ wordIt != wordEndIt;
+ ++wordIt )
{
- WordGroupLayoutInfo& group( *groupIt );
+ WordLayoutInfo& word( *wordIt );
- for( WordLayoutInfoContainer::iterator wordIt = group.mWordsLayoutInfo.begin(), wordEndIt = group.mWordsLayoutInfo.end();
- wordIt != wordEndIt;
- ++wordIt )
+ for( CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
+ characterIt != characterEndIt;
+ ++characterIt )
{
- WordLayoutInfo& word( *wordIt );
-
- for( CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
- characterIt != characterEndIt;
- ++characterIt )
- {
- CharacterLayoutInfo& characterLayout( *characterIt );
+ CharacterLayoutInfo& characterLayout( *characterIt );
- characterLayout.mStyledText.mStyle.Copy( style, mask );
+ characterLayout.mStyledText.mStyle.Copy( style, mask );
- // Checks if the font family supports all glyphs. If not, chooses a most suitable one.
- ChooseFontFamilyName( characterLayout.mStyledText );
+ // Checks if the font family supports all glyphs. If not, chooses a most suitable one.
+ ChooseFontFamilyName( characterLayout.mStyledText );
- // Mark the character to be set the new style into the text-actor.
- characterLayout.mSetStyle = true;
- } // end characters
- } // end words
- } // end group of words
+ // Mark the character to be set the new style into the text-actor.
+ characterLayout.mSetStyle = true;
+ } // end characters
+ } // end words
} // end lines
}
{
LineLayoutInfo& line( *lineIt );
- for( WordGroupLayoutInfoContainer::iterator groupIt = line.mWordGroupsLayoutInfo.begin(), groupEndIt = line.mWordGroupsLayoutInfo.end();
- groupIt != groupEndIt;
- ++groupIt )
+ for( WordLayoutInfoContainer::iterator wordIt = line.mWordsLayoutInfo.begin(), wordEndIt = line.mWordsLayoutInfo.end();
+ wordIt != wordEndIt;
+ ++wordIt )
{
- WordGroupLayoutInfo& group( *groupIt );
+ WordLayoutInfo& word( *wordIt );
- for( WordLayoutInfoContainer::iterator wordIt = group.mWordsLayoutInfo.begin(), wordEndIt = group.mWordsLayoutInfo.end();
- wordIt != wordEndIt;
- ++wordIt )
+ for( CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
+ characterIt != characterEndIt;
+ ++characterIt )
{
- WordLayoutInfo& word( *wordIt );
-
- for( CharacterLayoutInfoContainer::iterator characterIt = word.mCharactersLayoutInfo.begin(), characterEndIt = word.mCharactersLayoutInfo.end();
- characterIt != characterEndIt;
- ++characterIt )
- {
- CharacterLayoutInfo& characterLayout( *characterIt );
+ CharacterLayoutInfo& characterLayout( *characterIt );
- // Check if there is a new line.
- const bool newLine = !lineLayoutEnd && ( characterGlobalIndex == relayoutData.mLines[lineLayoutInfoIndex].mCharacterGlobalIndex );
+ // Check if there is a new line.
+ const bool newLine = !lineLayoutEnd && ( characterGlobalIndex == relayoutData.mLines[lineLayoutInfoIndex].mCharacterGlobalIndex );
- if( newLine )
+ if( newLine )
+ {
+ // Point to the next line.
+ ++lineLayoutInfoIndex;
+ if( lineLayoutInfoIndex >= lineLayoutInfoSize )
{
- // Point to the next line.
- ++lineLayoutInfoIndex;
- if( lineLayoutInfoIndex >= lineLayoutInfoSize )
- {
- // Arrived at last line.
- lineLayoutEnd = true; // Avoids access out of bounds in the relayoutData.mLines vector.
- }
- glyphActorCreatedForLine = false;
+ // Arrived at last line.
+ lineLayoutEnd = true; // Avoids access out of bounds in the relayoutData.mLines vector.
}
+ glyphActorCreatedForLine = false;
+ }
- if( !characterLayout.mStyledText.mText.IsEmpty() )
+ if( !characterLayout.mStyledText.mText.IsEmpty() )
+ {
+ // Do not create a glyph-actor if there is no text.
+ const Character character = characterLayout.mStyledText.mText[0]; // there are only one character per character layout.
+
+ if( characterLayout.mIsColorGlyph ||
+ !character.IsWhiteSpace() || // A new line character is also a white space.
+ ( character.IsWhiteSpace() && characterLayout.mStyledText.mStyle.IsUnderlineEnabled() ) )
{
- // Do not create a glyph-actor if there is no text.
- const Character character = characterLayout.mStyledText.mText[0]; // there are only one character per character layout.
+ // Do not create a glyph-actor if it's a white space (without underline) or a new line character.
+
+ // Creates one glyph-actor per each counsecutive group of characters, with the same style, per line, or if it's an emoticon.
- if( characterLayout.mIsColorGlyph ||
- !character.IsWhiteSpace() || // A new line character is also a white space.
- ( character.IsWhiteSpace() && characterLayout.mStyledText.mStyle.IsUnderlineEnabled() ) )
+ if( !glyphActorCreatedForLine ||
+ characterLayout.mIsColorGlyph ||
+ ( characterLayout.mStyledText.mStyle != currentStyle ) ||
+ ( characterLayout.mGradientColor != currentGradientColor ) ||
+ ( characterLayout.mStartPoint != currentStartPoint ) ||
+ ( characterLayout.mEndPoint != currentEndPoint ) ||
+ ( characterLayout.mIsColorGlyph != currentIsColorGlyph ) )
{
- // Do not create a glyph-actor if it's a white space (without underline) or a new line character.
+ characterLayout.mSetText = false;
+ characterLayout.mSetStyle = false;
- // Creates one glyph-actor per each counsecutive group of characters, with the same style, per line, or if it's an emoticon.
+ // There is a new style or a new line.
+ glyphActorCreatedForLine = true;
- if( !glyphActorCreatedForLine ||
- characterLayout.mIsColorGlyph ||
- ( characterLayout.mStyledText.mStyle != currentStyle ) ||
- ( characterLayout.mGradientColor != currentGradientColor ) ||
- ( characterLayout.mStartPoint != currentStartPoint ) ||
- ( characterLayout.mEndPoint != currentEndPoint ) ||
- ( characterLayout.mIsColorGlyph != currentIsColorGlyph ) )
+ if( characterLayout.mIsColorGlyph )
{
- characterLayout.mSetText = false;
- characterLayout.mSetStyle = false;
-
- // There is a new style or a new line.
- glyphActorCreatedForLine = true;
+ ImageActor imageActor = ImageActor::DownCast( characterLayout.mGlyphActor );
+ if( !imageActor )
+ {
+ characterLayout.mGlyphActor = ImageActor::New();
+ characterLayout.mSetText = true;
+ }
+ }
+ else
+ {
+ TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
- if( characterLayout.mIsColorGlyph )
+ if( textActor )
{
- ImageActor imageActor = ImageActor::DownCast( characterLayout.mGlyphActor );
- if( !imageActor )
- {
- characterLayout.mGlyphActor = ImageActor::New();
- characterLayout.mSetText = true;
- }
+ // Try to reuse first the text-actor of this character.
+ textActor.SetTextStyle( characterLayout.mStyledText.mStyle );
+ currentGlyphActor = textActor;
}
else
{
- TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
+ // If there is no text-actor, try to retrieve one from the cache.
+ textActor = relayoutData.mTextActorCache.RetrieveTextActor();
- if( textActor )
+ // If still there is no text-actor, create one.
+ if( !textActor )
{
- // Try to reuse first the text-actor of this character.
- textActor.SetTextStyle( characterLayout.mStyledText.mStyle );
- currentGlyphActor = textActor;
+ TextActorParameters parameters( characterLayout.mStyledText.mStyle, TextActorParameters::FONT_DETECTION_OFF );
+ textActor = TextActor::New( NULL, parameters );
}
else
{
- // If there is no text-actor, try to retrieve one from the cache.
- textActor = relayoutData.mTextActorCache.RetrieveTextActor();
-
- // If still there is no text-actor, create one.
- if( !textActor )
- {
- TextActorParameters parameters( characterLayout.mStyledText.mStyle, TextActorParameters::FONT_DETECTION_OFF );
- textActor = TextActor::New( NULL, parameters );
- }
- else
- {
- textActor.SetTextStyle( characterLayout.mStyledText.mStyle );
- }
-
- currentGlyphActor = textActor;
+ textActor.SetTextStyle( characterLayout.mStyledText.mStyle );
}
- characterLayout.mGlyphActor = currentGlyphActor;
+
+ currentGlyphActor = textActor;
}
+ characterLayout.mGlyphActor = currentGlyphActor;
+ }
- // Update style to be checked with next characters.
- currentStyle = characterLayout.mStyledText.mStyle;
- currentGradientColor = characterLayout.mGradientColor;
- currentStartPoint = characterLayout.mStartPoint;
- currentEndPoint = characterLayout.mEndPoint;
- currentIsColorGlyph = characterLayout.mIsColorGlyph;
+ // Update style to be checked with next characters.
+ currentStyle = characterLayout.mStyledText.mStyle;
+ currentGradientColor = characterLayout.mGradientColor;
+ currentStartPoint = characterLayout.mStartPoint;
+ currentEndPoint = characterLayout.mEndPoint;
+ currentIsColorGlyph = characterLayout.mIsColorGlyph;
- characterLayout.mGlyphActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
- characterLayout.mGlyphActor.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
- }
- else
- {
- DALI_ASSERT_DEBUG( !characterLayout.mIsColorGlyph && "TextViewProcessor::InitializeTextActorInfo. An image-actor doesn't store more than one emoticon." );
+ characterLayout.mGlyphActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ characterLayout.mGlyphActor.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+ }
+ else
+ {
+ DALI_ASSERT_DEBUG( !characterLayout.mIsColorGlyph && "TextViewProcessor::InitializeTextActorInfo. An image-actor doesn't store more than one emoticon." );
- // Same style than previous one.
- TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
- if( textActor )
- {
- // There is a previously created text-actor for this character.
- // If this character has another one put it into the cache.
- textActor.SetText( "" );
- textActorsToRemove.push_back( textActor );
- }
+ // Same style than previous one.
+ TextActor textActor = TextActor::DownCast( characterLayout.mGlyphActor );
+ if( textActor )
+ {
+ // There is a previously created text-actor for this character.
+ // If this character has another one put it into the cache.
+ textActor.SetText( "" );
+ textActorsToRemove.push_back( textActor );
+ }
- if( characterLayout.mGlyphActor )
- {
- characterLayout.mGlyphActor.Reset();
- }
+ if( characterLayout.mGlyphActor )
+ {
+ characterLayout.mGlyphActor.Reset();
}
- } // no white space / new line char
- } // text not empty
+ }
+ } // no white space / new line char
+ } // text not empty
- ++characterGlobalIndex;
- } // characters
- } // words
- } // groups
+ ++characterGlobalIndex;
+ } // characters
+ } // words
} // lines
// Insert the spare text-actors into the cache.
* Updates the layout data structure by modifying the space between lines.
*
* @param[in] lineHeightOffset The new space between lines.
- * @param[in,out] textLayoutInfo Layout info for all groups of characters, words, groups of words, lines and the whole text.
+ * @param[in,out] textLayoutInfo Layout info for all characters, words, lines and the whole text.
*/
void UpdateTextInfo( float lineHeightOffset,
TextLayoutInfo& textLayoutInfo );
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// FILE HEADER
-#include <dali-toolkit/internal/controls/text-view/text-view-word-group-processor.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/text-view/text-view-word-processor.h>
-#include <dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.h>
-#include <dali-toolkit/internal/controls/text-view/text-processor.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace TextViewProcessor
-{
-
-/////////////////////
-// Layout info.
-/////////////////////
-
-WordGroupLayoutInfo::WordGroupLayoutInfo()
-: mSize(),
- mAscender( 0.f ),
- mDirection( LTR ),
- mWordsLayoutInfo(),
- mNumberOfCharacters( 0 )
-{
-}
-
-WordGroupLayoutInfo::WordGroupLayoutInfo( const WordGroupLayoutInfo& group )
-: mSize( group.mSize ),
- mAscender( group.mAscender ),
- mDirection( group.mDirection ),
- mWordsLayoutInfo( group.mWordsLayoutInfo ),
- mNumberOfCharacters( group.mNumberOfCharacters )
-{
-}
-
-WordGroupLayoutInfo& WordGroupLayoutInfo::operator=( const WordGroupLayoutInfo& group )
-{
- mSize = group.mSize;
- mAscender = group.mAscender;
- mDirection = group.mDirection;
- mWordsLayoutInfo = group.mWordsLayoutInfo;
- mNumberOfCharacters = group.mNumberOfCharacters;
-
- return *this;
-}
-
-void UpdateGroupLayoutInfo( TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo )
-{
- wordGroupLayoutInfo.mSize = Size();
-
- for( WordLayoutInfoContainer::iterator it = wordGroupLayoutInfo.mWordsLayoutInfo.begin(), endIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- it != endIt;
- ++it )
- {
- WordLayoutInfo& layoutInfo( *it );
-
- UpdateSize( wordGroupLayoutInfo.mSize, layoutInfo.mSize );
- }
-}
-
-void CreateWordGroupInfo( const MarkupProcessor::StyledTextArray& wordGroup,
- TextViewProcessor::TextLayoutInfo& textLayoutInfo,
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo )
-{
- // Set the direction of the group.
- wordGroupLayoutInfo.mDirection = ( TextProcessor::BeginsRightToLeftCharacter( wordGroup ) ? TextViewProcessor::RTL : TextViewProcessor::LTR );
-
- // Split the group of words in words
- std::vector<MarkupProcessor::StyledTextArray> words;
- TextProcessor::SplitInWords( wordGroup, words );
-
- // if last word has a new line separator, create a new word.
- if( !words.empty() )
- {
- MarkupProcessor::StyledTextArray& word( *( words.end() - 1 ) );
- if( word.size() > 1 )
- {
- // do nothing if the word has only one character.
- MarkupProcessor::StyledText& styledText( *( word.end() - 1 ) );
- if( !styledText.mText.IsEmpty() )
- {
- const std::size_t length = styledText.mText.GetLength();
- if( styledText.mText[length-1].IsNewLine() )
- {
- // Last character of this word is a new line character.
-
- // Remove line separator character from current word.
- styledText.mText.Remove( length - 1, 1 );
-
- // Create a new word with the line separator character.
- MarkupProcessor::StyledText newLineText( Text( styledText.mText[length-1] ), styledText.mStyle );
-
- MarkupProcessor::StyledTextArray newLineWord;
- newLineWord.push_back( newLineText );
-
- words.push_back( newLineWord );
- }
- }
- }
- }
-
- // Reverse if right to left.
- if( TextViewProcessor::RTL == wordGroupLayoutInfo.mDirection )
- {
- std::reverse( words.begin(), words.end() );
- }
-
- std::string lastCharacterFont; // Keeps the font used by the last character. It's used to set the font to a word separator.
-
- // Traverse all words.
- for( std::vector<MarkupProcessor::StyledTextArray>::const_iterator wordIt = words.begin(), wordEndIt = words.end(); wordIt != wordEndIt; ++wordIt )
- {
- const MarkupProcessor::StyledTextArray& word( *wordIt );
-
- // Data structures for the new word.
- WordLayoutInfo wordLayoutInfo;
-
- CreateWordTextInfo( word,
- wordLayoutInfo );
-
- // White space's size could be different depending on the type of font. It's important to use the same font than the previous character to
- // avoid 'jumps' of characters when there is a switch between one text-actor per character and one text-actor per line and/or style.
- if( WordSeparator == wordLayoutInfo.mType )
- {
- // If current word is a word separator (white space) then the font of the last character is set.
- for( CharacterLayoutInfoContainer::iterator characterIt = wordLayoutInfo.mCharactersLayoutInfo.begin(), characterEndIt = wordLayoutInfo.mCharactersLayoutInfo.end();
- characterIt != characterEndIt;
- ++characterIt )
- {
- CharacterLayoutInfo& characterLayout( *characterIt );
-
- characterLayout.mStyledText.mStyle.SetFontName( lastCharacterFont );
- }
- }
- else
- {
- // kepps the font of the last character.
- if( !wordLayoutInfo.mCharactersLayoutInfo.empty() )
- {
- lastCharacterFont = ( *( wordLayoutInfo.mCharactersLayoutInfo.end() - 1 ) ).mStyledText.mStyle.GetFontName();
- }
- }
-
- // Update layout info for the current group of words.
- wordGroupLayoutInfo.mNumberOfCharacters += wordLayoutInfo.mCharactersLayoutInfo.size();
- UpdateSize( wordGroupLayoutInfo.mSize, wordLayoutInfo.mSize );
- wordGroupLayoutInfo.mAscender = std::max( wordGroupLayoutInfo.mAscender, wordLayoutInfo.mAscender );
-
- // Add current word to the group of words.
- wordGroupLayoutInfo.mWordsLayoutInfo.push_back( wordLayoutInfo );
-
- // Update the max word width figure.
- textLayoutInfo.mMaxWordWidth = std::max( textLayoutInfo.mMaxWordWidth, wordLayoutInfo.mSize.width );
- } // end of words
-}
-
-void RemoveCharactersFromWordGroupInfo( TextView::RelayoutData& relayoutData,
- const std::size_t numberOfCharacters,
- bool& mergeWords,
- bool& mergeLines,
- TextViewProcessor::TextInfoIndices& textInfoIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoIndicesEnd,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesEnd,
- TextViewProcessor::WordGroupLayoutInfo& groupLayout,
- std::vector<TextActor>& removedTextActorsFromFirstWord,
- std::vector<TextActor>& removedTextActorsFromLastWord )
-{
- const TextViewProcessor::TextLayoutInfo& textLayoutInfo = relayoutData.mTextLayoutInfo;
-
- if( textInfoIndicesBegin.mWordIndex < textInfoIndicesEnd.mWordIndex )
- {
- // Deleted text is from different words. The two different words may be merged.
-
- // Get first word.
- WordLayoutInfo& firstWordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex ) );
-
- // Get last word.
- WordLayoutInfo& lastWordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex ) );
-
- // whether first or last word need to be split and merged.
- bool mergeFromBegin = false;
- bool mergeToEnd = false;
-
- if( textInfoIndicesBegin.mCharacterIndex > 0 )
- {
- // First word is going to be split. It could be merged with the last word.
- mergeFromBegin = true;
- textInfoMergeIndicesBegin.mWordIndex = textInfoIndicesBegin.mWordIndex;
- }
- else if( ( textInfoIndicesBegin.mCharacterIndex == 0 ) && ( textInfoIndicesBegin.mWordIndex > 0 ) )
- {
- // First word is going to be removed completely.
- // Check if previous word could be merged.
-
- // Get word before.
- WordLayoutInfo& previousWordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex - 1 ) );
- if( WordSeparator != previousWordLayout.mType )
- {
- // Previous word is not a word separator, so could be merged.
- mergeFromBegin = true;
- textInfoMergeIndicesBegin.mWordIndex = textInfoIndicesBegin.mWordIndex - 1;
- }
- }
-
- if( mergeFromBegin )
- {
- // First word (or previous one) could be merged. Check if last one could be merged as well.
-
- if( textInfoIndicesEnd.mCharacterIndex + 1 < lastWordLayout.mCharactersLayoutInfo.size() )
- {
- // Last word is going to be split. It could be merged with the first word.
- mergeToEnd = true;
- textInfoMergeIndicesEnd.mWordIndex = textInfoIndicesEnd.mWordIndex;
- }
- else if( ( textInfoIndicesEnd.mCharacterIndex + 1 == lastWordLayout.mCharactersLayoutInfo.size() ) && ( textInfoIndicesEnd.mWordIndex + 1 < groupLayout.mWordsLayoutInfo.size() ) )
- {
- // Last word is going to be removed completely.
- // Check if the word after could be merged.
-
- // Get word after.
- WordLayoutInfo& afterWordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesEnd.mWordIndex + 1 ) );
- if( WordSeparator != afterWordLayout.mType )
- {
- // The word after is not a word separator, so could be merged.
- mergeToEnd = true;
- textInfoMergeIndicesEnd.mWordIndex = textInfoIndicesEnd.mWordIndex + 1;
- }
- }
-
- // Merge words only if both words could be merged.
- mergeWords = mergeFromBegin && mergeToEnd;
- }
-
- if( ( textInfoIndicesEnd.mCharacterIndex + 1 == lastWordLayout.mCharactersLayoutInfo.size() ) && ( textInfoIndicesEnd.mWordIndex + 1 == groupLayout.mWordsLayoutInfo.size() ) )
- {
- // Last word of the line is going to be removed completely.
- // Check if it's a line separator.
-
- if( LineSeparator == lastWordLayout.mType )
- {
- // The line separator is going to be removed.
- if( textInfoIndicesBegin.mLineIndex + 1 < textLayoutInfo.mLinesLayoutInfo.size() )
- {
- // Line need to be merged.
- textInfoMergeIndicesBegin.mLineIndex = textInfoIndicesBegin.mLineIndex;
- textInfoMergeIndicesEnd.mLineIndex = textInfoIndicesBegin.mLineIndex + 1;
- mergeLines= true;
-
- ++textInfoIndicesBegin.mLineIndex; // increase both indices,
- textInfoIndicesEnd.mLineIndex +=2; // will delete last line.
- }
- }
- }
-
- if( textInfoIndicesBegin.mCharacterIndex > 0 )
- {
- // First word needs to be split.
-
- // Store text-actors before removing them.
- CollectTextActors( removedTextActorsFromFirstWord, firstWordLayout, textInfoIndicesBegin.mCharacterIndex, firstWordLayout.mCharactersLayoutInfo.size() );
-
- RemoveCharactersFromWord( textInfoIndicesBegin.mCharacterIndex,
- firstWordLayout.mCharactersLayoutInfo.size() - textInfoIndicesBegin.mCharacterIndex,
- firstWordLayout );
-
- ++textInfoIndicesBegin.mWordIndex; // will delete from the word after.
- }
-
- if( textInfoIndicesEnd.mCharacterIndex + 1 < lastWordLayout.mCharactersLayoutInfo.size() )
- {
- // Last word needs to be split.
-
- // Store text-actors before removing them.
- CollectTextActors( removedTextActorsFromLastWord, lastWordLayout, 0, textInfoIndicesEnd.mCharacterIndex + 1 );
-
- RemoveCharactersFromWord( 0,
- textInfoIndicesEnd.mCharacterIndex + 1,
- lastWordLayout );
-
- if( mergeWords )
- {
- // This word is going to be merged, so is not needed.
- ++textInfoIndicesEnd.mWordIndex; // will delete the last word.
- }
- }
- else if( textInfoIndicesEnd.mCharacterIndex + 1 == lastWordLayout.mCharactersLayoutInfo.size() )
- {
- // The whole last word is going to be removed.
- ++textInfoIndicesEnd.mWordIndex; // will delete the last word.
-
- if( ( WordSeparator == lastWordLayout.mType ) && mergeWords )
- {
- // The last word is a word separator and the word after is going to be merged so is not needed.
- ++textInfoIndicesEnd.mWordIndex; // will delete the word after the last one.
- }
- }
- }
- else
- {
- // Chraracters to be removed are from the same word.
-
- RemoveCharactersFromWordInfo( relayoutData,
- numberOfCharacters,
- mergeWords,
- mergeLines,
- textInfoIndicesBegin,
- textInfoIndicesEnd,
- textInfoMergeIndicesBegin,
- textInfoMergeIndicesEnd,
- groupLayout,
- removedTextActorsFromFirstWord );
- } // word indices
-}
-
-void RemoveWordsFromWordGroup( const std::size_t wordIndex,
- const std::size_t numberOfWords,
- WordGroupLayoutInfo& wordGroupLayoutInfo )
-{
- // Removes words from a group of words.
-
- // * Check if words or lines can be merged after removing a word or line separator have to be done outside this method.
-
- // * Note: Currently it's only used to remove a number of words from the beginning, or
- // from wordIndex index to the end. This function doesn't merge words (if a white space is removed)
- // TODO: merge words if required.
-
- const std::size_t wordEndIndex = wordIndex + numberOfWords;
-
- // Remove words from layout info.
- wordGroupLayoutInfo.mWordsLayoutInfo.erase( wordGroupLayoutInfo.mWordsLayoutInfo.begin() + wordIndex,
- wordGroupLayoutInfo.mWordsLayoutInfo.begin() + wordEndIndex );
-
- // update layout info
- wordGroupLayoutInfo.mSize = Size();
- wordGroupLayoutInfo.mAscender = 0.f;
- wordGroupLayoutInfo.mNumberOfCharacters = 0;
- for( WordLayoutInfoContainer::const_iterator it = wordGroupLayoutInfo.mWordsLayoutInfo.begin(), endIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- it != endIt;
- ++it )
- {
- const WordLayoutInfo& info( *it );
-
- UpdateSize( wordGroupLayoutInfo.mSize, info.mSize );
- wordGroupLayoutInfo.mAscender = std::max( wordGroupLayoutInfo.mAscender, info.mAscender );
- wordGroupLayoutInfo.mNumberOfCharacters += info.mCharactersLayoutInfo.size();
- }
-}
-
-void SplitWordGroup( const TextInfoIndices& indices,
- WordGroupLayoutInfo& firstWordGroupLayoutInfo,
- WordGroupLayoutInfo& lastWordGroupLayoutInfo )
-{
- // Splits a group of words in two.
- // A word may be split in two as well.
-
- // * Split the word pointed by indices.mWordIndex using the indices.mCharacterIndex index.
- // * Add the last part of the word as first word of the last part of the group of words.
- // * Add folliwing words to the last part of the new group of words.
- // * Remove from the first part of the group of words all words added to the last part of the group of words.
- // * Update layout info.
-
- //early returns
- if( ( 0 == indices.mWordIndex ) && ( 0 == indices.mCharacterIndex ) )
- {
- // the whole group of words goes to the last part of the group.
- lastWordGroupLayoutInfo = firstWordGroupLayoutInfo;
-
- firstWordGroupLayoutInfo = WordGroupLayoutInfo();
-
- return;
- }
-
- if( !firstWordGroupLayoutInfo.mWordsLayoutInfo.empty() )
- {
- const std::size_t numberOfWords = firstWordGroupLayoutInfo.mWordsLayoutInfo.size();
- if( indices.mWordIndex == numberOfWords - 1 )
- {
- const WordLayoutInfo& word( *( firstWordGroupLayoutInfo.mWordsLayoutInfo.end() - 1 ) );
- if( indices.mCharacterIndex == word.mCharactersLayoutInfo.size() )
- {
- // the whole group of words goes to the first part.
-
- // Just delete whatever there is in the last part of the group of words.
- lastWordGroupLayoutInfo = WordGroupLayoutInfo();
-
- return;
- }
- }
- }
-
- lastWordGroupLayoutInfo = WordGroupLayoutInfo();
-
- // 1) Split the word within the group of words to be split.
- WordLayoutInfo& firstWordLayoutInfo( *( firstWordGroupLayoutInfo.mWordsLayoutInfo.begin() + indices.mWordIndex ) );
- WordLayoutInfo lastWordLayoutInfo;
-
- SplitWord( indices.mCharacterIndex,
- firstWordLayoutInfo,
- lastWordLayoutInfo );
-
- // 2) Add last part of the word to the new group of words.
- if( !lastWordLayoutInfo.mCharactersLayoutInfo.empty() )
- {
- lastWordGroupLayoutInfo.mWordsLayoutInfo.push_back( lastWordLayoutInfo );
- }
-
- // 3) Add words from word-position + 1 to the end.
- lastWordGroupLayoutInfo.mWordsLayoutInfo.insert( lastWordGroupLayoutInfo.mWordsLayoutInfo.end(),
- firstWordGroupLayoutInfo.mWordsLayoutInfo.begin() + indices.mWordIndex + 1, firstWordGroupLayoutInfo.mWordsLayoutInfo.end() );
-
- // 4) update layout info of the last group of words.
- lastWordGroupLayoutInfo.mDirection = firstWordGroupLayoutInfo.mDirection;
-
- for( WordLayoutInfoContainer::iterator it = lastWordGroupLayoutInfo.mWordsLayoutInfo.begin(), endIt = lastWordGroupLayoutInfo.mWordsLayoutInfo.end();
- it != endIt;
- ++it )
- {
- WordLayoutInfo& layoutInfo( *it );
-
- UpdateSize( lastWordGroupLayoutInfo.mSize, layoutInfo.mSize );
- lastWordGroupLayoutInfo.mNumberOfCharacters += layoutInfo.mCharactersLayoutInfo.size();
- lastWordGroupLayoutInfo.mAscender = std::max( lastWordGroupLayoutInfo.mAscender, layoutInfo.mAscender );
- }
-
- // 5) Remove words added to the last part of the group of words from the first group of words.
-
- // if the number of characters of the last word of the first group is zero, it should be removed.
- const std::size_t index = ( firstWordLayoutInfo.mCharactersLayoutInfo.empty() ? indices.mWordIndex : indices.mWordIndex + 1 );
-
- firstWordGroupLayoutInfo.mWordsLayoutInfo.erase( firstWordGroupLayoutInfo.mWordsLayoutInfo.begin() + index, firstWordGroupLayoutInfo.mWordsLayoutInfo.end() );
-
- // 6) update layout info of the first group of words.
- firstWordGroupLayoutInfo.mSize = Size();
- firstWordGroupLayoutInfo.mAscender = 0.f;
- firstWordGroupLayoutInfo.mNumberOfCharacters = 0;
- for( WordLayoutInfoContainer::iterator it = firstWordGroupLayoutInfo.mWordsLayoutInfo.begin(), endIt = firstWordGroupLayoutInfo.mWordsLayoutInfo.end();
- it != endIt;
- ++it )
- {
- WordLayoutInfo& layoutInfo( *it );
-
- UpdateSize( firstWordGroupLayoutInfo.mSize, layoutInfo.mSize );
- firstWordGroupLayoutInfo.mNumberOfCharacters += layoutInfo.mCharactersLayoutInfo.size();
- firstWordGroupLayoutInfo.mAscender = std::max( firstWordGroupLayoutInfo.mAscender, layoutInfo.mAscender );
- }
-}
-
-void MergeWordGroup( WordGroupLayoutInfo& firstWordGroupLayoutInfo,
- const WordGroupLayoutInfo& lastWordGroupLayoutInfo )
-{
- // Merges two given groups of words.
- //
- // Can't merge two groups if they have text with different directions (RTL , LTR )
- // or if the last word of the first one is a line separator (new line character)
-
- // Early returns
-
- if( lastWordGroupLayoutInfo.mWordsLayoutInfo.empty() )
- {
- // Nothing to merge if last group is empty.
- return;
- }
-
- if( firstWordGroupLayoutInfo.mWordsLayoutInfo.empty() )
- {
- // If first group is empty, just copy the last group to the first one.
- firstWordGroupLayoutInfo = lastWordGroupLayoutInfo;
-
- return;
- }
-
- // Check both groups have the same direction.
- if( firstWordGroupLayoutInfo.mDirection != lastWordGroupLayoutInfo.mDirection )
- {
- DALI_ASSERT_ALWAYS( !"TextViewProcessor::MergeWordGroup(). ERROR: groups with different direction can't be merged." );
- }
-
- // Check first group doesn't finish with a new line character.
- WordLayoutInfo& lastWordLayout( *( firstWordGroupLayoutInfo.mWordsLayoutInfo.end() - 1 ) );
- if( LineSeparator == lastWordLayout.mType )
- {
- DALI_ASSERT_ALWAYS( !"TextViewProcessor::MergeWordGroup(). ERROR: A group of words can't be merged to another group which finishes with a new line character." );
- }
-
- // If the las word of the first group or the first word of the last group is a white space, both groups can be concatenated.
- // Otherwise both words need to be merged first.
- const WordLayoutInfo& firstWordLayout( *lastWordGroupLayoutInfo.mWordsLayoutInfo.begin() );
-
- std::size_t index = 0;
- if( ( WordSeparator != lastWordLayout.mType ) && ( WordSeparator != firstWordLayout.mType ) && ( LineSeparator != firstWordLayout.mType ) )
- {
- // Last word of the first group is not a word separator and first word of the last group is not a word or line separator.
- // Words need to be merged.
-
- MergeWord( lastWordLayout,
- firstWordLayout );
-
- // After merging two words, the rest of the words need to be added.
- ++index; // By increasing this index the word already merged won't be added again.
- }
-
- // Merge layout info
- firstWordGroupLayoutInfo.mWordsLayoutInfo.insert( firstWordGroupLayoutInfo.mWordsLayoutInfo.end(),
- lastWordGroupLayoutInfo.mWordsLayoutInfo.begin() + index, lastWordGroupLayoutInfo.mWordsLayoutInfo.end() );
- UpdateSize( firstWordGroupLayoutInfo.mSize, lastWordGroupLayoutInfo.mSize );
- firstWordGroupLayoutInfo.mAscender = std::max( firstWordGroupLayoutInfo.mAscender, lastWordGroupLayoutInfo.mAscender );
- firstWordGroupLayoutInfo.mNumberOfCharacters += lastWordGroupLayoutInfo.mNumberOfCharacters;
-}
-
-void CollectTextActorsFromGroups( std::vector<TextActor>& textActors, const LineLayoutInfo& line, const std::size_t groupIndexBegin, const std::size_t groupIndexEnd )
-{
- for( WordGroupLayoutInfoContainer::const_iterator groupIt = line.mWordGroupsLayoutInfo.begin() + groupIndexBegin, groupEndIt = line.mWordGroupsLayoutInfo.begin() + groupIndexEnd;
- groupIt != groupEndIt;
- ++groupIt )
- {
- const WordGroupLayoutInfo& group( *groupIt );
-
- CollectTextActorsFromWords( textActors, group, 0, group.mWordsLayoutInfo.size() );
- }
-}
-
-} //namespace TextViewProcessor
-
-} //namespace Internal
-
-} //namespace Toolkit
-
-} //namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_WORD_GROUP_PROCESSOR_H__
-#define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_WORD_GROUP_PROCESSOR_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/text-view/text-view-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace TextViewProcessor
-{
-
-/**
- * Updates the word group layout size info.
- *
- * @param[in,out] wordGroupLayoutInfo The word group layout info.
- */
-void UpdateGroupLayoutInfo( TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo );
-
-/**
- * Creates a data structure with info to layout the group of words, and data structures with useful info to modify the layout data structure if characters are added or removed.
- *
- * @param[in] wordGroup The styled group of words.
- * @param[in,out] textLayoutInfo Layout info for the whole text. This function uses it to check if the words should be split into individual characters. It also modifies which is the maximum word width.
- * @param[out] wordGroupLayoutInfo Layout info for the whole group of words.
- */
-void CreateWordGroupInfo( const MarkupProcessor::StyledTextArray& wordGroup,
- TextViewProcessor::TextLayoutInfo& textLayoutInfo,
- TextViewProcessor::WordGroupLayoutInfo& wordGroupLayoutInfo );
-
-/**
- * Removes a given number of words from the given group of words.
- *
- * @pre \e wordIndex and \e wordIndex + \e numberOfWords can't exceed the bounds of the group.
- *
- * @param[in] wordIndex Index to the word within the group of words with the starting position to be deleted.
- * @param[in] numberOfWords The number of words to be deleted.
- * @param[in,out] wordGroupLayoutInfo The input is the layout info of the group of words. The output is the layout info of the group of words without the removed words.
- */
-void RemoveWordsFromWordGroup( std::size_t wordIndex,
- std::size_t numberOfWords,
- WordGroupLayoutInfo& wordGroupLayoutInfo );
-
-/**
- * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
- * @param[in] numberOfCharacters The number of characters to be deleted.
- * @param[out] mergeWords Whether words need to be merged after removing characters.
- * @param[out] mergeLines Whether current line need to be merged with the next one.
- * @param[in,out] textInfoIndicesBegin Indices to the line, word and characters from where to delete characters. It returns from where words need to be removed.
- * @param[out] textInfoIndicesEnd If lines or words need to be merged it returns info to delete them (If a word is merged, it has to be removed. Equal for lines).
- * @param[out] textInfoMergeIndicesBegin The indices to the first part of the line, group and word to be merged.
- * @param[out] textInfoMergeIndicesEnd The indices to the last part of the line, group and word to be merged.
- * @param[in,out] groupLayout Layout info of the group of words where the word is located.
- * @param[out] removedTextActorsFromFirstWord Stores removed text-actors of the word pointed by the 'begin' index.
- * @param[out] removedTextActorsFromLastWord Stores removed text-actors of the word pointed by the 'end' index.
- */
-void RemoveCharactersFromWordGroupInfo( TextView::RelayoutData& relayoutData,
- std::size_t numberOfCharacters,
- bool& mergeWords,
- bool& mergeLines,
- TextViewProcessor::TextInfoIndices& textInfoIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoIndicesEnd,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesEnd,
- TextViewProcessor::WordGroupLayoutInfo& groupLayout,
- std::vector<TextActor>& removedTextActorsFromFirstWord,
- std::vector<TextActor>& removedTextActorsFromLastWord );
-
-/**
- * Splits a group of words in two.
- *
- * @note It deletes whatever there is in the last part of the group of words.
- *
- * @param[in] indices Index to the word within the group of words and index to the character within the word where to split the word.
- * @param[in,out] firstWordGroupLayoutInfo The input is the layout info of the given group of words. The output is the first part of the input group of words (from the word \e 0 to the word \e wordPosition).
- * @param[in,out] lastWordGroupLayoutInfo Layout info of the last part of the given group of words ( from the word \e wordPosition + \e 1 to the end of the group of words).
- */
-void SplitWordGroup( const TextInfoIndices& indices,
- WordGroupLayoutInfo& firstWordGroupLayoutInfo,
- WordGroupLayoutInfo& lastWordGroupLayoutInfo );
-
-/**
- * Merges the two given groups of words by adding words of the last group of words to the firs one.
- *
- * @note Does nothing if last part of the group of words is empty.
- * @note If the first part of the group of words is empty it just copy the last part to it.
- * @note It assets if groups of words contain text with different direction. (Left to Right and Right to Left text)
- * @note it asserts if the last word of the first group is a line separator (new line character)
- *
- * @param[in,out] firstWordGroupLayoutInfo The input is the layout info of the first group of words. The output is the layout info of the merged group of words.
- * @param[in] lastWordGroupLayoutInfo Layout info of the last group of words.
- *
- */
-void MergeWordGroup( WordGroupLayoutInfo& firstWordGroupLayoutInfo,
- const WordGroupLayoutInfo& lastWordGroupLayoutInfo );
-
-/**
- * Collects text-actors from the given line, within the given indices, and stores them into the text-actor vector.
- *
- * @param[out] textActors Stores the text-actors of the given line.
- * @param[in] line The line with groups of words.
- * @param[in] groupIndexBegin Index to the first group of words.
- * @param[in] groupIndexEnd Index to the last group of words.
- */
-void CollectTextActorsFromGroups( std::vector<TextActor>& textActors, const LineLayoutInfo& line, std::size_t groupIndexBegin, std::size_t groupIndexEnd );
-
-} //namespace TextViewProcessor
-
-} //namespace Internal
-
-} //namespace Toolkit
-
-} //namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_WORD_GROUP_PROCESSOR_H__
}
void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo )
+ WordLayoutInfo& wordLayoutInfo )
{
DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "-->TextViewProcessor::CreateWordTextInfo\n" );
// Split in characters.
const std::size_t numberOfCharacters,
bool& mergeWords,
bool& mergeLines,
- TextViewProcessor::TextInfoIndices& textInfoIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoIndicesEnd,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesEnd,
- TextViewProcessor::WordGroupLayoutInfo& groupLayout,
+ TextInfoIndices& textInfoIndicesBegin,
+ TextInfoIndices& textInfoIndicesEnd,
+ TextInfoIndices& textInfoMergeIndicesBegin,
+ TextInfoIndices& textInfoMergeIndicesEnd,
+ LineLayoutInfo& lineLayout,
std::vector<TextActor>& removedTextActors )
{
- const TextViewProcessor::TextLayoutInfo& textLayoutInfo = relayoutData.mTextLayoutInfo;
+ const TextLayoutInfo& textLayoutInfo = relayoutData.mTextLayoutInfo;
// Get the word.
- WordLayoutInfo& wordLayout( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex ) );
+ WordLayoutInfo& wordLayout( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex ) );
- if( TextViewProcessor::LineSeparator == wordLayout.mType )
+ if( LineSeparator == wordLayout.mType )
{
// If the word is a line separator and there is more lines, then current line and the line after need to be merged.
if( textInfoIndicesBegin.mLineIndex + 1 < textLayoutInfo.mLinesLayoutInfo.size() )
{
// If the word is a word separator. Check if the word before and the word after can be merged.
- if( ( 0 < textInfoIndicesBegin.mWordIndex ) && ( groupLayout.mWordsLayoutInfo.size() > textInfoIndicesBegin.mWordIndex + 1 ) )
+ if( ( 0 < textInfoIndicesBegin.mWordIndex ) && ( lineLayout.mWordsLayoutInfo.size() > textInfoIndicesBegin.mWordIndex + 1 ) )
{
- const WordLayoutInfo& wordLayoutBefore( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex - 1 ) );
- const WordLayoutInfo& wordLayoutAfter( *( groupLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex + 1 ) );
+ const WordLayoutInfo& wordLayoutBefore( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex - 1 ) );
+ const WordLayoutInfo& wordLayoutAfter( *( lineLayout.mWordsLayoutInfo.begin() + textInfoIndicesBegin.mWordIndex + 1 ) );
if( ( NoSeparator == wordLayoutBefore.mType ) && ( NoSeparator == wordLayoutAfter.mType ) )
{
- // This word is a word separator (white space) and is not the first word of the group nor the last one.
+ // This word is a word separator (white space) and is not the first word of the line nor the last one.
mergeWords = true;
// Set indices to merge the words.
}
}
-void CollectTextActorsFromWords( std::vector<TextActor>& textActors, const WordGroupLayoutInfo& group, const std::size_t wordIndexBegin, const std::size_t wordIndexEnd )
+void CollectTextActorsFromWords( std::vector<TextActor>& textActors, const LineLayoutInfo& line, const std::size_t wordIndexBegin, const std::size_t wordIndexEnd )
{
- for( WordLayoutInfoContainer::const_iterator wordIt = group.mWordsLayoutInfo.begin() + wordIndexBegin, wordEndIt = group.mWordsLayoutInfo.begin() + wordIndexEnd;
+ for( WordLayoutInfoContainer::const_iterator wordIt = line.mWordsLayoutInfo.begin() + wordIndexBegin, wordEndIt = line.mWordsLayoutInfo.begin() + wordIndexEnd;
wordIt != wordEndIt;
++wordIt )
{
* @param[out] wordLayoutInfo Layout info for all characters of the word.
*/
void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
- TextViewProcessor::WordLayoutInfo& wordLayoutInfo );
+ WordLayoutInfo& wordLayoutInfo );
/**
* Removes a given number of characters from the given word.
* @param[out] mergeLines Whether current line need to be merged with the next one.
* @param[in,out] textInfoIndicesBegin Indices to the line, word and characters from where to delete characters. It returns from where words need to be removed.
* @param[out] textInfoIndicesEnd If lines or words need to be merged it returns info to delete them (If a word is merged, it has to be removed. Equal for lines).
- * @param[out] textInfoMergeIndicesBegin The indices to the first part of the line, group and word to be merged.
- * @param[out] textInfoMergeIndicesEnd The indices to the last part of the line, group and word to be merged.
- * @param[in,out] groupLayout Layout info of the group of words where the word is located.
+ * @param[out] textInfoMergeIndicesBegin The indices to the first part of the line and word to be merged.
+ * @param[out] textInfoMergeIndicesEnd The indices to the last part of the line and word to be merged.
+ * @param[in,out] lineLayout Layout info of the line where the word is located.
* @param[out] removedTextActors Stores handles of temoved text-actors.
*/
void RemoveCharactersFromWordInfo( TextView::RelayoutData& relayoutData,
std::size_t numberOfCharacters,
bool& mergeWords,
bool& mergeLines,
- TextViewProcessor::TextInfoIndices& textInfoIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoIndicesEnd,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesBegin,
- TextViewProcessor::TextInfoIndices& textInfoMergeIndicesEnd,
- TextViewProcessor::WordGroupLayoutInfo& groupLayout,
+ TextInfoIndices& textInfoIndicesBegin,
+ TextInfoIndices& textInfoIndicesEnd,
+ TextInfoIndices& textInfoMergeIndicesBegin,
+ TextInfoIndices& textInfoMergeIndicesEnd,
+ LineLayoutInfo& lineLayout,
std::vector<TextActor>& removedTextActors );
/**
* Removes a given number of characters from the given word.
void CollectTextActors( std::vector<TextActor>& textActors, const WordLayoutInfo& word, std::size_t characterIndexBegin, std::size_t characterIndexEnd );
/**
- * Collects text-actors from the given group of words, within the given indices, and stores them into the text-actor vector.
+ * Collects text-actors from the given line, within the given indices, and stores them into the text-actor vector.
*
- * @param[out] textActors Stores the text-actors of the given group of words.
- * @param[in] group The group of words.
+ * @param[out] textActors Stores the text-actors of the given line.
+ * @param[in] line The line with the words.
* @param[in] wordIndexBegin Index to the first word.
* @param[in] wordIndexEnd Index to the last word.
*/
-void CollectTextActorsFromWords( std::vector<TextActor>& textActors, const WordGroupLayoutInfo& group, std::size_t wordIndexBegin, std::size_t wordIndexEnd );
+void CollectTextActorsFromWords( std::vector<TextActor>& textActors, const LineLayoutInfo& line, std::size_t wordIndexBegin, std::size_t wordIndexEnd );
} //namespace TextViewProcessor
$(toolkit_base_src_dir)/controls/text-view/text-view-processor-dbg.cpp \
$(toolkit_base_src_dir)/controls/text-view/text-view-processor-helper-functions.cpp \
$(toolkit_base_src_dir)/controls/text-view/text-view-word-processor.cpp \
- $(toolkit_base_src_dir)/controls/text-view/text-view-word-group-processor.cpp \
$(toolkit_base_src_dir)/factory/localized-control-factory-impl.cpp \
$(toolkit_base_src_dir)/focus-manager/focus-manager-impl.cpp \
$(toolkit_base_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \
bool visible,
float descender );
- Size mSize; ///< Size of the group of characters.
+ Size mSize; ///< Size of the character.
Vector3 mPosition; ///< Position of the character within the text view.
bool mIsNewLineChar:1; ///< Whether this character represent a new line.
bool mIsRightToLeftCharacter:1; ///< Whether it's a right-to-left character.