Text cleaning.
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-internal / dali-toolkit-test-utils / toolkit-text-utils.cpp
index e3ccad8..16666e9 100755 (executable)
@@ -79,7 +79,6 @@ void ClearModelData( CharacterIndex characterIndex,
 
   logicalModel->mScriptRuns.Clear();
   logicalModel->mFontRuns.Clear();
-  logicalModel->mWordBreakInfo.Clear();
   logicalModel->mBidirectionalParagraphInfo.Clear();
   logicalModel->mCharacterDirections.Clear();
   logicalModel->mBidirectionalLineInfo.Clear();
@@ -99,13 +98,13 @@ void CreateTextModel( const std::string& text,
                       const Vector<FontDescriptionRun>& fontDescriptions,
                       const LayoutOptions& options,
                       Size& layoutSize,
-                      LogicalModelPtr& logicalModel,
-                      VisualModelPtr& visualModel,
+                      ModelPtr& textModel,
                       MetricsPtr& metrics,
                       bool markupProcessorEnabled )
 {
-  logicalModel = LogicalModel::New();
-  visualModel = VisualModel::New();
+  textModel = Model::New(); ///< Pointer to the text's model.
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
 
   MarkupProcessData markupProcessData( logicalModel->mColorRuns,
                                        logicalModel->mFontDescriptionRuns,
@@ -153,15 +152,6 @@ void CreateTextModel( const std::string& text,
     return;
   }
 
-  // Retrieves the word break info. The word break info is used to layout the text (where to wrap the text in lines).
-  Vector<WordBreakInfo>& wordBreakInfo = logicalModel->mWordBreakInfo;
-  wordBreakInfo.Resize( characterCount );
-
-  SetWordBreakInfo( utf32Characters,
-                    0u,
-                    characterCount,
-                    wordBreakInfo );
-
   // 3) Set the script info.
   MultilanguageSupport multilanguageSupport = MultilanguageSupport::Get();
 
@@ -291,25 +281,12 @@ void CreateTextModel( const std::string& text,
   layoutEngine.SetLayout( Layout::Engine::MULTI_LINE_BOX );
 
   // Set the layout parameters.
-  const Vector<GlyphIndex>& charactersToGlyph = visualModel->mCharactersToGlyph;
-  const Vector<Length>& glyphsPerCharacter = visualModel->mGlyphsPerCharacter;
-  float outlineWidth = visualModel->GetOutlineWidth();
+  textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
+  textModel->mLineWrapMode = LineWrap::WORD;
+  textModel->mIgnoreSpacesAfterText = true;
+  textModel->mMatchSystemLanguageDirection = false;
   Layout::Parameters layoutParameters( textArea,
-                                       utf32Characters.Begin(),
-                                       lineBreakInfo.Begin(),
-                                       wordBreakInfo.Begin(),
-                                       ( 0u != characterDirections.Count() ) ? characterDirections.Begin() : NULL,
-                                       glyphs.Begin(),
-                                       glyphsToCharactersMap.Begin(),
-                                       charactersPerGlyph.Begin(),
-                                       charactersToGlyph.Begin(),
-                                       glyphsPerCharacter.Begin(),
-                                       numberOfGlyphs,
-                                       Text::HorizontalAlignment::BEGIN,
-                                       Text::LineWrap::WORD,
-                                       outlineWidth,
-                                       true,
-                                       false );
+                                       textModel );
 
   Vector<LineRun>& lines = visualModel->mLines;