Text cleaning. 27/216827/5
authorVictor Cebollada <v.cebollada@samsung.com>
Fri, 1 Nov 2019 10:42:26 +0000 (10:42 +0000)
committerVictor Cebollada <v.cebollada@samsung.com>
Fri, 22 Nov 2019 14:16:46 +0000 (14:16 +0000)
* Refactor the Layout::Parameters struct
* Remove unnecesary code.

Change-Id: I1ebd7a01b3d7fe33917d51c481b536118c5c9bae
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
15 files changed:
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.h
automated-tests/src/dali-toolkit-internal/utc-Dali-BidirectionalSupport.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-LogicalModel.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Cursor.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Shaping.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-VisualModel.cpp
dali-toolkit/devel-api/text/text-utils-devel.cpp
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/layouts/layout-parameters.h
dali-toolkit/internal/text/logical-model-impl.h
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index e3ccad8b616026b1a332cd6d89fe22a8e95846b9..16666e9e357fcc63559fbe4d0d21112c56545d1a 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;
 
index 1e6d750f72f4343abd2aac04fcfce068c66827a3..e4b7dddc7555e974f9ad5f309fc0599c837c1128 100644 (file)
  */
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/logical-model-impl.h>
 #include <dali-toolkit/internal/text/metrics.h>
-#include <dali-toolkit/internal/text/visual-model-impl.h>
 #include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-model.h>
 
 namespace Dali
 {
@@ -56,8 +55,7 @@ struct LayoutOptions
  * @param[in] fontDescriptions The fonts to be used.
  * @param[in] options Layout options.
  * @param[out] layoutSize The laid-out size.
- * @param[out] logicalModel Pointer to a logical text model instance.
- * @param[out] visualModel Pointer to a visual text model instance.
+ * @param[out] textModel Pointer to a text model instance.
  * @param[out] metrics Pointer to a wrapper around FontClient used to get metrics.
  * @param[in] markupProcessorEnabled Enable markup processor to use markup text.
  */
@@ -66,8 +64,7 @@ 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 );
 
index 191ead13410d6ef345125c2f285ac79fdd1f937a..cc6e0705d16f7a3f7fd4350d3d76801b5c5c7faf 100644 (file)
@@ -112,8 +112,7 @@ struct GetCharactersDirectionData
 bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -126,11 +125,13 @@ bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Clear the bidirectional paragraph info data.
   Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
   if( 0u != data.numberOfCharacters )
@@ -219,8 +220,7 @@ void FreeBidirectionalLineInfoResources( Vector<BidirectionalLineInfoRun> bidire
 bool ReorderLinesTest( const ReorderLinesData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 300.f);
   Size layoutSize;
@@ -233,11 +233,13 @@ bool ReorderLinesTest( const ReorderLinesData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Clear the bidirectional line info data.
   uint32_t startRemoveIndex = logicalModel->mBidirectionalLineInfo.Count();
   uint32_t endRemoveIndex = startRemoveIndex;
@@ -345,8 +347,7 @@ bool ReorderLinesTest( const ReorderLinesData& data )
 bool GetMirroredTextTest( const GetMirroredTextData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -359,11 +360,13 @@ bool GetMirroredTextTest( const GetMirroredTextData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Call the GetMirroredText() function for the whole text
   Vector<Character> mirroredText;
   bool mirrored = false;
@@ -420,8 +423,7 @@ bool GetMirroredTextTest( const GetMirroredTextData& data )
 bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -434,11 +436,13 @@ bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    data.markupProcessorEnabled );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
 
   // 2) Clear the direction info data.
index 67c7e243865af1b28cde2afd9ec83ea7b2762ea1..7cbbe90d7c5e19faca50a937ae2923b7d22c3c0a 100755 (executable)
@@ -104,8 +104,7 @@ struct GetLogicalCursorIndexData
 bool CreateParagraphTest( const CreateParagraphData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -117,11 +116,13 @@ bool CreateParagraphTest( const CreateParagraphData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Clear the paragraphs.
   Vector<ParagraphRun>& paragraphs = logicalModel->mParagraphInfo;
   ClearCharacterRuns( data.index,
@@ -165,8 +166,7 @@ bool CreateParagraphTest( const CreateParagraphData& data )
 bool FindParagraphTest( const FindParagraphData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -178,11 +178,13 @@ bool FindParagraphTest( const FindParagraphData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Find the paragraphs.
   Vector<ParagraphRunIndex> paragraphs;
   logicalModel->FindParagraphs( data.index, data.numberOfCharacters, paragraphs );
@@ -214,8 +216,7 @@ bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data
 {
   std::cout << "  testing : " << data.description << std::endl;
   // Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea( 100.f, 300.f );
   Size layoutSize;
@@ -228,11 +229,13 @@ bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   for( unsigned int index = 0; index < data.numberOfTests; ++index )
   {
     const bool fetched = logicalModel->FetchBidirectionalLineInfo( data.characterIndex[index] );
@@ -260,8 +263,7 @@ bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
 {
   std::cout << "  testing : " << data.description << std::endl;
   // Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size layoutSize;
 
@@ -273,11 +275,13 @@ bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
   {
     // Check the current cached bidi line index. (Check it before call the GetLogicalCharacterIndex() method )
@@ -315,8 +319,7 @@ bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
 
   // Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size layoutSize;
 
@@ -335,11 +338,13 @@ bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
   {
     const bool fetched = logicalModel->FetchBidirectionalLineInfo( data.characterIndex[index] );
index 74d335808304484f3713b4b0886e9cc61b40247e..3af20203068a345c728cf6feda2490eb334071f5 100755 (executable)
@@ -97,8 +97,7 @@ bool GetClosestLineTest( const GetClosestLineData& data )
   std::cout << "  testing : " << data.description << std::endl;
 
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(400.f, 600.f);
   Size layoutSize;
@@ -110,11 +109,13 @@ bool GetClosestLineTest( const GetClosestLineData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   for( unsigned int index = 0; index < data.numberOfTests; ++index )
   {
     bool isLineHit = false;
@@ -142,8 +143,7 @@ bool GetClosestCursorIndexTest( const GetClosestCursorIndexData& data )
   std::cout << "  testing : " << data.description << std::endl;
 
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(400.f, 600.f);
   Size layoutSize;
@@ -155,11 +155,13 @@ bool GetClosestCursorIndexTest( const GetClosestCursorIndexData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   for( unsigned int index = 0; index < data.numberOfTests; ++index )
   {
     bool isCharacterHit = false;
@@ -191,8 +193,7 @@ bool GetCursorPositionTest( const GetCursorPositionData& data )
   std::cout << "  testing : " << data.description << std::endl;
 
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(400.f, 600.f);
   Size layoutSize;
@@ -204,11 +205,13 @@ bool GetCursorPositionTest( const GetCursorPositionData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   GetCursorPositionParameters parameters;
   parameters.visualModel = visualModel;
   parameters.logicalModel = logicalModel;
@@ -243,8 +246,7 @@ bool FindSelectionIndicesTest( const FindSelectionIndicesData& data )
   std::cout << "  testing : " << data.description << std::endl;
 
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(400.f, 600.f);
   Size layoutSize;
@@ -256,11 +258,13 @@ bool FindSelectionIndicesTest( const FindSelectionIndicesData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   for( unsigned int index = 0; index < data.numberOfTests; ++index )
   {
     CharacterIndex startIndex = 0;
index f27f4d749d8eb276d10017c9961482dbbd483508..3e4eb3301613fcca187157426c69604d034ed743 100755 (executable)
@@ -87,8 +87,7 @@ bool LayoutTextTest( const LayoutTextData& data )
   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHindiRegular.ttf" );
 
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size layoutSize;
 
@@ -108,11 +107,13 @@ bool LayoutTextTest( const LayoutTextData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Clear the layout.
   Vector<LineRun>& lines = visualModel->mLines;
 
@@ -158,25 +159,12 @@ bool LayoutTextTest( const LayoutTextData& data )
   engine.SetMetrics( metrics );
   engine.SetLayout( data.layout );
 
-  const Length totalNumberOfGlyphs = visualModel->mGlyphs.Count();
-  float outlineWidth = visualModel->GetOutlineWidth();
-
+  textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
+  textModel->mLineWrapMode = LineWrap::WORD;
+  textModel->mIgnoreSpacesAfterText = true;
+  textModel->mMatchSystemLanguageDirection = false;
   Layout::Parameters layoutParameters( data.textArea,
-                                       logicalModel->mText.Begin(),
-                                       logicalModel->mLineBreakInfo.Begin(),
-                                       logicalModel->mWordBreakInfo.Begin(),
-                                       ( 0u != logicalModel->mCharacterDirections.Count() ) ? logicalModel->mCharacterDirections.Begin() : NULL,
-                                       visualModel->mGlyphs.Begin(),
-                                       visualModel->mGlyphsToCharacters.Begin(),
-                                       visualModel->mCharactersPerGlyph.Begin(),
-                                       visualModel->mCharactersToGlyph.Begin(),
-                                       visualModel->mGlyphsPerCharacter.Begin(),
-                                       totalNumberOfGlyphs,
-                                       Text::HorizontalAlignment::BEGIN,
-                                       Text::LineWrap::WORD,
-                                       outlineWidth,
-                                       true,
-                                       false );
+                                       textModel );
 
   layoutParameters.isLastNewParagraph = isLastNewParagraph;
 
@@ -353,8 +341,7 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
 
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size layoutSize;
 
@@ -374,32 +361,23 @@ bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Call the ReLayoutRightToLeftLines() method.
   Layout::Engine engine;
   engine.SetMetrics( metrics );
 
-  float outlineWidth = visualModel->GetOutlineWidth();
+  textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
+  textModel->mLineWrapMode = LineWrap::WORD;
+  textModel->mIgnoreSpacesAfterText = true;
+  textModel->mMatchSystemLanguageDirection = false;
   Layout::Parameters layoutParameters( data.textArea,
-                                       logicalModel->mText.Begin(),
-                                       logicalModel->mLineBreakInfo.Begin(),
-                                       logicalModel->mWordBreakInfo.Begin(),
-                                       ( 0u != logicalModel->mCharacterDirections.Count() ) ? logicalModel->mCharacterDirections.Begin() : NULL,
-                                       visualModel->mGlyphs.Begin(),
-                                       visualModel->mGlyphsToCharacters.Begin(),
-                                       visualModel->mCharactersPerGlyph.Begin(),
-                                       visualModel->mCharactersToGlyph.Begin(),
-                                       visualModel->mGlyphsPerCharacter.Begin(),
-                                       visualModel->mGlyphs.Count(),
-                                       Text::HorizontalAlignment::BEGIN,
-                                       Text::LineWrap::WORD,
-                                       outlineWidth,
-                                       true,
-                                       false );
+                                       textModel );
 
   layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
   layoutParameters.lineBidirectionalInfoRunsBuffer = logicalModel->mBidirectionalLineInfo.Begin();
@@ -471,8 +449,7 @@ bool AlignTest( const AlignData& data )
   fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
 
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size layoutSize;
 
@@ -491,11 +468,13 @@ bool AlignTest( const AlignData& data )
                    fontDescriptionRuns,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // Call the Align method.
   Layout::Engine engine;
   engine.SetMetrics( metrics );
index 025dd5427d2d39f337896a7a7eb02cfb1fcee100..2bdd21767053c905abd9d189dd1841a32e10a6a5 100755 (executable)
@@ -123,8 +123,7 @@ struct ShapeInfoData
 bool ShapeInfoTest( const ShapeInfoData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -136,11 +135,13 @@ bool ShapeInfoTest( const ShapeInfoData& data )
                    data.fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   // 2) Clear the model.
 
   Vector<GlyphInfo>& glyphs = visualModel->mGlyphs;
index c36fed6b10341942e9362cb7f7152ecb9a789424..df247e0066c97012536b6569a097d30639f00491 100644 (file)
@@ -65,8 +65,7 @@ struct SetCharacterToGlyphData
 bool SetGlyphsPerCharacterTest( const SetGlyphsPerCharacterData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -78,11 +77,13 @@ bool SetGlyphsPerCharacterTest( const SetGlyphsPerCharacterData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   Vector<GlyphIndex>& charactersToGlyph = visualModel->mCharactersToGlyph;
   Vector<Length>& glyphsPerCharacter = visualModel->mGlyphsPerCharacter;
 
@@ -148,8 +149,7 @@ bool SetGlyphsPerCharacterTest( const SetGlyphsPerCharacterData& data )
 bool SetCharacterToGlyphTest( const SetCharacterToGlyphData& data )
 {
   // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
+  ModelPtr textModel;
   MetricsPtr metrics;
   Size textArea(100.f, 60.f);
   Size layoutSize;
@@ -161,11 +161,13 @@ bool SetCharacterToGlyphTest( const SetCharacterToGlyphData& data )
                    fontDescriptions,
                    options,
                    layoutSize,
-                   logicalModel,
-                   visualModel,
+                   textModel,
                    metrics,
                    false );
 
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
   Vector<GlyphIndex>& charactersToGlyph = visualModel->mCharactersToGlyph;
   Vector<Length>& glyphsPerCharacter = visualModel->mGlyphsPerCharacter;
 
index eaab0e50607132a98fafd85870fcad8d890970e5..37b5847ef1c4f81d0c6ae3c98bd183738137b904 100755 (executable)
 #include <dali-toolkit/internal/text/color-segmentation.h>
 #include <dali-toolkit/internal/text/layouts/layout-engine.h>
 #include <dali-toolkit/internal/text/layouts/layout-parameters.h>
-#include <dali-toolkit/internal/text/logical-model-impl.h>
 #include <dali-toolkit/internal/text/markup-processor.h>
 #include <dali-toolkit/internal/text/multi-language-support.h>
 #include <dali-toolkit/internal/text/segmentation.h>
 #include <dali-toolkit/internal/text/shaper.h>
 #include <dali-toolkit/internal/text/text-enumerations-impl.h>
 #include <dali-toolkit/internal/text/text-font-style.h>
-#include <dali-toolkit/internal/text/visual-model-impl.h>
+#include <dali-toolkit/internal/text/text-model.h>
 
 namespace Dali
 {
@@ -133,20 +132,19 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
   MultilanguageSupport multilanguageSupport = MultilanguageSupport::Get();
   FontClient fontClient = FontClient::Get();
   MetricsPtr metrics;
-  Text::Layout::Engine layoutEngine;                  ///< The layout engine.
-  LogicalModelPtr logicalModel = LogicalModel::New(); ///< Pointer to the logical model.
-  VisualModelPtr visualModel = VisualModel::New();    ///< Pointer to the visual model.
-  Vector<ColorBlendingMode> blendingMode;             ///< How embedded items and bitmap font glyphs are blended with color text.
-  Vector<bool> isEmoji;                               ///< Whether the glyph is an emoji.
+  Text::Layout::Engine layoutEngine;             ///< The layout engine.
+  Text::ModelPtr textModel = Text::Model::New(); ///< Pointer to the text's model.
+  Vector<ColorBlendingMode> blendingMode;        ///< How embedded items and bitmap font glyphs are blended with color text.
+  Vector<bool> isEmoji;                          ///< Whether the glyph is an emoji.
 
   // Use this to access FontClient i.e. to get down-scaled Emoji metrics.
   metrics = Metrics::New( fontClient );
   layoutEngine.SetMetrics( metrics );
 
-  TextAbstraction::TextRenderer::Parameters rendererParameters( visualModel->mGlyphs,
-                                                                visualModel->mGlyphPositions,
-                                                                visualModel->mColors,
-                                                                visualModel->mColorIndices,
+  TextAbstraction::TextRenderer::Parameters rendererParameters( textModel->mVisualModel->mGlyphs,
+                                                                textModel->mVisualModel->mGlyphPositions,
+                                                                textModel->mVisualModel->mColors,
+                                                                textModel->mVisualModel->mColorIndices,
                                                                 blendingMode,
                                                                 isEmoji );
 
@@ -154,22 +152,22 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
   rendererParameters.height = textParameters.textHeight;
   rendererParameters.pixelFormat = TextAbstraction::TextRenderer::Parameters::RGBA8888; // @note: At the moment all textures are generated RGBA8888
 
-  Vector<Character>& utf32Characters = logicalModel->mText;                                             // Characters encoded in utf32.
-  Vector<Character> mirroredUtf32Characters;                                                             // The utf32Characters Characters but mirrored if there are RTL text.
-  Vector<LineBreakInfo>& lineBreakInfo = logicalModel->mLineBreakInfo;                                  // The line break info.
-  Vector<ScriptRun>& scripts = logicalModel->mScriptRuns;                                               // Charactes's script.
-  Vector<FontDescriptionRun>& fontDescriptionRuns = logicalModel->mFontDescriptionRuns;                 // Desired font descriptions.
-  Vector<FontRun>& validFonts = logicalModel->mFontRuns;                                                // Validated fonts.
-  Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo; // The bidirectional info per paragraph.
-  Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = logicalModel->mBidirectionalLineInfo;       // The bidirectional info per line.
-  Vector<CharacterDirection>& directions = logicalModel->mCharacterDirections;                          // Character's directions.
-  Vector<ColorRun>& colorRuns = logicalModel->mColorRuns;                                               // colors of the text.
-
-  Vector<CharacterIndex>& glyphsToCharacters = visualModel->mGlyphsToCharacters;                        // Glyphs to character map.
-  Vector<GlyphIndex>& charactersToGlyph = visualModel->mCharactersToGlyph;                              // Characters to glyphs map.
-  Vector<Length>& charactersPerGlyph = visualModel->mCharactersPerGlyph;                                // Number of characters per glyph.
-  Vector<Length>& glyphsPerCharacter = visualModel->mGlyphsPerCharacter;                                // The number of glyphs that are shaped.
-  Vector<LineRun>& lines = visualModel->mLines;                                                         // The laid out lines.
+  Vector<Character>& utf32Characters = textModel->mLogicalModel->mText;                                             // Characters encoded in utf32.
+  Vector<Character> mirroredUtf32Characters;                                                                        // The utf32Characters Characters but mirrored if there are RTL text.
+  Vector<LineBreakInfo>& lineBreakInfo = textModel->mLogicalModel->mLineBreakInfo;                                  // The line break info.
+  Vector<ScriptRun>& scripts = textModel->mLogicalModel->mScriptRuns;                                               // Charactes's script.
+  Vector<FontDescriptionRun>& fontDescriptionRuns = textModel->mLogicalModel->mFontDescriptionRuns;                 // Desired font descriptions.
+  Vector<FontRun>& validFonts = textModel->mLogicalModel->mFontRuns;                                                // Validated fonts.
+  Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = textModel->mLogicalModel->mBidirectionalParagraphInfo; // The bidirectional info per paragraph.
+  //Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = textModel->mLogicalModel->mBidirectionalLineInfo;     // The bidirectional info per line.
+  Vector<CharacterDirection>& directions = textModel->mLogicalModel->mCharacterDirections;                          // Character's directions.
+  Vector<ColorRun>& colorRuns = textModel->mLogicalModel->mColorRuns;                                               // colors of the text.
+
+  Vector<CharacterIndex>& glyphsToCharacters = textModel->mVisualModel->mGlyphsToCharacters;                        // Glyphs to character map.
+  Vector<GlyphIndex>& charactersToGlyph = textModel->mVisualModel->mCharactersToGlyph;                              // Characters to glyphs map.
+  Vector<Length>& charactersPerGlyph = textModel->mVisualModel->mCharactersPerGlyph;                                // Number of characters per glyph.
+  Vector<Length>& glyphsPerCharacter = textModel->mVisualModel->mGlyphsPerCharacter;                                // The number of glyphs that are shaped.
+  Vector<LineRun>& lines = textModel->mVisualModel->mLines;                                                         // The laid out lines.
 
   Vector<GlyphIndex> newParagraphGlyphs;                   // Glyphs for the new paragraph characters.
 
@@ -189,7 +187,7 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
 
   MarkupProcessData markupProcessData( colorRuns,
                                        fontDescriptionRuns,
-                                       logicalModel->mEmbeddedItems );
+                                       textModel->mLogicalModel->mEmbeddedItems );
 
   if (textParameters.markupEnabled)
   {
@@ -362,19 +360,19 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
              newParagraphGlyphs );
 
   // Create the 'number of glyphs' per character and the glyph to character conversion tables.
-  visualModel->CreateGlyphsPerCharacterTable( 0u, 0u, numberOfCharacters );
-  visualModel->CreateCharacterToGlyphTable( 0u, 0u, numberOfCharacters );
+  textModel->mVisualModel->CreateGlyphsPerCharacterTable( 0u, 0u, numberOfCharacters );
+  textModel->mVisualModel->CreateCharacterToGlyphTable( 0u, 0u, numberOfCharacters );
 
   const Length numberOfGlyphs = rendererParameters.glyphs.Count();
 
   // Once the text has been shaped and the glyphs created it's possible to replace the font id of those glyphs
   // that represent an image or an item and create the embedded item layout info.
   // Note: the position of the embedded item can't be set until the text is laid-out.
-  embeddedItemLayout.Reserve( logicalModel->mEmbeddedItems.Count() );
-  for( const auto& item : logicalModel->mEmbeddedItems )
+  embeddedItemLayout.Reserve( textModel->mLogicalModel->mEmbeddedItems.Count() );
+  for( const auto& item : textModel->mLogicalModel->mEmbeddedItems )
   {
     // Get the glyph that matches with the character index.
-    const GlyphIndex glyphIndex = visualModel->mCharactersToGlyph[item.characterIndex];
+    const GlyphIndex glyphIndex = textModel->mVisualModel->mCharactersToGlyph[item.characterIndex];
     GlyphInfo& glyph = rendererParameters.glyphs[glyphIndex];
 
     glyph.fontId = 0u;
@@ -421,11 +419,11 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
                             0u,
                             0u,
                             numberOfCharacters,
-                            visualModel->mColors,
-                            visualModel->mColorIndices );
+                            textModel->mVisualModel->mColors,
+                            textModel->mVisualModel->mColorIndices );
 
   // Insert the default color at the beginning of the vector.
-  visualModel->mColors.Insert( visualModel->mColors.Begin(),textParameters.textColor );
+  textModel->mVisualModel->mColors.Insert( textModel->mVisualModel->mColors.Begin(),textParameters.textColor );
 
   // Set how the embedded items are blended with text color.
   blendingMode.Resize( numberOfGlyphs, textParameters.isTextColorSet ? ColorBlendingMode::MULTIPLY : ColorBlendingMode::NONE );
@@ -435,9 +433,9 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
     // Traverse the color runs.
     for( const auto& run : colorRuns )
     {
-      const GlyphIndex firstGlyph = visualModel->mCharactersToGlyph[run.characterRun.characterIndex];
+      const GlyphIndex firstGlyph = textModel->mVisualModel->mCharactersToGlyph[run.characterRun.characterIndex];
       const CharacterIndex lastCharacter = run.characterRun.characterIndex + run.characterRun.numberOfCharacters - 1u;
-      const GlyphIndex lastGlyphPlusOne = visualModel->mCharactersToGlyph[lastCharacter] + visualModel->mGlyphsPerCharacter[lastCharacter];
+      const GlyphIndex lastGlyphPlusOne = textModel->mVisualModel->mCharactersToGlyph[lastCharacter] + textModel->mVisualModel->mGlyphsPerCharacter[lastCharacter];
 
       for( GlyphIndex index = firstGlyph; index < lastGlyphPlusOne; ++index )
       {
@@ -447,9 +445,9 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
   }
 
   // Traverse the embedded items and update the blending mode vector.
-  for( const auto& item : logicalModel->mEmbeddedItems )
+  for( const auto& item : textModel->mLogicalModel->mEmbeddedItems )
   {
-    const GlyphIndex glyphIndex = visualModel->mCharactersToGlyph[item.characterIndex];
+    const GlyphIndex glyphIndex = textModel->mVisualModel->mCharactersToGlyph[item.characterIndex];
     blendingMode[glyphIndex] = item.colorBlendingMode;
   }
 
@@ -463,9 +461,9 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
   {
     if( run.script == TextAbstraction::Script::EMOJI )
     {
-      const GlyphIndex firstGlyph = visualModel->mCharactersToGlyph[run.characterRun.characterIndex];
+      const GlyphIndex firstGlyph = textModel->mVisualModel->mCharactersToGlyph[run.characterRun.characterIndex];
       const CharacterIndex lastCharacter = run.characterRun.characterIndex + run.characterRun.numberOfCharacters - 1u;
-      const GlyphIndex lastGlyphPlusOne = visualModel->mCharactersToGlyph[lastCharacter] + visualModel->mGlyphsPerCharacter[lastCharacter];
+      const GlyphIndex lastGlyphPlusOne = textModel->mVisualModel->mCharactersToGlyph[lastCharacter] + textModel->mVisualModel->mGlyphsPerCharacter[lastCharacter];
 
       for( GlyphIndex index = firstGlyph; index < lastGlyphPlusOne; ++index )
       {
@@ -560,22 +558,12 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
     textLayoutArea.width = fabs( Radian( Degree( textParameters.incrementAngle ) ) * static_cast<float>( rendererParameters.radius ) );
   }
 
+  textModel->mHorizontalAlignment = isCircularTextLayout ? horizontalCircularAlignment : horizontalAlignment;
+  textModel->mLineWrapMode = LineWrap::WORD;
+  textModel->mIgnoreSpacesAfterText = false;
+  textModel->mMatchSystemLanguageDirection = false;
   Text::Layout::Parameters layoutParameters( textLayoutArea,
-                                       textToShape.Begin(),
-                                       lineBreakInfo.Begin(),
-                                       nullptr,
-                                       ( 0u != directions.Count() ) ? directions.Begin() : nullptr,
-                                       rendererParameters.glyphs.Begin(),
-                                       glyphsToCharacters.Begin(),
-                                       charactersPerGlyph.Begin(),
-                                       charactersToGlyph.Begin(),
-                                       glyphsPerCharacter.Begin(),
-                                       numberOfGlyphs,
-                                       isCircularTextLayout ? horizontalCircularAlignment : horizontalAlignment,
-                                       LineWrap::WORD,
-                                       0.f,
-                                       false,
-                                       false ); // Outline's width
+                                             textModel );
 
   // Resize the vector of positions to have the same size than the vector of glyphs.
   rendererParameters.positions.Resize( numberOfGlyphs );
@@ -606,6 +594,7 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
 
   if( hasBidirectionalText )
   {
+    Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = textModel->mLogicalModel->mBidirectionalLineInfo;
     // Reorder the line.
     bidirectionalLineInfo.Reserve( 1u );
 
index 6e8be71482946643f03601f72f0bdfe32655a4c2..f4e11bfcae679c0abcde8912314fd8d23b17d971 100755 (executable)
@@ -50,7 +50,8 @@ namespace
 #endif
 
 const float MAX_FLOAT = std::numeric_limits<float>::max();
-const bool RTL = true;
+const CharacterDirection LTR = false;
+const CharacterDirection RTL = !LTR;
 const float LINE_SPACING= 0.f;
 
 inline bool isEmptyLineAtLast( const Vector<LineRun>& lines, const Vector<LineRun>::Iterator& line )
@@ -196,8 +197,20 @@ struct Engine::Impl
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->GetLineLayoutForBox\n" );
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "  initial glyph index : %d\n", lineLayout.glyphIndex );
 
+    const Character* const textBuffer = parameters.textModel->mLogicalModel->mText.Begin();
+    const Length* const charactersPerGlyphBuffer = parameters.textModel->mVisualModel->mCharactersPerGlyph.Begin();
+    const GlyphInfo* const glyphsBuffer = parameters.textModel->mVisualModel->mGlyphs.Begin();
+    const CharacterIndex* const glyphsToCharactersBuffer = parameters.textModel->mVisualModel->mGlyphsToCharacters.Begin();
+    const LineBreakInfo* const lineBreakInfoBuffer = parameters.textModel->mLogicalModel->mLineBreakInfo.Begin();
+
+    const bool hasBidiParagraphs = !parameters.textModel->mLogicalModel->mBidirectionalParagraphInfo.Empty();
+    const CharacterDirection* const characterDirectionBuffer = hasBidiParagraphs ? parameters.textModel->mLogicalModel->mCharacterDirections.Begin() : nullptr;
+
+    const float outlineWidth = static_cast<float>( parameters.textModel->GetOutlineWidth() );
+    const Length totalNumberOfGlyphs = parameters.textModel->mVisualModel->mGlyphs.Count();
+
     const bool isMultiline = mLayout == MULTI_LINE_BOX;
-    const bool isWordLaidOut = parameters.lineWrapMode == Text::LineWrap::WORD;
+    const bool isWordLaidOut = parameters.textModel->mLineWrapMode == Text::LineWrap::WORD;
 
     // The last glyph to be laid-out.
     const GlyphIndex lastGlyphOfParagraphPlusOne = parameters.startGlyphIndex + parameters.numberOfGlyphs;
@@ -209,17 +222,17 @@ struct Engine::Impl
     // Check whether the first glyph comes from a character that is shaped in multiple glyphs.
     const Length numberOfGLyphsInGroup = GetNumberOfGlyphsOfGroup( lineLayout.glyphIndex,
                                                                    lastGlyphOfParagraphPlusOne,
-                                                                   parameters.charactersPerGlyphBuffer );
+                                                                   charactersPerGlyphBuffer );
 
     GlyphMetrics glyphMetrics;
     GetGlyphsMetrics( lineLayout.glyphIndex,
                       numberOfGLyphsInGroup,
                       glyphMetrics,
-                      parameters.glyphsBuffer,
+                      glyphsBuffer,
                       mMetrics );
 
     // Set the direction of the first character of the line.
-    lineLayout.characterIndex = *( parameters.glyphsToCharactersBuffer + lineLayout.glyphIndex );
+    lineLayout.characterIndex = *( glyphsToCharactersBuffer + lineLayout.glyphIndex );
 
     // Stores temporary line layout which has not been added to the final line layout.
     LineLayout tmpLineLayout;
@@ -229,7 +242,7 @@ struct Engine::Impl
     // The initial start point is zero. However it needs a correction according the 'x' bearing of the first glyph.
     // i.e. if the bearing of the first glyph is negative it may exceed the boundaries of the text area.
     // It needs to add as well space for the cursor if the text is in edit mode and extra space in case the text is outlined.
-    tmpLineLayout.penX = -glyphMetrics.xBearing + mCursorWidth + parameters.outlineWidth;
+    tmpLineLayout.penX = -glyphMetrics.xBearing + mCursorWidth + outlineWidth;
 
     // Initialize the advance of the previous glyph.
     tmpLineLayout.previousAdvance = 0.f;
@@ -248,16 +261,16 @@ struct Engine::Impl
       // Check whether this glyph comes from a character that is shaped in multiple glyphs.
       const Length numberOfGLyphsInGroup = GetNumberOfGlyphsOfGroup( glyphIndex,
                                                                      lastGlyphOfParagraphPlusOne,
-                                                                     parameters.charactersPerGlyphBuffer );
+                                                                     charactersPerGlyphBuffer );
 
       GlyphMetrics glyphMetrics;
       GetGlyphsMetrics( glyphIndex,
                         numberOfGLyphsInGroup,
                         glyphMetrics,
-                        parameters.glyphsBuffer,
+                        glyphsBuffer,
                         mMetrics );
 
-      const bool isLastGlyph = glyphIndex + numberOfGLyphsInGroup  == parameters.totalNumberOfGlyphs;
+      const bool isLastGlyph = glyphIndex + numberOfGLyphsInGroup  == totalNumberOfGlyphs;
 
       // Check if the font of the current glyph is the same of the previous one.
       // If it's different the ascender and descender need to be updated.
@@ -270,13 +283,13 @@ struct Engine::Impl
       // Get the character indices for the current glyph. The last character index is needed
       // because there are glyphs formed by more than one character but their break info is
       // given only for the last character.
-      const Length charactersPerGlyph = *( parameters.charactersPerGlyphBuffer + glyphIndex + numberOfGLyphsInGroup - 1u );
+      const Length charactersPerGlyph = *( charactersPerGlyphBuffer + glyphIndex + numberOfGLyphsInGroup - 1u );
       const bool hasCharacters = charactersPerGlyph > 0u;
-      const CharacterIndex characterFirstIndex = *( parameters.glyphsToCharactersBuffer + glyphIndex );
+      const CharacterIndex characterFirstIndex = *( glyphsToCharactersBuffer + glyphIndex );
       const CharacterIndex characterLastIndex = characterFirstIndex + ( hasCharacters ? charactersPerGlyph - 1u : 0u );
 
       // Get the line break info for the current character.
-      const LineBreakInfo lineBreakInfo = hasCharacters ? *( parameters.lineBreakInfoBuffer + characterLastIndex ) : TextAbstraction::LINE_NO_BREAK;
+      const LineBreakInfo lineBreakInfo = hasCharacters ? *( lineBreakInfoBuffer + characterLastIndex ) : TextAbstraction::LINE_NO_BREAK;
 
       // Increase the number of characters.
       tmpLineLayout.numberOfCharacters += charactersPerGlyph;
@@ -285,7 +298,7 @@ struct Engine::Impl
       tmpLineLayout.numberOfGlyphs += numberOfGLyphsInGroup;
 
       // Check whether is a white space.
-      const Character character = *( parameters.textBuffer + characterFirstIndex );
+      const Character character = *( textBuffer + characterFirstIndex );
       const bool isWhiteSpace = TextAbstraction::IsWhiteSpace( character );
 
       // Calculate the length of the line.
@@ -353,9 +366,9 @@ struct Engine::Impl
 
         // Set the next paragraph's direction.
         if( !isLastGlyph &&
-            ( NULL != parameters.characterDirectionBuffer ) )
+            ( nullptr != characterDirectionBuffer ) )
         {
-          paragraphDirection = *( parameters.characterDirectionBuffer + 1u + characterLastIndex );
+          paragraphDirection = *( characterDirectionBuffer + 1u + characterLastIndex );
         }
 
         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "  Must break\n" );
@@ -425,7 +438,7 @@ struct Engine::Impl
                               Length& linesCapacity,
                               bool updateCurrentBuffer )
   {
-    LineRun* linesBuffer = NULL;
+    LineRun* linesBuffer = nullptr;
     // Reserve more space for the next lines.
     linesCapacity *= 2u;
     if( updateCurrentBuffer )
@@ -480,7 +493,7 @@ struct Engine::Impl
       // The last line needs to be completely filled with characters.
       // Part of a word may be used.
 
-      LineRun* lineRun = NULL;
+      LineRun* lineRun = nullptr;
       LineLayout ellipsisLayout;
       if( 0u != numberOfLines )
       {
@@ -514,7 +527,7 @@ struct Engine::Impl
       lineRun->extraLength = std::ceil( ellipsisLayout.wsLengthEndOfLine );
       lineRun->ascender = ellipsisLayout.ascender;
       lineRun->descender = ellipsisLayout.descender;
-      lineRun->direction = !RTL;
+      lineRun->direction = LTR;
       lineRun->ellipsis = true;
 
       layoutSize.width = layoutParameters.boundingBox.width;
@@ -523,9 +536,12 @@ struct Engine::Impl
         layoutSize.height += ( lineRun->ascender + -lineRun->descender ) + lineRun->lineSpacing;
       }
 
-      SetGlyphPositions( layoutParameters.glyphsBuffer + lineRun->glyphRun.glyphIndex,
+      const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
+      const float outlineWidth = static_cast<float>( layoutParameters.textModel->GetOutlineWidth() );
+
+      SetGlyphPositions( glyphsBuffer + lineRun->glyphRun.glyphIndex,
                          ellipsisLayout.numberOfGlyphs,
-                         layoutParameters.outlineWidth,
+                         outlineWidth,
                          layoutParameters.interGlyphExtraAdvance,
                          glyphPositionsBuffer + lineRun->glyphRun.glyphIndex - layoutParameters.startGlyphIndex );
     }
@@ -586,7 +602,7 @@ struct Engine::Impl
 
     lineRun.ascender = layout.ascender;
     lineRun.descender = layout.descender;
-    lineRun.direction = !RTL;
+    lineRun.direction = LTR;
     lineRun.ellipsis = false;
 
     // Update the actual size.
@@ -615,8 +631,10 @@ struct Engine::Impl
                          LineRun* linesBuffer,
                          Length& numberOfLines )
   {
+    const Vector<GlyphInfo>& glyphs = layoutParameters.textModel->mVisualModel->mGlyphs;
+
     // Need to add a new line with no characters but with height to increase the layoutSize.height
-    const GlyphInfo& glyphInfo = *( layoutParameters.glyphsBuffer + layoutParameters.totalNumberOfGlyphs - 1u );
+    const GlyphInfo& glyphInfo = glyphs[glyphs.Count() - 1u];
 
     Text::FontMetrics fontMetrics;
     if( 0u != glyphInfo.fontId )
@@ -636,7 +654,7 @@ struct Engine::Impl
     lineRun.descender = fontMetrics.descender;
     lineRun.extraLength = 0.f;
     lineRun.alignmentOffset = 0.f;
-    lineRun.direction = !RTL;
+    lineRun.direction = LTR;
     lineRun.ellipsis = false;
     lineRun.lineSpacing = mDefaultLineSpacing;
 
@@ -746,6 +764,7 @@ struct Engine::Impl
     }
 
     const GlyphIndex lastGlyphPlusOne = layoutParameters.startGlyphIndex + layoutParameters.numberOfGlyphs;
+    const Length totalNumberOfGlyphs = layoutParameters.textModel->mVisualModel->mGlyphs.Count();
 
     // In a previous layout, an extra line with no characters may have been added if the text ended with a new paragraph character.
     // This extra line needs to be removed.
@@ -754,22 +773,27 @@ struct Engine::Impl
       Vector<LineRun>::Iterator lastLine = lines.End() - 1u;
 
       if( ( 0u == lastLine->characterRun.numberOfCharacters ) &&
-          ( lastGlyphPlusOne == layoutParameters.totalNumberOfGlyphs ) )
+          ( lastGlyphPlusOne == totalNumberOfGlyphs ) )
       {
         lines.Remove( lastLine );
       }
     }
 
+    // Retrieve BiDi info.
+    const bool hasBidiParagraphs = !layoutParameters.textModel->mLogicalModel->mBidirectionalParagraphInfo.Empty();
+
+    const CharacterDirection* const characterDirectionBuffer = hasBidiParagraphs ? layoutParameters.textModel->mLogicalModel->mCharacterDirections.Begin() : nullptr;
+
     // Set the first paragraph's direction.
-    CharacterDirection paragraphDirection = ( NULL != layoutParameters.characterDirectionBuffer ) ? *layoutParameters.characterDirectionBuffer : !RTL;
+    CharacterDirection paragraphDirection = ( nullptr != characterDirectionBuffer ) ? *characterDirectionBuffer : LTR;
 
     // Whether the layout is being updated or set from scratch.
-    const bool updateCurrentBuffer = layoutParameters.numberOfGlyphs < layoutParameters.totalNumberOfGlyphs;
+    const bool updateCurrentBuffer = layoutParameters.numberOfGlyphs < totalNumberOfGlyphs;
 
-    Vector2* glyphPositionsBuffer = NULL;
+    Vector2* glyphPositionsBuffer = nullptr;
     Vector<Vector2> newGlyphPositions;
 
-    LineRun* linesBuffer = NULL;
+    LineRun* linesBuffer = nullptr;
     Vector<LineRun> newLines;
 
     // Estimate the number of lines.
@@ -792,9 +816,14 @@ struct Engine::Impl
       linesBuffer = lines.Begin();
     }
 
+
+    const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
+    const float outlineWidth = static_cast<float>( layoutParameters.textModel->GetOutlineWidth() );
+
     float penY = CalculateLineOffset( lines,
                                       layoutParameters.startLineIndex );
 
+
     for( GlyphIndex index = layoutParameters.startGlyphIndex; index < lastGlyphPlusOne; )
     {
       CharacterDirection currentParagraphDirection = paragraphDirection;
@@ -855,7 +884,7 @@ struct Engine::Impl
       else
       {
         // Whether the last line has been laid-out.
-        const bool isLastLine = index + layout.numberOfGlyphs == layoutParameters.totalNumberOfGlyphs;
+        const bool isLastLine = index + layout.numberOfGlyphs == totalNumberOfGlyphs;
 
         if( numberOfLines == linesCapacity )
         {
@@ -877,7 +906,7 @@ struct Engine::Impl
 
         const GlyphIndex nextIndex = index + layout.numberOfGlyphs;
 
-        if( ( nextIndex == layoutParameters.totalNumberOfGlyphs ) &&
+        if( ( nextIndex == totalNumberOfGlyphs ) &&
             layoutParameters.isLastNewParagraph &&
             ( mLayout == MULTI_LINE_BOX ) )
         {
@@ -903,9 +932,9 @@ struct Engine::Impl
         } // whether to add a last line.
 
         // Sets the positions of the glyphs.
-        SetGlyphPositions( layoutParameters.glyphsBuffer + index,
+        SetGlyphPositions( glyphsBuffer + index,
                            layout.numberOfGlyphs,
-                           layoutParameters.outlineWidth,
+                           outlineWidth,
                            layoutParameters.interGlyphExtraAdvance,
                            glyphPositionsBuffer + index - layoutParameters.startGlyphIndex );
 
@@ -922,7 +951,7 @@ struct Engine::Impl
       glyphPositions.Insert( glyphPositions.Begin() + layoutParameters.startGlyphIndex,
                              newGlyphPositions.Begin(),
                              newGlyphPositions.End() );
-      glyphPositions.Resize( layoutParameters.totalNumberOfGlyphs );
+      glyphPositions.Resize( totalNumberOfGlyphs );
 
       newLines.Resize( numberOfLines );
 
@@ -968,6 +997,11 @@ struct Engine::Impl
                                  Length numberOfCharacters,
                                  Vector<Vector2>& glyphPositions )
   {
+    const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
+    const GlyphIndex* const charactersToGlyphsBuffer = layoutParameters.textModel->mVisualModel->mCharactersToGlyph.Begin();
+    const Length* const glyphsPerCharacterBuffer = layoutParameters.textModel->mVisualModel->mGlyphsPerCharacter.Begin();
+    const float outlineWidth = static_cast<float>( layoutParameters.textModel->GetOutlineWidth() );
+
     const CharacterIndex lastCharacterIndex = startIndex + numberOfCharacters;
 
     // Traverses the paragraphs with right to left characters.
@@ -988,9 +1022,9 @@ struct Engine::Impl
       }
 
       const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *bidiLine.visualToLogicalMap;
-      const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + *( layoutParameters.charactersToGlyphsBuffer + characterVisualIndex ) );
+      const GlyphInfo& glyph = *( glyphsBuffer + *( charactersToGlyphsBuffer + characterVisualIndex ) );
 
-      float penX = -glyph.xBearing + layoutParameters.outlineWidth + mCursorWidth;
+      float penX = -glyph.xBearing + outlineWidth + mCursorWidth;
 
       Vector2* glyphPositionsBuffer = glyphPositions.Begin();
 
@@ -1003,16 +1037,16 @@ struct Engine::Impl
         const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *( bidiLine.visualToLogicalMap + characterLogicalIndex );
 
         // Get the number of glyphs of the character.
-        const Length numberOfGlyphs = *( layoutParameters.glyphsPerCharacterBuffer + characterVisualIndex );
+        const Length numberOfGlyphs = *( glyphsPerCharacterBuffer + characterVisualIndex );
 
         for( GlyphIndex index = 0u; index < numberOfGlyphs; ++index )
         {
           // Convert the character in the visual order into the glyph in the visual order.
-          const GlyphIndex glyphIndex = *( layoutParameters.charactersToGlyphsBuffer + characterVisualIndex ) + index;
+          const GlyphIndex glyphIndex = *( charactersToGlyphsBuffer + characterVisualIndex ) + index;
 
-          DALI_ASSERT_DEBUG( 0u <= glyphIndex && glyphIndex < layoutParameters.totalNumberOfGlyphs );
+          DALI_ASSERT_DEBUG( 0u <= glyphIndex && glyphIndex < layoutParameters.textModel->mVisualModel->mGlyphs.Count() );
 
-          const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + glyphIndex );
+          const GlyphInfo& glyph = *( glyphsBuffer + glyphIndex );
           Vector2& position = *( glyphPositionsBuffer + glyphIndex );
 
           position.x = std::round( penX + glyph.xBearing );
@@ -1166,7 +1200,7 @@ struct Engine::Impl
     line.descender = 0.f;
     line.extraLength = 0.f;
     line.alignmentOffset = 0.f;
-    line.direction = !RTL;
+    line.direction = LTR;
     line.ellipsis = false;
     line.lineSpacing = mDefaultLineSpacing;
   }
@@ -1179,7 +1213,7 @@ struct Engine::Impl
 };
 
 Engine::Engine()
-: mImpl( NULL )
+: mImpl( nullptr )
 {
   mImpl = new Engine::Impl();
 }
index e877e642ff5670193b5f30937117a2bef93786e5..b3aeaadf79e8eac2dd6b608db03ba28b903a8095 100755 (executable)
@@ -24,6 +24,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
+#include <dali-toolkit/internal/text/text-model.h>
 
 namespace Dali
 {
@@ -48,86 +49,30 @@ struct Parameters
    * Constructor with the needed parameters to layout the text.
    *
    * @param[in] boundingBox The size of the box containing the text.
-   * @param[in] textBuffer The text buffer.
-   * @param[in] lineBreakInfoBuffer The line break info.
-   * @param[in] wordBreakInfoBuffer The word break info.
-   * @param[in] characterDirectionBuffer Vector with the direction of each character.
-   * @param[in] glyphsBuffer Vector with glyphs.
-   * @param[in] glyphsToCharactersBuffer Vector with indices pointing the first character of each glyph.
-   * @param[in] charactersPerGlyphBuffer Vector with the number of characters that forms each glyph.
-   * @param[in] charactersToGlyphsBuffer Vector with indices pointing the first glyph of each character.
-   * @param[in] glyphsPerCharacterBuffer Vector with the number of glyphs shaped from the character.
-   * @param[in] totalNumberOfGlyphs The number of glyphs.
-   * @param[in] horizontalAlignment The horizontal alignment.
-   * @param[in] lineWrapMode The text wrap mode.
-   * @param[in] outlineWidth The outline width.
-   * @param[in] ignoreSpaceAfterText Whether ignoring spaces after text or not.
-   * @param[in] matchSystemLanguageDirection Whether match align for system language direction or not..
+   * @param[in,out] textModel The text's model.
    */
   Parameters( const Vector2& boundingBox,
-              const Character* const textBuffer,
-              const LineBreakInfo* const lineBreakInfoBuffer,
-              const WordBreakInfo* const wordBreakInfoBuffer,
-              const CharacterDirection* const characterDirectionBuffer,
-              const GlyphInfo* const glyphsBuffer,
-              const CharacterIndex* const glyphsToCharactersBuffer,
-              const Length* const charactersPerGlyphBuffer,
-              const GlyphIndex* const charactersToGlyphsBuffer,
-              const Length* const glyphsPerCharacterBuffer,
-              Length totalNumberOfGlyphs,
-              Text::HorizontalAlignment::Type horizontalAlignment,
-              Text::LineWrap::Mode lineWrapMode,
-              float outlineWidth,
-              bool ignoreSpaceAfterText,
-              bool matchSystemLanguageDirection )
-  : boundingBox( boundingBox ),
-    textBuffer( textBuffer ),
-    lineBreakInfoBuffer( lineBreakInfoBuffer ),
-    wordBreakInfoBuffer( wordBreakInfoBuffer ),
-    characterDirectionBuffer( characterDirectionBuffer ),
-    glyphsBuffer( glyphsBuffer ),
-    glyphsToCharactersBuffer( glyphsToCharactersBuffer ),
-    charactersPerGlyphBuffer( charactersPerGlyphBuffer ),
-    charactersToGlyphsBuffer( charactersToGlyphsBuffer ),
-    glyphsPerCharacterBuffer( glyphsPerCharacterBuffer ),
-    lineBidirectionalInfoRunsBuffer( NULL ),
-    numberOfBidirectionalInfoRuns( 0u ),
-    startGlyphIndex( 0u ),
-    numberOfGlyphs( 0u ),
-    totalNumberOfGlyphs( totalNumberOfGlyphs ),
-    horizontalAlignment( horizontalAlignment ),
-    startLineIndex( 0u ),
-    estimatedNumberOfLines( 0u ),
-    lineWrapMode( lineWrapMode ),
-    outlineWidth( outlineWidth ),
-    ignoreSpaceAfterText( ignoreSpaceAfterText ),
-    matchSystemLanguageDirection ( matchSystemLanguageDirection ),
-    interGlyphExtraAdvance( 0.f ),
-    isLastNewParagraph( false )
+              ModelPtr textModel )
+  : boundingBox{ boundingBox },
+    textModel{ textModel },
+    lineBidirectionalInfoRunsBuffer{ nullptr },
+    numberOfBidirectionalInfoRuns{ 0u },
+    startGlyphIndex{ 0u },
+    numberOfGlyphs{ 0u },
+    startLineIndex{ 0u },
+    estimatedNumberOfLines{ 0u },
+    interGlyphExtraAdvance{ 0.f },
+    isLastNewParagraph{ false }
   {}
 
   Vector2                         boundingBox;                     ///< The size of the box containing the text.
-  const Character* const          textBuffer;                      ///< The text buffer.
-  const LineBreakInfo* const      lineBreakInfoBuffer;             ///< The line break info.
-  const WordBreakInfo* const      wordBreakInfoBuffer;             ///< The word break info.
-  const CharacterDirection* const characterDirectionBuffer;        ///< Vector with the direction of each character.
-  const GlyphInfo* const          glyphsBuffer;                    ///< Vector with glyphs.
-  const CharacterIndex* const     glyphsToCharactersBuffer;        ///< Vector with indices pointing the first character of each glyph.
-  const Length* const             charactersPerGlyphBuffer;        ///< Vector with the number of characters that forms each glyph.
-  const GlyphIndex* const         charactersToGlyphsBuffer;        ///< Vector with indices pointing the first glyph of each character.
-  const Length* const             glyphsPerCharacterBuffer;        ///< Vector with the number of glyphs shaped from the character.
+  ModelPtr textModel;
   BidirectionalLineInfoRun*       lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
   Length                          numberOfBidirectionalInfoRuns;   ///< The number of lines with bidirectional info.
   GlyphIndex                      startGlyphIndex;                 ///< Index to the first glyph to layout.
   Length                          numberOfGlyphs;                  ///< The number of glyphs to layout.
-  Length                          totalNumberOfGlyphs;             ///< The number of glyphs.
-  HorizontalAlignment::Type       horizontalAlignment;             ///< The horizontal alignment.
   LineIndex                       startLineIndex;                  ///< The line index where to insert the new lines.
   Length                          estimatedNumberOfLines;          ///< The estimated number of lines.
-  Text::LineWrap::Mode            lineWrapMode;                    ///< The line wrap mode for moving to next line.
-  float                           outlineWidth;                    ///< The outline width.
-  bool                            ignoreSpaceAfterText:1;          ///< Whether ignoring spaces after text or not. Default is true.
-  bool                            matchSystemLanguageDirection:1;  ///< Whether match align for system language direction or not. Default is false.
   float                           interGlyphExtraAdvance;          ///< Extra advance added to each glyph.
   bool                            isLastNewParagraph:1;            ///< Whether the last character is a new paragraph character.
 };
index b2fc5a14c340de3fc260ade7f42fbbd66a32f05d..040444f41732eeafbc14654d4a57deac174a4425 100755 (executable)
@@ -213,7 +213,6 @@ public:
   Vector<ColorRun>                      mColorRuns;
   Vector<FontDescriptionRun>            mFontDescriptionRuns;
   Vector<LineBreakInfo>                 mLineBreakInfo;
-  Vector<WordBreakInfo>                 mWordBreakInfo;
   Vector<ParagraphRun>                  mParagraphInfo;
   Vector<BidirectionalParagraphInfoRun> mBidirectionalParagraphInfo;
   Vector<CharacterDirection>            mCharacterDirections;              ///< For each character, whether is right to left. ( @e flase is left to right, @e true right to left ).
index 2c9a78dc9eb71740ffe76c8231b878c6e75d2e6b..6908f047dc94fe23cfaca668bf86d245156424f3 100755 (executable)
@@ -505,11 +505,6 @@ void Controller::Impl::ClearFullModelData( OperationsMask operations )
     mModel->mLogicalModel->mParagraphInfo.Clear();
   }
 
-  if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
-  {
-    mModel->mLogicalModel->mLineBreakInfo.Clear();
-  }
-
   if( NO_OPERATION != ( GET_SCRIPTS & operations ) )
   {
     mModel->mLogicalModel->mScriptRuns.Clear();
@@ -584,15 +579,6 @@ void Controller::Impl::ClearCharacterModelData( CharacterIndex startIndex, Chara
                         mModel->mLogicalModel->mParagraphInfo );
   }
 
-  if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
-  {
-    // Clear the word break info.
-    WordBreakInfo* wordBreakInfoBuffer = mModel->mLogicalModel->mWordBreakInfo.Begin();
-
-    mModel->mLogicalModel->mWordBreakInfo.Erase( wordBreakInfoBuffer + startIndex,
-                                         wordBreakInfoBuffer + endIndexPlusOne );
-  }
-
   if( NO_OPERATION != ( GET_SCRIPTS & operations ) )
   {
     // Clear the scripts.
@@ -877,19 +863,6 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
     updated = true;
   }
 
-  Vector<WordBreakInfo>& wordBreakInfo = mModel->mLogicalModel->mWordBreakInfo;
-  if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
-  {
-    // Retrieves the word break info. The word break info is used to layout the text (where to wrap the text in lines).
-    wordBreakInfo.Resize( numberOfCharacters, TextAbstraction::WORD_NO_BREAK );
-
-    SetWordBreakInfo( utf32Characters,
-                      startIndex,
-                      requestedNumberOfCharacters,
-                      wordBreakInfo );
-    updated = true;
-  }
-
   const bool getScripts = NO_OPERATION != ( GET_SCRIPTS & operations );
   const bool validateFonts = NO_OPERATION != ( VALIDATE_FONTS & operations );
 
index 9f524dc9b3e2a5a8e67d88c208ee716f4086e0f2..e660591aa693c4fe87b2867185ab064f6ee78b03 100755 (executable)
@@ -2045,7 +2045,6 @@ Vector3 Controller::GetNaturalSize()
                                                                            GET_SCRIPTS       |
                                                                            VALIDATE_FONTS    |
                                                                            GET_LINE_BREAKS   |
-                                                                           GET_WORD_BREAKS   |
                                                                            BIDI_INFO         |
                                                                            SHAPE_TEXT        |
                                                                            GET_GLYPH_METRICS );
@@ -2117,7 +2116,6 @@ bool Controller::CheckForTextFit( float pointSize, Size& layoutSize )
                                                                               GET_SCRIPTS |
                                                                            VALIDATE_FONTS |
                                                                           GET_LINE_BREAKS |
-                                                                          GET_WORD_BREAKS |
                                                                                 BIDI_INFO |
                                                                                 SHAPE_TEXT|
                                                                          GET_GLYPH_METRICS );
@@ -2213,7 +2211,6 @@ float Controller::GetHeightForWidth( float width )
                                                                            GET_SCRIPTS       |
                                                                            VALIDATE_FONTS    |
                                                                            GET_LINE_BREAKS   |
-                                                                           GET_WORD_BREAKS   |
                                                                            BIDI_INFO         |
                                                                            SHAPE_TEXT        |
                                                                            GET_GLYPH_METRICS );
@@ -2435,7 +2432,6 @@ Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection()
                                                                            GET_SCRIPTS       |
                                                                            VALIDATE_FONTS    |
                                                                            GET_LINE_BREAKS   |
-                                                                           GET_WORD_BREAKS   |
                                                                            BIDI_INFO         |
                                                                            SHAPE_TEXT        |
                                                                            GET_GLYPH_METRICS );
@@ -3829,32 +3825,11 @@ bool Controller::DoRelayout( const Size& size,
       return true;
     }
 
-    const Vector<LineBreakInfo>& lineBreakInfo = mImpl->mModel->mLogicalModel->mLineBreakInfo;
-    const Vector<WordBreakInfo>& wordBreakInfo = mImpl->mModel->mLogicalModel->mWordBreakInfo;
-    const Vector<CharacterDirection>& characterDirection = mImpl->mModel->mLogicalModel->mCharacterDirections;
-    const Vector<GlyphInfo>& glyphs = mImpl->mModel->mVisualModel->mGlyphs;
-    const Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mModel->mVisualModel->mGlyphsToCharacters;
-    const Vector<Length>& charactersPerGlyph = mImpl->mModel->mVisualModel->mCharactersPerGlyph;
     const Character* const textBuffer = mImpl->mModel->mLogicalModel->mText.Begin();
-    const float outlineWidth = static_cast<float>( mImpl->mModel->GetOutlineWidth() );
 
     // Set the layout parameters.
     Layout::Parameters layoutParameters( size,
-                                         textBuffer,
-                                         lineBreakInfo.Begin(),
-                                         wordBreakInfo.Begin(),
-                                         ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
-                                         glyphs.Begin(),
-                                         glyphsToCharactersMap.Begin(),
-                                         charactersPerGlyph.Begin(),
-                                         charactersToGlyphBuffer,
-                                         glyphsPerCharacterBuffer,
-                                         totalNumberOfGlyphs,
-                                         mImpl->mModel->mHorizontalAlignment,
-                                         mImpl->mModel->mLineWrapMode,
-                                         outlineWidth,
-                                         mImpl->mModel->mIgnoreSpacesAfterText,
-                                         mImpl->mModel->mMatchSystemLanguageDirection );
+                                         mImpl->mModel );
 
     // Resize the vector of positions to have the same size than the vector of glyphs.
     Vector<Vector2>& glyphPositions = mImpl->mModel->mVisualModel->mGlyphPositions;
index 18ff68e7a9c911b085421341606943b20dc4d114..3e2a50d6565d3f685b25279b974d895607504541 100755 (executable)
@@ -74,16 +74,15 @@ public: // Enumerated types.
     GET_SCRIPTS        = 0x0002,
     VALIDATE_FONTS     = 0x0004,
     GET_LINE_BREAKS    = 0x0008,
-    GET_WORD_BREAKS    = 0x0010,
-    BIDI_INFO          = 0x0020,
-    SHAPE_TEXT         = 0x0040,
-    GET_GLYPH_METRICS  = 0x0080,
-    LAYOUT             = 0x0100,
-    UPDATE_LAYOUT_SIZE = 0x0200,
-    REORDER            = 0x0400,
-    ALIGN              = 0x0800,
-    COLOR              = 0x1000,
-    UPDATE_DIRECTION   = 0x2000,
+    BIDI_INFO          = 0x0010,
+    SHAPE_TEXT         = 0x0020,
+    GET_GLYPH_METRICS  = 0x0040,
+    LAYOUT             = 0x0080,
+    UPDATE_LAYOUT_SIZE = 0x0100,
+    REORDER            = 0x0200,
+    ALIGN              = 0x0400,
+    COLOR              = 0x0800,
+    UPDATE_DIRECTION   = 0x1000,
     ALL_OPERATIONS     = 0xFFFF
   };