Merge "GetLineCount() after GetTextDirection() returns wrong value." into devel/master
authorjoogab yun <joogab.yun@samsung.com>
Mon, 2 Dec 2019 01:20:09 +0000 (01:20 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 2 Dec 2019 01:20:09 +0000 (01:20 +0000)
58 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
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-Text-ViewModel.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp [new file with mode: 0755]
automated-tests/src/dali-toolkit-internal/utc-Dali-VisualModel.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageVisual.cpp
dali-toolkit/devel-api/image-loader/async-image-loader-devel.cpp
dali-toolkit/devel-api/image-loader/async-image-loader-devel.h
dali-toolkit/devel-api/layouting/flex-node.cpp
dali-toolkit/devel-api/text/text-utils-devel.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/image-loader/async-image-loader-impl.cpp
dali-toolkit/internal/image-loader/async-image-loader-impl.h
dali-toolkit/internal/image-loader/image-load-thread.cpp
dali-toolkit/internal/image-loader/image-load-thread.h
dali-toolkit/internal/text/bidirectional-line-info-run.h
dali-toolkit/internal/text/bidirectional-paragraph-info-run.h
dali-toolkit/internal/text/bidirectional-support.cpp
dali-toolkit/internal/text/bidirectional-support.h
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/layouts/layout-engine.h
dali-toolkit/internal/text/layouts/layout-parameters.h
dali-toolkit/internal/text/logical-model-impl.cpp
dali-toolkit/internal/text/logical-model-impl.h
dali-toolkit/internal/text/rendering/view-model.cpp
dali-toolkit/internal/text/rendering/view-model.h
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/text/text-model-interface.h
dali-toolkit/internal/text/text-model.cpp
dali-toolkit/internal/text/text-model.h
dali-toolkit/internal/text/text-scroller.cpp
dali-toolkit/internal/text/text-view-interface.h
dali-toolkit/internal/text/text-view.cpp
dali-toolkit/internal/text/text-view.h
dali-toolkit/internal/text/visual-model-impl.h
dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.cpp
dali-toolkit/internal/visuals/texture-manager-impl.cpp
dali-toolkit/internal/visuals/texture-manager-impl.h
dali-toolkit/public-api/dali-toolkit-version.cpp
dali-toolkit/styles/2048x1080/dali-toolkit-default-theme.json [new file with mode: 0755]
dali-toolkit/styles/2048x1080/images/cursor_handler_drop_center.png [new file with mode: 0644]
dali-toolkit/styles/2048x1080/images/selection_handle_drop_left.png [new file with mode: 0644]
dali-toolkit/styles/2048x1080/images/selection_handle_drop_right.png [new file with mode: 0644]
dali-toolkit/third-party/nanosvg/nanosvg.cc
packaging/dali-toolkit.spec

index 984e177..9954a74 100755 (executable)
@@ -25,6 +25,7 @@ SET(TC_SOURCES
  utc-Dali-Text-Shaping.cpp
  utc-Dali-Text-Typesetter.cpp
  utc-Dali-Text-ViewModel.cpp
+ utc-Dali-TextField-internal.cpp
  utc-Dali-TextureManager.cpp
  utc-Dali-Visuals-internal.cpp
  utc-Dali-VisualModel.cpp
index e3ccad8..b7a1122 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;
 
@@ -326,42 +303,10 @@ void CreateTextModel( const std::string& text,
 
   bool isAutoScroll = false;
   layoutEngine.LayoutText( layoutParameters,
-                           glyphPositions,
-                           lines,
                            layoutSize,
                            false,
                            isAutoScroll );
 
-  // 10) Reorder the lines
-  if( 0u != bidirectionalInfo.Count() )
-  {
-    Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = logicalModel->mBidirectionalLineInfo;
-
-    // Get the lines
-    const Length numberOfLines = lines.Count();
-
-    // Reorder the lines.
-    bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
-    ReorderLines( bidirectionalInfo,
-                  0u,
-                  characterCount,
-                  lines,
-                  bidirectionalLineInfo );
-
-    // Set the bidirectional info per line into the layout parameters.
-    layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
-    layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
-
-    if( options.reorder )
-    {
-      // Re-layout the text. Reorder those lines with right to left characters.
-      layoutEngine.ReLayoutRightToLeftLines( layoutParameters,
-                                             0u,
-                                             characterCount,
-                                             glyphPositions );
-    }
-  }
-
   if( options.align )
   {
     float alignmentOffset = 0.f;
index 1e6d750..eb0dd40 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
 {
@@ -39,11 +38,9 @@ namespace Text
 struct LayoutOptions
 {
   LayoutOptions()
-  : reorder( true ),
-    align( true )
+  : align{ true }
   {}
 
-  bool reorder : 1; ///< Whether to reorder the bidirectional lines.
   bool align   : 1; ///< Whether to align the lines.
 };
 
@@ -56,8 +53,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 +62,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 191ead1..e056f73 100644 (file)
@@ -38,11 +38,6 @@ using namespace Text;
 //                            CharacterIndex startIndex,
 //                            Length numberOfCharacters,
 //                            Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo )
-// void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
-//                    CharacterIndex startIndex,
-//                    Length numberOfCharacters,
-//                    Vector<LineRun>& lineRuns,
-//                    Vector<BidirectionalLineInfoRun>& lineInfoRuns )
 // bool GetMirroredText( const Vector<Character>& text,
 //                       Vector<CharacterDirection>& directions,
 //                       const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
@@ -50,6 +45,7 @@ using namespace Text;
 //                       Length numberOfCharacters,
 //                       Vector<Character>& mirroredText )
 // void GetCharactersDirection( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
+//                              Length totalNumberOfCharacters,
 //                              CharacterIndex startIndex,
 //                              Length numberOfCharacters,
 //                              Vector<CharacterDirection>& directions )
@@ -78,18 +74,6 @@ struct BidiLineData
   unsigned int* visualToLogical;
 };
 
-struct ReorderLinesData
-{
-  std::string   description;        ///< Description of the test.
-  std::string   text;               ///< Input text.
-  unsigned int  startIndex;         ///< The index from where the model is updated.
-  unsigned int  numberOfCharacters; ///< The number of characters.
-  unsigned int  numberOfLineInfo;   ///< The number or reordered lines.
-  BidiLineData* bidiLineData;       ///< The bidirectional line info.
-  unsigned int  numberOfLines;      ///< The number of laid-out lines.
-  bool*         lineDirections;     ///< The directions of the lines.
-};
-
 struct GetMirroredTextData
 {
   std::string  description;        ///< Description of the test.
@@ -112,8 +96,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 +109,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 )
@@ -193,160 +178,10 @@ bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data )
   return true;
 }
 
-/**
- * @brief Frees previously allocated bidirectional resources.
- *
- * @param[in] bidirectionalLineInfo Bidirectional info per line.
- * @param[in] startIndex Index to the first line with bidirectional info to be freed.
- * @param[in] endIndex Index to the last line with bidirectional info to be freed.
- */
-void FreeBidirectionalLineInfoResources( Vector<BidirectionalLineInfoRun> bidirectionalLineInfo,
-                                         uint32_t startIndex,
-                                         uint32_t endIndex )
-{
-  // Free the allocated memory used to store the conversion table in the bidirectional line info run.
-  for( Vector<BidirectionalLineInfoRun>::Iterator it = bidirectionalLineInfo.Begin() + startIndex,
-         endIt = bidirectionalLineInfo.Begin() + endIndex;
-       it != endIt;
-       ++it )
-  {
-    BidirectionalLineInfoRun& bidiLineInfo = *it;
-
-    free( bidiLineInfo.visualToLogicalMap );
-  }
-}
-
-bool ReorderLinesTest( const ReorderLinesData& data )
-{
-  // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
-  MetricsPtr metrics;
-  Size textArea(100.f, 300.f);
-  Size layoutSize;
-
-  // Create the model.
-  const Vector<FontDescriptionRun> fontDescriptions;
-  const LayoutOptions options;
-  CreateTextModel( data.text,
-                   textArea,
-                   fontDescriptions,
-                   options,
-                   layoutSize,
-                   logicalModel,
-                   visualModel,
-                   metrics,
-                   false );
-
-  // 2) Clear the bidirectional line info data.
-  uint32_t startRemoveIndex = logicalModel->mBidirectionalLineInfo.Count();
-  uint32_t endRemoveIndex = startRemoveIndex;
-  ClearCharacterRuns( data.startIndex,
-                      data.startIndex + data.numberOfCharacters - 1u,
-                      logicalModel->mBidirectionalLineInfo,
-                      startRemoveIndex,
-                      endRemoveIndex );
-
-  // Index to the first index to be removed.
-
-  FreeBidirectionalLineInfoResources( logicalModel->mBidirectionalLineInfo, startRemoveIndex, endRemoveIndex );
-  BidirectionalLineInfoRun* bidiLineBuffer = logicalModel->mBidirectionalLineInfo.Begin();
-  logicalModel->mBidirectionalLineInfo.Erase( bidiLineBuffer + startRemoveIndex,
-                                              bidiLineBuffer + endRemoveIndex );
-
-  // 3) Call the function ReorderLines()
-
-  ReorderLines( logicalModel->mBidirectionalParagraphInfo,
-                data.startIndex,
-                data.numberOfCharacters,
-                visualModel->mLines,
-                logicalModel->mBidirectionalLineInfo );
-
-  // 4) Compare the results.
-
-  if( data.numberOfLineInfo != logicalModel->mBidirectionalLineInfo.Count() )
-  {
-    // Different number of bidirectional lines.
-    std::cout << "  different number of bidi lines : " << logicalModel->mBidirectionalLineInfo.Count() << ", expected : " << data.numberOfLineInfo << std::endl;
-    for( unsigned int index = 0u; index < logicalModel->mBidirectionalLineInfo.Count(); ++index )
-    {
-      const BidirectionalLineInfoRun& run = logicalModel->mBidirectionalLineInfo[index];
-      const BidiLineData& bidiLineData = data.bidiLineData[index];
-
-      std::cout << "  bidi line : " << index << ", index : " << run.characterRun.characterIndex << ", num chars : " << run.characterRun.numberOfCharacters << std::endl;
-      std::cout << "                      expected index : " << bidiLineData.characterIndex << ", num chars : " << bidiLineData.numberOfCharacters << std::endl;
-    }
-    return false;
-  }
-
-  for( unsigned int index = 0u; index < data.numberOfLineInfo; ++index )
-  {
-    const BidirectionalLineInfoRun& run = logicalModel->mBidirectionalLineInfo[index];
-    const BidiLineData& bidiLineData = data.bidiLineData[index];
-
-    if( bidiLineData.characterIndex != run.characterRun.characterIndex )
-    {
-      std::cout << "  bidi line : " << index << ", index : " << run.characterRun.characterIndex << ", num chars : " << run.characterRun.numberOfCharacters << std::endl;
-      std::cout << "                      expected index : " << bidiLineData.characterIndex << ", num chars : " << bidiLineData.numberOfCharacters << std::endl;
-      return false;
-    }
-    if( bidiLineData.numberOfCharacters != run.characterRun.numberOfCharacters )
-    {
-      std::cout << "  bidi line : " << index << ", index : " << run.characterRun.characterIndex << ", num chars : " << run.characterRun.numberOfCharacters << std::endl;
-      std::cout << "                      expected index : " << bidiLineData.characterIndex << ", num chars : " << bidiLineData.numberOfCharacters << std::endl;
-      return false;
-    }
-
-    for( unsigned int i = 0u; i < run.characterRun.numberOfCharacters; ++i )
-    {
-      if( bidiLineData.visualToLogical[i] != run.visualToLogicalMap[i] )
-      {
-        std::cout << "           v2l : ";
-        for( unsigned int i = 0u; i < run.characterRun.numberOfCharacters; ++i )
-        {
-          std::cout << run.visualToLogicalMap[i] << " ";
-        }
-        std::cout << std::endl;
-        std::cout << "  expected v2l : ";
-        for( unsigned int i = 0u; i < run.characterRun.numberOfCharacters; ++i )
-        {
-          std::cout << bidiLineData.visualToLogical[i] << " ";
-        }
-        std::cout << std::endl;
-
-        return false;
-      }
-    }
-  }
-
-  if( data.numberOfLines != visualModel->mLines.Count() )
-  {
-    std::cout << "Different number of lines : " << visualModel->mLines.Count() << ", expected : " << data.numberOfLines << std::endl;
-
-    unsigned int index = 0u;
-    for( Vector<LineRun>::ConstIterator it = visualModel->mLines.Begin(),
-           endIt = visualModel->mLines.End();
-         it != endIt;
-         ++it, ++index )
-    {
-      const LineRun& line = *it;
-
-      if( line.direction != *( data.lineDirections + index ) )
-      {
-        std::cout << "  Different line direction : " << line.direction << ", expected : " << *( data.lineDirections + index ) << std::endl;
-        return false;
-      }
-    }
-  }
-
-  return true;
-}
-
 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 +194,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 +257,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 +270,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.
@@ -620,193 +458,6 @@ int UtcDaliSetBidirectionalInfo(void)
   END_TEST;
 }
 
-int UtcDaliReorderLines(void)
-{
-  tet_infoline(" UtcDaliSetBidirectionalInfo");
-
-  unsigned int visualToLogical0301[] = { 0u, 1u, 2u, 3u, 4u, 5u, 9u, 8u, 7u, 6u, 10u };
-  unsigned int visualToLogical0302[] = { 3u, 2u, 1u, 0u, 4u, 5u, 6u, 7u, 8u, 9u, 10u };
-  unsigned int visualToLogical0303[] = { 0u, 1u, 2u, 3u, 4u };
-  unsigned int visualToLogical0304[] = { 12u, 11u, 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0305[] = { 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0306[] = { 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0307[] = { 13u, 8u, 9u, 10u, 11u, 12u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0308[] = { 5u, 0u, 1u, 2u, 3u, 4u };
-  unsigned int visualToLogical0309[] = { 0u, 1u, 2u, 3u, 4u, 5u, 9u, 8u, 7u, 6u, 10u };
-  unsigned int visualToLogical0310[] = { 3u, 2u, 1u, 0u, 4u, 5u, 6u, 7u, 8u, 9u, 10u };
-  unsigned int visualToLogical0311[] = { 0u, 1u, 2u, 3u, 4u };
-  unsigned int visualToLogical0312[] = { 12u, 11u, 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0313[] = { 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0314[] = { 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0315[] = { 13u, 8u, 9u, 10u, 11u, 12u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
-  unsigned int visualToLogical0316[] = { 0u, 1u, 2u, 3u, 4u };
-
-  BidiLineData bidiLine01[] = {};
-  BidiLineData bidiLine02[] = {};
-  BidiLineData bidiLine03[] = {
-    {
-      17u,
-      11u,
-      visualToLogical0301
-    },
-    {
-      28u,
-      11u,
-      visualToLogical0302
-    },
-    {
-      39u,
-      5u,
-      visualToLogical0303
-    },
-    {
-      44u,
-      13u,
-      visualToLogical0304
-    },
-    {
-      57u,
-      11u,
-      visualToLogical0305
-    },
-    {
-      68u,
-      10u,
-      visualToLogical0306
-    },
-    {
-      78u,
-      14u,
-      visualToLogical0307
-    },
-    {
-      92u,
-      6u,
-      visualToLogical0308
-    },
-    {
-      115u,
-      11u,
-      visualToLogical0309
-    },
-    {
-      126u,
-      11u,
-      visualToLogical0310
-    },
-    {
-      137u,
-      5u,
-      visualToLogical0311
-    },
-    {
-      142u,
-      13u,
-      visualToLogical0312
-    },
-    {
-      155u,
-      11u,
-      visualToLogical0313
-    },
-    {
-      166u,
-      10u,
-      visualToLogical0314
-    },
-    {
-      176u,
-      14u,
-      visualToLogical0315
-    },
-    {
-      190u,
-      5u,
-      visualToLogical0316
-    },
-  };
-
-  bool directions02[] = { false, false, false, false, false, false };
-  bool directions03[] = { false, false, false, false, false, true, true, true, true, true, false, false, false, false, false, true, true, true, true, true };
-
-  struct ReorderLinesData data[] =
-  {
-    {
-      "Zero characters.",
-      "",
-      0u,
-      0u,
-      0u,
-      bidiLine01,
-      0u,
-      NULL
-    },
-    {
-      "Left to right text only.",
-      "Hello world demo\nhello world demo\nhello world demo.",
-      0u,
-      51u,
-      0u,
-      bidiLine02,
-      6u,
-      directions02
-    },
-    {
-      "Bidirectional paragraphs.",
-      "Hello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world\nHello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world",
-      0u,
-      195u,
-      16u,
-      bidiLine03,
-      20u,
-      directions03
-    },
-    {
-      "Bidirectional paragraphs. Update initial paragraphs.",
-      "Hello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world\nHello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world",
-      0u,
-      44u,
-      16u,
-      bidiLine03,
-      20u,
-      directions03
-    },
-    {
-      "Bidirectional paragraphs. Update middle paragraphs.",
-      "Hello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world\nHello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world",
-      44u,
-      54u,
-      16u,
-      bidiLine03,
-      20u,
-      directions03
-    },
-    {
-      "Bidirectional paragraphs. Update final paragraphs.",
-      "Hello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world\nHello world demo\nhello שלום עולם world demo\nשלום بالعالم עולם مرحبا שלום עולם بالعالم hello world",
-      142u,
-      53u,
-      16u,
-      bidiLine03,
-      20u,
-      directions03
-    },
-  };
-  const unsigned int numberOfTests = 6u;
-
-  for( unsigned int index = 0u; index < numberOfTests; ++index )
-  {
-    ToolkitTestApplication application;
-    if( !ReorderLinesTest( data[index] ) )
-    {
-      tet_result(TET_FAIL);
-    }
-  }
-
-  tet_result(TET_PASS);
-  END_TEST;
-}
-
 int UtcDaliGetMirroredText(void)
 {
   tet_infoline(" UtcDaliGetMirroredText");
index 67c7e24..7cbbe90 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 74d3358..9c0842e 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;
@@ -449,7 +453,7 @@ int UtcDaliGetClosestCursorIndex(void)
                                       CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP };
   CharacterIndex logicalIndex05[] = {    0,  10u,  20u,  30u,  40u,  46u,
                                        47u,  52u,  62u,  71u,  82u,  93u,
-                                       95u,  99u, 112u, 122u, 131u, 140u,
+                                       94u,  99u, 112u, 122u, 131u, 140u,
                                       141u, 153u, 162u, 171u, 181u, 187u,
                                       188u, 194u, 201u, 213u, 222u, 234u,
                                       236u, 244u, 254u, 263u, 265u };
@@ -493,7 +497,7 @@ int UtcDaliGetClosestCursorIndex(void)
                                       CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP };
   CharacterIndex logicalIndex06[] = {    0,  10u,  20u,  30u,  40u,  45u,
                                        46u,  50u,  60u,  70u,  80u,  92u,
-                                       93u, 100u, 110u, 121u, 131u, 138u,
+                                       93u, 100u, 110u, 120u, 130u, 138u,
                                       139u, 150u, 160u, 170u, 180u, 185u,
                                       186u, 190u, 200u, 210u, 220u, 231u,
                                       232u, 240u, 250u, 260u, 265u  };
index f27f4d7..8c934d3 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;
 
@@ -101,18 +100,19 @@ bool LayoutTextTest( const LayoutTextData& data )
   }
 
   LayoutOptions options;
-  options.reorder = false;
   options.align = false;
   CreateTextModel( data.text,
                    data.textArea,
                    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 +158,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;
 
@@ -190,8 +177,6 @@ bool LayoutTextTest( const LayoutTextData& data )
 
   bool isAutoScroll = false;
   const bool updated = engine.LayoutText( layoutParameters,
-                                          glyphPositions,
-                                          lines,
                                           layoutSize,
                                           data.ellipsis,
                                           isAutoScroll );
@@ -325,120 +310,6 @@ bool LayoutTextTest( const LayoutTextData& data )
 
 //////////////////////////////////////////////////////////
 
-struct ReLayoutRightToLeftLinesData
-{
-  std::string         description;
-  std::string         text;
-  Size                textArea;
-  unsigned int        numberOfFonts;
-  FontDescriptionRun* fontDescriptions;
-  unsigned int        totalNumberOfGlyphs;
-  float*              positions;
-  unsigned int        startIndex;
-  unsigned int        numberOfCharacters;
-};
-
-bool ReLayoutRightToLeftLinesTest( const ReLayoutRightToLeftLinesData& data )
-{
-  // Load some fonts.
-  TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
-  fontClient.SetDpi( 96u, 96u );
-
-  char* pathNamePtr = get_current_dir_name();
-  const std::string pathName( pathNamePtr );
-  free( pathNamePtr );
-
-  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
-  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
-  fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
-
-  // 1) Create the model.
-  LogicalModelPtr logicalModel;
-  VisualModelPtr visualModel;
-  MetricsPtr metrics;
-  Size layoutSize;
-
-  Vector<FontDescriptionRun> fontDescriptionRuns;
-  if( 0u != data.numberOfFonts )
-  {
-    fontDescriptionRuns.Insert( fontDescriptionRuns.End(),
-                                data.fontDescriptions,
-                                data.fontDescriptions + data.numberOfFonts );
-  }
-
-  LayoutOptions options;
-  options.reorder = false;
-  options.align = false;
-  CreateTextModel( data.text,
-                   data.textArea,
-                   fontDescriptionRuns,
-                   options,
-                   layoutSize,
-                   logicalModel,
-                   visualModel,
-                   metrics,
-                   false );
-
-  // 2) Call the ReLayoutRightToLeftLines() method.
-  Layout::Engine engine;
-  engine.SetMetrics( metrics );
-
-  float outlineWidth = visualModel->GetOutlineWidth();
-  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 );
-
-  layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
-  layoutParameters.lineBidirectionalInfoRunsBuffer = logicalModel->mBidirectionalLineInfo.Begin();
-
-  engine.ReLayoutRightToLeftLines( layoutParameters,
-                                   data.startIndex,
-                                   data.numberOfCharacters,
-                                   visualModel->mGlyphPositions );
-
-  // 3) Compare the results.
-  Vector<Vector2>& glyphPositions = visualModel->mGlyphPositions;
-
-  if( data.totalNumberOfGlyphs != visualModel->mGlyphs.Count() )
-  {
-    std::cout << "  Different number of glyphs : " << visualModel->mGlyphs.Count() << ", expected : " << data.totalNumberOfGlyphs << std::endl;
-    return false;
-  }
-
-  for( unsigned int index = 0u; index < data.totalNumberOfGlyphs; ++index )
-  {
-    const Vector2& position = *( glyphPositions.Begin() + index );
-
-    if( fabsf( position.x - *( data.positions + 2u * index ) ) > Math::MACHINE_EPSILON_1000 )
-    {
-      std::cout << "  Different position for glyph " << index << " x : " << position.x << ", expected : " << *( data.positions + 2u * index ) << std::endl;
-      return false;
-    }
-    if( fabsf( position.y - *( data.positions + 2u * index + 1u ) ) > Math::MACHINE_EPSILON_1000 )
-    {
-      std::cout << "  Different position for glyph " << index << " y : " << position.y << ", expected : " << *( data.positions + 2u * index + 1u ) << std::endl;
-      return false;
-    }
-  }
-
-  return true;
-}
-
-//////////////////////////////////////////////////////////
-
 struct AlignData
 {
   std::string                       description;
@@ -471,8 +342,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 +361,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 );
@@ -548,6 +420,7 @@ bool AlignTest( const AlignData& data )
 // UtcDaliTextLayoutMultilineText03
 // UtcDaliTextLayoutMultilineText04
 // UtcDaliTextLayoutMultilineText05
+// UtcDaliTextLayoutMultilineText06
 // UtcDaliTextUpdateLayout01
 // UtcDaliTextUpdateLayout02
 // UtcDaliTextUpdateLayout03
@@ -1004,12 +877,12 @@ int UtcDaliTextLayoutMultilineText02(void)
   Size layoutSize(78.f, 114.f);
   float positions[] =
   {
-    0.f, -12.f, 10.f,  -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f,  -0.f, 39.f,  -9.f, 50.f,  -9.f, 60.f,  -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
-    0.f, -13.f,  9.f,  -9.f, 18.f,  -9.f, 30.f,  -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f,  -0.f,
-    0.f, -10.f,  8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -2.f, 32.f, -12.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f,  -0.f,
-    0.f, -13.f,  8.f,  -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f,  -0.f, 37.f,  -9.f, 48.f,  -9.f, 58.f,  -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -13.f,  9.f,  -9.f, 18.f,  -9.f, 30.f,  -9.f, 39.f, -2.f,
+    0.f, -12.f, 10.f,  -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f,  -0.f, 39.f,  -9.f, 50.f,  -9.f, 60.f,  -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,  //  0 .. 11
+    0.f, -13.f,  9.f,  -9.f, 18.f,  -9.f, 30.f,  -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f,  -0.f,                           // 12 .. 21
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f,                                                                                // 22 .. 27
+    59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f,  -0.f,                            // 28 .. 37
+    4.f, -13.f,  12.f,  -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f,  -0.f, 41.f,  -9.f, 52.f,  -9.f, 62.f,  -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f,  // 38 .. 49
+    3.f, -13.f,  12.f,  -9.f, 21.f,  -9.f, 33.f,  -9.f, 0.f, -2.f,                                                                                            // 50 .. 54
   };
   struct LineRun line0 =
   {
@@ -1028,7 +901,7 @@ int UtcDaliTextLayoutMultilineText02(void)
   {
     { 12u, 10u },
     { 12u, 10u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -1054,7 +927,7 @@ int UtcDaliTextLayoutMultilineText02(void)
   {
     { 28u, 10u },
     { 28u, 10u },
-    65.f,
+    64.f,
     15.f,
     -4.f,
     4.f,
@@ -1433,6 +1306,197 @@ int UtcDaliTextLayoutMultilineText05(void)
   END_TEST;
 }
 
+int UtcDaliTextLayoutMultilineText06(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextLayoutMultilineText06");
+
+  const std::string fontFamily( "TizenSansHebrew" );
+
+  // Set a known font description
+  FontDescriptionRun fontDescriptionRun;
+  fontDescriptionRun.characterRun.characterIndex = 0u;
+  fontDescriptionRun.characterRun.numberOfCharacters = 10u;
+  fontDescriptionRun.familyLength = fontFamily.size();
+  fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+  memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+  fontDescriptionRun.familyDefined = true;
+  fontDescriptionRun.weightDefined = false;
+  fontDescriptionRun.widthDefined = false;
+  fontDescriptionRun.slantDefined = false;
+  fontDescriptionRun.sizeDefined = false;
+
+  Vector<FontDescriptionRun> fontDescriptionRuns;
+  fontDescriptionRuns.PushBack( fontDescriptionRun );
+
+  Size textArea(64.f, 100.f);
+  Size layoutSize(31.f, 38.f);
+  float positions[] =
+  {
+    26.f, -13.f, 17.f, -10.f, 8.f, -10.f, 4.f, -10.f, 0.f, -0.f,
+    22.f, -10.f, 17.f, -10.f, 12.f, -10.f, 4.f, -10.f, 0.f, -10.f
+  };
+  struct LineRun line0 =
+  {
+    { 0u, 5u },
+    { 0u, 5u },
+    30.f,
+    15.f,
+    -4.f,
+    4.f,
+    0.f,
+    0.f,
+    true,
+    false
+  };
+  struct LineRun line1 =
+  {
+    { 5u, 5u },
+    { 5u, 5u },
+    31.f,
+    15.f,
+    -4.f,
+    0.f,
+    0.f,
+    0.f,
+    true,
+    false
+  };
+  Vector<LineRun> lines;
+  lines.PushBack( line0 );
+  lines.PushBack( line1 );
+
+  LayoutTextData data =
+  {
+    "Layout right to left text that doesn't fit in the text area after reordering.",
+    "לכאן שנורו", // If this text is laid-out ltr the width is 64. When reordered, the length is 66. This might cause alignment issues.
+    textArea,
+    1u,
+    fontDescriptionRuns.Begin(),
+    layoutSize,
+    10u,
+    positions,
+    2u,
+    lines.Begin(),
+    Layout::Engine::MULTI_LINE_BOX,
+    0u,
+    10u,
+    false,
+    true
+  };
+
+  if( !LayoutTextTest( data ) )
+  {
+    tet_result(TET_FAIL);
+  }
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
+
+int UtcDaliTextLayoutMultilineText07(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextLayoutMultilineText07");
+
+  const std::string fontFamily( "TizenSansHebrew" );
+
+  // Set a known font description
+  FontDescriptionRun fontDescriptionRun;
+  fontDescriptionRun.characterRun.characterIndex = 0u;
+  fontDescriptionRun.characterRun.numberOfCharacters = 9u;
+  fontDescriptionRun.familyLength = fontFamily.size();
+  fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+  memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+  fontDescriptionRun.familyDefined = true;
+  fontDescriptionRun.weightDefined = false;
+  fontDescriptionRun.widthDefined = false;
+  fontDescriptionRun.slantDefined = false;
+  fontDescriptionRun.sizeDefined = false;
+
+  Vector<FontDescriptionRun> fontDescriptionRuns;
+  fontDescriptionRuns.PushBack( fontDescriptionRun );
+
+  Size textArea(26.f, 100.f);
+  Size layoutSize(21.f, 57.f);
+  float positions[] =
+  {
+    10.f, -10.f, 5.f, -10.f, 0.f, -10.f,
+    11.f, -10.f, 7.f, -10.f, 0.f, -13.f,
+    13.f, -10.f, 4.f, -10.f, 0.f, -10.f
+  };
+  struct LineRun line0 =
+  {
+    { 0u, 3u },
+    { 0u, 3u },
+    19.f,
+    15.f,
+    -4.f,
+    0.f,
+    0.f,
+    0.f,
+    true,
+    false
+  };
+  struct LineRun line1 =
+  {
+    { 3u, 3u },
+    { 3u, 3u },
+    18.f,
+    15.f,
+    -4.f,
+    0.f,
+    0.f,
+    0.f,
+    true,
+    false
+  };
+  struct LineRun line2 =
+  {
+    { 6u, 3u },
+    { 6u, 3u },
+    21.f,
+    15.f,
+    -4.f,
+    0.f,
+    0.f,
+    0.f,
+    true,
+    false
+  };
+  Vector<LineRun> lines;
+  lines.PushBack( line0 );
+  lines.PushBack( line1 );
+  lines.PushBack( line2 );
+
+  LayoutTextData data =
+  {
+    "Layout a single word of right to left text that doesn't fit in one single line. When layouting ltr a piece of word fits in the line but it doesn't after reordering.",
+    "שנורולכאן", // If a piece of this text is laid-out ltr the width is 26. When reordered, the length is 27. This might cause alignment issues.
+    textArea,
+    1u,
+    fontDescriptionRuns.Begin(),
+    layoutSize,
+    9u,
+    positions,
+    3u,
+    lines.Begin(),
+    Layout::Engine::MULTI_LINE_BOX,
+    0u,
+    9u,
+    false,
+    true
+  };
+
+  if( !LayoutTextTest( data ) )
+  {
+    tet_result(TET_FAIL);
+  }
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
+
 int UtcDaliTextUpdateLayout01(void)
 {
   ToolkitTestApplication application;
@@ -1684,27 +1748,27 @@ int UtcDaliTextUpdateLayout01(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun16 );
   fontDescriptionRuns.PushBack( fontDescriptionRun17 );
   Size textArea(100.f, 300.f);
-  Size layoutSize(92.f, 361.f);
+  Size layoutSize(90.f, 361.f);
   float positions[] =
   {
-    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -2.f, 32.f, -12.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -13.f, 67.f, -9.f, 76.f, -13.f, 80.f, -13.f, 83.f, -9.f, 92.f, -0.f,
-    0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f, 42.f, -12.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -2.f, 32.f, -12.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
+    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,                                                                                                     //   0 ..  11
+    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f,                                                                                                                             //  12 ..  21
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f,                                                                                                                                                                              //  22 ..  27
+    87.f, -8.f, 82.f, -6.f, 75.f, -8.f, 72.f, -7.f, 71.f, -11.f, 67.f, -0.f, 63.f, -7.f, 62.f, -11.f, 57.f, -11.f, 51.f, -8.f, 50.f, -11.f, 45.f, -11.f, 40.f, -8.f, 37.f, -0.f, 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 0.f, -0.f,   //  28 ..  47
+    39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 35.f, -0.f, 25.f, -10.f, 17.f, -13.f, 12.f, -10.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                 //  48 ..  58
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 0.f, -0.f,                                                                                                                                                                                            //  59 ..  63
+    59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                           //  64 ..  73
+    4.f, -13.f,  12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f,                                                                                                     //  74 ..  85
+    3.f, -13.f,  12.f, -9.f, 21.f, -9.f, 33.f, -9.f, 0.f, -2.f, 0.f, -12.f,                                                                                                                                                                                 //  86 ..  91
+    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,                                                                                                     //  92 .. 103
+    81.f, -8.f, 76.f, -6.f, 69.f, -8.f, 66.f, -7.f, 65.f, -11.f, 61.f, -0.f, 57.f, -7.f, 56.f, -11.f, 51.f, -11.f, 45.f, -8.f, 44.f, -11.f, 39.f, -11.f, 34.f, -8.f, 31.f, -0.f, 21.f, -10.f, 13.f, -13.f, 8.f, -10.f, 0.f, -10.f, 88.f, -0.f,              // 104 .. 122
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -0.f,                                                                                                                                                                                           // 123 .. 127
+    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,                                                                                                     // 128 .. 139
+    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f,                                                                                                                             // 140 .. 149
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f,                                                                                                                                                                              // 150 .. 155
+    59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                           // 156 .. 165
+    4.f, -13.f,  12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f,                                                                                                     // 166 .. 177
+    47.f, -8.f, 42.f, -6.f, 35.f, -8.f, 32.f, -7.f, 31.f, -11.f, 27.f, -0.f, 23.f, -7.f, 22.f, -11.f, 17.f, -11.f, 11.f, -8.f, 10.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f,                                                                               // 178 .. 191
   };
 
   struct LineRun line01 =
@@ -1724,7 +1788,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 12u, 10u },
     { 12u, 10u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -1750,7 +1814,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 28u, 20u },
     { 28u, 20u },
-    92.f,
+    90.f,
     15.f,
     -4.f,
     4.f,
@@ -1763,7 +1827,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 48u, 11u },
     { 48u, 11u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -1776,7 +1840,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 59u, 5u },
     { 59u, 5u },
-    29.f,
+    28.f,
     15.f,
     -4.f,
     0.f,
@@ -1789,7 +1853,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 64u, 10u },
     { 64u, 10u },
-    65.f,
+    64.f,
     15.f,
     -4.f,
     4.f,
@@ -1841,7 +1905,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 104u, 19u },
     { 104u, 19u },
-    90.f,
+    88.f,
     15.f,
     -4.f,
     4.f,
@@ -1854,7 +1918,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 123u, 5u },
     { 123u, 5u },
-    29.f,
+    28.f,
     15.f,
     -4.f,
     0.f,
@@ -1880,7 +1944,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 140u, 10u },
     { 140u, 10u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -1906,7 +1970,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 156u, 10u },
     { 156u, 10u },
-    65.f,
+    64.f,
     15.f,
     -4.f,
     4.f,
@@ -1932,7 +1996,7 @@ int UtcDaliTextUpdateLayout01(void)
   {
     { 178u, 14u },
     { 178u, 14u },
-    56.f,
+    54.f,
     15.f,
     -4.f,
     0.f,
@@ -2259,27 +2323,27 @@ int UtcDaliTextUpdateLayout02(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun16 );
   fontDescriptionRuns.PushBack( fontDescriptionRun17 );
   Size textArea(100.f, 300.f);
-  Size layoutSize(92.f, 361.f);
+  Size layoutSize(90.f, 361.f);
   float positions[] =
   {
-    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -2.f, 32.f, -12.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -13.f, 67.f, -9.f, 76.f, -13.f, 80.f, -13.f, 83.f, -9.f, 92.f, -0.f,
-    0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f, 42.f, -12.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -2.f, 32.f, -12.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
+    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,                                                                                                     //   0 ..  11
+    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f,                                                                                                                             //  12 ..  21
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f,                                                                                                                                                                              //  22 ..  27
+    87.f, -8.f, 82.f, -6.f, 75.f, -8.f, 72.f, -7.f, 71.f, -11.f, 67.f, -0.f, 63.f, -7.f, 62.f, -11.f, 57.f, -11.f, 51.f, -8.f, 50.f, -11.f, 45.f, -11.f, 40.f, -8.f, 37.f, -0.f, 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 0.f, -0.f,   //  28 ..  47
+    39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 35.f, -0.f, 25.f, -10.f, 17.f, -13.f, 12.f, -10.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                 //  48 ..  58
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 0.f, -0.f,                                                                                                                                                                                            //  59 ..  63
+    59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                           //  64 ..  73
+    4.f, -13.f,  12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f,                                                                                                     //  74 ..  85
+    3.f, -13.f,  12.f, -9.f, 21.f, -9.f, 33.f, -9.f, 0.f, -2.f, 0.f, -12.f,                                                                                                                                                                                 //  86 ..  91
+    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,                                                                                                     //  92 .. 103
+    81.f, -8.f, 76.f, -6.f, 69.f, -8.f, 66.f, -7.f, 65.f, -11.f, 61.f, -0.f, 57.f, -7.f, 56.f, -11.f, 51.f, -11.f, 45.f, -8.f, 44.f, -11.f, 39.f, -11.f, 34.f, -8.f, 31.f, -0.f, 21.f, -10.f, 13.f, -13.f, 8.f, -10.f, 0.f, -10.f, 88.f, -0.f,              // 104 .. 122
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -0.f,                                                                                                                                                                                           // 123 .. 127
+    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,                                                                                                     // 128 .. 139
+    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f,                                                                                                                             // 140 .. 149
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f,                                                                                                                                                                              // 150 .. 155
+    59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                           // 156 .. 165
+    4.f, -13.f,  12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f,                                                                                                     // 166 .. 177
+    47.f, -8.f, 42.f, -6.f, 35.f, -8.f, 32.f, -7.f, 31.f, -11.f, 27.f, -0.f, 23.f, -7.f, 22.f, -11.f, 17.f, -11.f, 11.f, -8.f, 10.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f,                                                                               // 178 .. 191
   };
 
   struct LineRun line01 =
@@ -2299,7 +2363,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 12u, 10u },
     { 12u, 10u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -2325,7 +2389,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 28u, 20u },
     { 28u, 20u },
-    92.f,
+    90.f,
     15.f,
     -4.f,
     4.f,
@@ -2338,7 +2402,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 48u, 11u },
     { 48u, 11u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -2351,7 +2415,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 59u, 5u },
     { 59u, 5u },
-    29.f,
+    28.f,
     15.f,
     -4.f,
     0.f,
@@ -2364,7 +2428,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 64u, 10u },
     { 64u, 10u },
-    65.f,
+    64.f,
     15.f,
     -4.f,
     4.f,
@@ -2416,7 +2480,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 104u, 19u },
     { 104u, 19u },
-    90.f,
+    88.f,
     15.f,
     -4.f,
     4.f,
@@ -2429,7 +2493,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 123u, 5u },
     { 123u, 5u },
-    29.f,
+    28.f,
     15.f,
     -4.f,
     0.f,
@@ -2455,7 +2519,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 140u, 10u },
     { 140u, 10u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -2481,7 +2545,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 156u, 10u },
     { 156u, 10u },
-    65.f,
+    64.f,
     15.f,
     -4.f,
     4.f,
@@ -2507,7 +2571,7 @@ int UtcDaliTextUpdateLayout02(void)
   {
     { 178u, 14u },
     { 178u, 14u },
-    56.f,
+    54.f,
     15.f,
     -4.f,
     0.f,
@@ -2834,27 +2898,27 @@ int UtcDaliTextUpdateLayout03(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun16 );
   fontDescriptionRuns.PushBack( fontDescriptionRun17 );
   Size textArea(100.f, 300.f);
-  Size layoutSize(92.f, 361.f);
+  Size layoutSize(90.f, 361.f);
   float positions[] =
   {
-    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -2.f, 32.f, -12.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -13.f, 67.f, -9.f, 76.f, -13.f, 80.f, -13.f, 83.f, -9.f, 92.f, -0.f,
-    0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f, 42.f, -12.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
-    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -2.f, 32.f, -12.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f,
-    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
+    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,                                                                                                     //   0 ..  11
+    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f,                                                                                                                             //  12 ..  21
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f,                                                                                                                                                                              //  22 ..  27
+    87.f, -8.f, 82.f, -6.f, 75.f, -8.f, 72.f, -7.f, 71.f, -11.f, 67.f, -0.f, 63.f, -7.f, 62.f, -11.f, 57.f, -11.f, 51.f, -8.f, 50.f, -11.f, 45.f, -11.f, 40.f, -8.f, 37.f, -0.f, 4.f, -13.f, 12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 0.f, -0.f,   //  28 ..  47
+    39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 35.f, -0.f, 25.f, -10.f, 17.f, -13.f, 12.f, -10.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                 //  48 ..  58
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 0.f, -0.f,                                                                                                                                                                                            //  59 ..  63
+    59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                           //  64 ..  73
+    4.f, -13.f,  12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f,                                                                                                     //  74 ..  85
+    3.f, -13.f,  12.f, -9.f, 21.f, -9.f, 33.f, -9.f, 0.f, -2.f, 0.f, -12.f,                                                                                                                                                                                 //  86 ..  91
+    0.f, -13.f,  8.f, -9.f, 17.f, -13.f, 21.f, -13.f, 24.f, -9.f, 33.f, -0.f, 37.f, -9.f, 48.f, -9.f, 58.f, -9.f, 64.f, -13.f, 67.f, -13.f, 76.f, -0.f,                                                                                                     //  92 .. 103
+    81.f, -8.f, 76.f, -6.f, 69.f, -8.f, 66.f, -7.f, 65.f, -11.f, 61.f, -0.f, 57.f, -7.f, 56.f, -11.f, 51.f, -11.f, 45.f, -8.f, 44.f, -11.f, 39.f, -11.f, 34.f, -8.f, 31.f, -0.f, 21.f, -10.f, 13.f, -13.f, 8.f, -10.f, 0.f, -10.f, 88.f, -0.f,              // 104 .. 122
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -0.f,                                                                                                                                                                                           // 123 .. 127
+    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,                                                                                                     // 128 .. 139
+    0.f, -13.f,  9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 65.f, -10.f, 57.f, -13.f, 52.f, -10.f, 44.f, -10.f, 75.f, -0.f,                                                                                                                             // 140 .. 149
+    21.f, -10.f, 16.f, -10.f, 9.f, -13.f, 0.f, -10.f, 29.f, -2.f, 32.f, -12.f,                                                                                                                                                                              // 150 .. 155
+    59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f,                                                                                                                           // 156 .. 165
+    4.f, -13.f,  12.f, -9.f, 21.f, -13.f, 25.f, -13.f, 28.f, -9.f, 37.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 0.f, -0.f,                                                                                                     // 166 .. 177
+    47.f, -8.f, 42.f, -6.f, 35.f, -8.f, 32.f, -7.f, 31.f, -11.f, 27.f, -0.f, 23.f, -7.f, 22.f, -11.f, 17.f, -11.f, 11.f, -8.f, 10.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f,                                                                               // 178 .. 191
   };
 
   struct LineRun line01 =
@@ -2874,7 +2938,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 12u, 10u },
     { 12u, 10u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -2900,7 +2964,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 28u, 20u },
     { 28u, 20u },
-    92.f,
+    90.f,
     15.f,
     -4.f,
     4.f,
@@ -2913,7 +2977,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 48u, 11u },
     { 48u, 11u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -2926,7 +2990,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 59u, 5u },
     { 59u, 5u },
-    29.f,
+    28.f,
     15.f,
     -4.f,
     0.f,
@@ -2939,7 +3003,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 64u, 10u },
     { 64u, 10u },
-    65.f,
+    64.f,
     15.f,
     -4.f,
     4.f,
@@ -2991,7 +3055,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 104u, 19u },
     { 104u, 19u },
-    90.f,
+    88.f,
     15.f,
     -4.f,
     4.f,
@@ -3004,7 +3068,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 123u, 5u },
     { 123u, 5u },
-    29.f,
+    28.f,
     15.f,
     -4.f,
     0.f,
@@ -3030,7 +3094,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 140u, 10u },
     { 140u, 10u },
-    75.f,
+    74.f,
     15.f,
     -4.f,
     4.f,
@@ -3056,7 +3120,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 156u, 10u },
     { 156u, 10u },
-    65.f,
+    64.f,
     15.f,
     -4.f,
     4.f,
@@ -3082,7 +3146,7 @@ int UtcDaliTextUpdateLayout03(void)
   {
     { 178u, 14u },
     { 178u, 14u },
-    56.f,
+    54.f,
     15.f,
     -4.f,
     0.f,
@@ -3422,7 +3486,7 @@ int UtcDaliTextLayoutEllipsis03(void)
   {
     { 0u, 17u },
     { 0u, 17u },
-    99.f,
+    100.f,
     15.f,
     -4.f,
     0.f,
@@ -3436,7 +3500,7 @@ int UtcDaliTextLayoutEllipsis03(void)
 
   float positions[] =
   {
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f, 68.f, -8.f, 75.f, -6.f, 80.f, -8.f, 86.f, -7.f, 91.f, -11.f, 93.f, -0.f,
+    91.f, -10.f, 83.f, -13.f, 78.f, -10.f, 70.f, -10.f, 65.f, -0.f, 57.f, -10.f, 52.f, -10.f, 45.f, -13.f, 36.f, -10.f, 31.f, -0.f, 24.f, -8.f, 19.f, -6.f, 12.f, -8.f, 9.f, -7.f, 8.f, -11.f, 4.f, -0.f,
   };
 
   Size textArea( 100.f, 50.f );
@@ -3565,7 +3629,7 @@ int UtcDaliTextLayoutEllipsis04(void)
   {
     { 0u, 16u },
     { 0u, 16u },
-    94.f,
+    92.f,
     15.f,
     -4.f,
     3.f,
@@ -3578,7 +3642,7 @@ int UtcDaliTextLayoutEllipsis04(void)
   {
     { 16u, 18u },
     { 16u, 18u },
-    97.f,
+    95.f,
     15.f,
     -4.f,
     4.f,
@@ -3593,8 +3657,8 @@ int UtcDaliTextLayoutEllipsis04(void)
 
   float positions[] =
   {
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f, 68.f, -8.f, 75.f, -6.f, 80.f, -8.f, 86.f, -7.f, 91.f, -11.f, 93.f, -0.f,
-    0.f, -7.f, 5.f, -11.f, 6.f, -11.f, 9.f, -8.f, 17.f, -11.f, 18.f, -11.f, 22.f, -8.f, 28.f, -0.f, 32.f, -10.f, 43.f, -13.f, 50.f, -10.f, 55.f, -10.f, 63.f, -0.f, 68.f, -10.f, 76.f, -10.f, 81.f, -13.f, 89.f, -10.f, 97.f, -0.f,
+    86.f, -10.f, 78.f, -13.f, 73.f, -10.f, 65.f, -10.f, 60.f, -0.f, 52.f, -10.f, 47.f, -10.f, 40.f, -13.f, 31.f, -10.f, 26.f, -0.f, 19.f, -8.f, 14.f, -6.f, 7.f, -8.f, 4.f, -7.f, 3.f, -11.f, 0.f, -0.f,
+    95.f, -7.f, 94.f, -11.f, 89.f, -11.f, 83.f, -8.f, 82.f, -11.f, 77.f, -11.f, 72.f, -8.f, 69.f, -0.f, 59.f, -10.f, 51.f, -13.f, 46.f, -10.f, 38.f, -10.f, 33.f, -0.f, 25.f, -10.f, 20.f, -10.f, 13.f, -13.f, 4.f, -10.f, 0.f, -0.f,
   };
 
   Size textArea( 100.f, 50.f );
@@ -3602,7 +3666,7 @@ int UtcDaliTextLayoutEllipsis04(void)
 
   LayoutTextData data =
   {
-    "Layout single-line RTL text with ellipsis.",
+    "Layout multi-line RTL text with ellipsis.",
     "שלום עולם مرحبا بالعالم שלום עולם مرحبا بالعالم שלום עולם مرحبا بالعالم.",
     textArea,
     6u,
@@ -3703,441 +3767,6 @@ int UtcDaliTextLayoutEllipsis05(void)
   END_TEST;
 }
 
-int UtcDaliTextReorderLayout01(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliTextReorderLayout01");
-
-  // Reorder lines. No right to left characters.
-
-  const std::string fontLatin( "TizenSans" );
-
-  // Set a known font description
-  FontDescriptionRun fontDescriptionRun01;
-  fontDescriptionRun01.characterRun.characterIndex = 0u;
-  fontDescriptionRun01.characterRun.numberOfCharacters = 11u;
-  fontDescriptionRun01.familyLength = fontLatin.size();
-  fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength];
-  memcpy( fontDescriptionRun01.familyName, fontLatin.c_str(), fontDescriptionRun01.familyLength );
-  fontDescriptionRun01.familyDefined = true;
-  fontDescriptionRun01.weightDefined = false;
-  fontDescriptionRun01.widthDefined = false;
-  fontDescriptionRun01.slantDefined = false;
-  fontDescriptionRun01.sizeDefined = false;
-
-  Vector<FontDescriptionRun> fontDescriptionRuns;
-  fontDescriptionRuns.PushBack( fontDescriptionRun01 );
-
-  float positions[] =
-  {
-    0.f, -12.f, 10.f, -9.f, 19.f, -13.f, 23.f, -13.f, 26.f, -9.f, 35.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f,
-  };
-
-  Size textArea( 100.f, 300.f );
-
-  ReLayoutRightToLeftLinesData data =
-  {
-    "Text with no right to left text.",
-    "Hello world",
-    textArea,
-    1u,
-    fontDescriptionRuns.Begin(),
-    11u,
-    positions,
-    0u,
-    11u
-  };
-
-  if( !ReLayoutRightToLeftLinesTest( data ) )
-  {
-    tet_result(TET_FAIL);
-  }
-
-  tet_result(TET_PASS);
-  END_TEST;
-}
-
-int UtcDaliTextReorderLayout02(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliTextReorderLayout02");
-
-  // Reorder lines of the first paragraph.
-
-  const std::string fontHebrew( "TizenSansHebrew" );
-  const std::string fontArabic( "TizenSansArabic" );
-
-  // Set a known font description
-  FontDescriptionRun fontDescriptionRun01;
-  fontDescriptionRun01.characterRun.characterIndex = 0u;
-  fontDescriptionRun01.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun01.familyLength = fontHebrew.size();
-  fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength];
-  memcpy( fontDescriptionRun01.familyName, fontHebrew.c_str(), fontDescriptionRun01.familyLength );
-  fontDescriptionRun01.familyDefined = true;
-  fontDescriptionRun01.weightDefined = false;
-  fontDescriptionRun01.widthDefined = false;
-  fontDescriptionRun01.slantDefined = false;
-  fontDescriptionRun01.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun02;
-  fontDescriptionRun02.characterRun.characterIndex = 10u;
-  fontDescriptionRun02.characterRun.numberOfCharacters = 14u;
-  fontDescriptionRun02.familyLength = fontArabic.size();
-  fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength];
-  memcpy( fontDescriptionRun02.familyName, fontArabic.c_str(), fontDescriptionRun02.familyLength );
-  fontDescriptionRun02.familyDefined = true;
-  fontDescriptionRun02.weightDefined = false;
-  fontDescriptionRun02.widthDefined = false;
-  fontDescriptionRun02.slantDefined = false;
-  fontDescriptionRun02.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun03;
-  fontDescriptionRun03.characterRun.characterIndex = 24u;
-  fontDescriptionRun03.characterRun.numberOfCharacters = 14u;
-  fontDescriptionRun03.familyLength = fontArabic.size();
-  fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength];
-  memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength );
-  fontDescriptionRun03.familyDefined = true;
-  fontDescriptionRun03.weightDefined = false;
-  fontDescriptionRun03.widthDefined = false;
-  fontDescriptionRun03.slantDefined = false;
-  fontDescriptionRun03.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun04;
-  fontDescriptionRun04.characterRun.characterIndex = 38u;
-  fontDescriptionRun04.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun04.familyLength = fontHebrew.size();
-  fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength];
-  memcpy( fontDescriptionRun04.familyName, fontHebrew.c_str(), fontDescriptionRun04.familyLength );
-  fontDescriptionRun04.familyDefined = true;
-  fontDescriptionRun04.weightDefined = false;
-  fontDescriptionRun04.widthDefined = false;
-  fontDescriptionRun04.slantDefined = false;
-  fontDescriptionRun04.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun05;
-  fontDescriptionRun05.characterRun.characterIndex = 48u;
-  fontDescriptionRun05.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun05.familyLength = fontHebrew.size();
-  fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength];
-  memcpy( fontDescriptionRun05.familyName, fontHebrew.c_str(), fontDescriptionRun05.familyLength );
-  fontDescriptionRun05.familyDefined = true;
-  fontDescriptionRun05.weightDefined = false;
-  fontDescriptionRun05.widthDefined = false;
-  fontDescriptionRun05.slantDefined = false;
-  fontDescriptionRun05.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun06;
-  fontDescriptionRun06.characterRun.characterIndex = 58u;
-  fontDescriptionRun06.characterRun.numberOfCharacters = 15u;
-  fontDescriptionRun06.familyLength = fontArabic.size();
-  fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength];
-  memcpy( fontDescriptionRun06.familyName, fontArabic.c_str(), fontDescriptionRun06.familyLength );
-  fontDescriptionRun06.familyDefined = true;
-  fontDescriptionRun06.weightDefined = false;
-  fontDescriptionRun06.widthDefined = false;
-  fontDescriptionRun06.slantDefined = false;
-  fontDescriptionRun06.sizeDefined = false;
-
-  Vector<FontDescriptionRun> fontDescriptionRuns;
-  fontDescriptionRuns.PushBack( fontDescriptionRun01 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun02 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun03 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun04 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun05 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun06 );
-
-  float positions[] =
-  {
-    87.f, -10.f, 79.f, -13.f, 74.f, -10.f, 66.f, -10.f, 61.f, -0.f, 53.f, -10.f, 48.f, -10.f, 41.f, -13.f, 32.f, -10.f, 27.f, -0.f, 20.f, -8.f, 15.f, -6.f, 8.f, -8.f, 5.f, -7.f, 4.f, -11.f, 0.f, -0.f,
-    23.f, -7.f, 22.f, -11.f, 17.f, -11.f, 11.f, -8.f, 10.f, -11.f, 5.f, -11.f, 0.f, -8.f, 0.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f, 68.f, -8.f, 75.f, -6.f, 80.f, -8.f, 86.f, -7.f, 91.f, -11.f, 93.f, -0.f,
-    0.f, -7.f, 5.f, -11.f, 6.f, -11.f, 9.f, -8.f, 17.f, -11.f, 18.f, -11.f, 22.f, -8.f, 30.f, -2.f,
-  };
-
-  Size textArea( 100.f, 300.f );
-
-  ReLayoutRightToLeftLinesData data =
-  {
-    "Paragraphs with right to left text.",
-    "שלום עולם مرحبا بالعالم\n"
-    "مرحبا بالعالم שלום עולם\n"
-    "שלום עולם مرحبا بالعالم.",
-    textArea,
-    6u,
-    fontDescriptionRuns.Begin(),
-    72u,
-    positions,
-    0u,
-    24u
-  };
-
-  if( !ReLayoutRightToLeftLinesTest( data ) )
-  {
-    tet_result(TET_FAIL);
-  }
-
-  tet_result(TET_PASS);
-  END_TEST;
-}
-
-int UtcDaliTextReorderLayout03(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliTextReorderLayout03");
-
-  // Reorder lines of the mid paragraph.
-
-  const std::string fontHebrew( "TizenSansHebrew" );
-  const std::string fontArabic( "TizenSansArabic" );
-
-  // Set a known font description
-  FontDescriptionRun fontDescriptionRun01;
-  fontDescriptionRun01.characterRun.characterIndex = 0u;
-  fontDescriptionRun01.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun01.familyLength = fontHebrew.size();
-  fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength];
-  memcpy( fontDescriptionRun01.familyName, fontHebrew.c_str(), fontDescriptionRun01.familyLength );
-  fontDescriptionRun01.familyDefined = true;
-  fontDescriptionRun01.weightDefined = false;
-  fontDescriptionRun01.widthDefined = false;
-  fontDescriptionRun01.slantDefined = false;
-  fontDescriptionRun01.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun02;
-  fontDescriptionRun02.characterRun.characterIndex = 10u;
-  fontDescriptionRun02.characterRun.numberOfCharacters = 14u;
-  fontDescriptionRun02.familyLength = fontArabic.size();
-  fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength];
-  memcpy( fontDescriptionRun02.familyName, fontArabic.c_str(), fontDescriptionRun02.familyLength );
-  fontDescriptionRun02.familyDefined = true;
-  fontDescriptionRun02.weightDefined = false;
-  fontDescriptionRun02.widthDefined = false;
-  fontDescriptionRun02.slantDefined = false;
-  fontDescriptionRun02.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun03;
-  fontDescriptionRun03.characterRun.characterIndex = 24u;
-  fontDescriptionRun03.characterRun.numberOfCharacters = 14u;
-  fontDescriptionRun03.familyLength = fontArabic.size();
-  fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength];
-  memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength );
-  fontDescriptionRun03.familyDefined = true;
-  fontDescriptionRun03.weightDefined = false;
-  fontDescriptionRun03.widthDefined = false;
-  fontDescriptionRun03.slantDefined = false;
-  fontDescriptionRun03.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun04;
-  fontDescriptionRun04.characterRun.characterIndex = 38u;
-  fontDescriptionRun04.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun04.familyLength = fontHebrew.size();
-  fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength];
-  memcpy( fontDescriptionRun04.familyName, fontHebrew.c_str(), fontDescriptionRun04.familyLength );
-  fontDescriptionRun04.familyDefined = true;
-  fontDescriptionRun04.weightDefined = false;
-  fontDescriptionRun04.widthDefined = false;
-  fontDescriptionRun04.slantDefined = false;
-  fontDescriptionRun04.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun05;
-  fontDescriptionRun05.characterRun.characterIndex = 48u;
-  fontDescriptionRun05.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun05.familyLength = fontHebrew.size();
-  fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength];
-  memcpy( fontDescriptionRun05.familyName, fontHebrew.c_str(), fontDescriptionRun05.familyLength );
-  fontDescriptionRun05.familyDefined = true;
-  fontDescriptionRun05.weightDefined = false;
-  fontDescriptionRun05.widthDefined = false;
-  fontDescriptionRun05.slantDefined = false;
-  fontDescriptionRun05.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun06;
-  fontDescriptionRun06.characterRun.characterIndex = 58u;
-  fontDescriptionRun06.characterRun.numberOfCharacters = 15u;
-  fontDescriptionRun06.familyLength = fontArabic.size();
-  fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength];
-  memcpy( fontDescriptionRun06.familyName, fontArabic.c_str(), fontDescriptionRun06.familyLength );
-  fontDescriptionRun06.familyDefined = true;
-  fontDescriptionRun06.weightDefined = false;
-  fontDescriptionRun06.widthDefined = false;
-  fontDescriptionRun06.slantDefined = false;
-  fontDescriptionRun06.sizeDefined = false;
-
-  Vector<FontDescriptionRun> fontDescriptionRuns;
-  fontDescriptionRuns.PushBack( fontDescriptionRun01 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun02 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun03 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun04 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun05 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun06 );
-
-  float positions[] =
-  {
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f, 68.f, -8.f, 75.f, -6.f, 80.f, -8.f, 86.f, -7.f, 91.f, -11.f, 93.f, -0.f,
-    0.f, -7.f,  5.f, -11.f, 6.f, -11.f, 9.f, -8.f, 17.f, -11.f, 18.f, -11.f, 22.f, -8.f, 28.f, -0.f,
-    86.f, -8.f, 81.f, -6.f, 74.f, -8.f, 71.f, -7.f, 70.f, -11.f, 66.f, -0.f, 62.f, -7.f, 61.f, -11.f, 56.f, -11.f, 50.f, -8.f, 49.f, -11.f, 44.f, -11.f, 39.f, -8.f, 36.f, -0.f, 26.f, -10.f, 18.f, -13.f, 13.f, -10.f, 5.f, -10.f, 0.f, -0.f,
-    22.f, -10.f, 17.f, -10.f, 10.f, -13.f, 1.f, -10.f, 0.f, -0.f,
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f, 68.f, -8.f, 75.f, -6.f, 80.f, -8.f, 86.f, -7.f, 91.f, -11.f, 93.f, -0.f,
-    0.f, -7.f, 5.f, -11.f, 6.f, -11.f, 9.f, -8.f, 17.f, -11.f, 18.f, -11.f, 22.f, -8.f, 30.f, -2.f,
-  };
-
-  Size textArea( 100.f, 300.f );
-
-  ReLayoutRightToLeftLinesData data =
-  {
-    "Paragraphs with right to left text.",
-    "שלום עולם مرحبا بالعالم\n"
-    "مرحبا بالعالم שלום עולם\n"
-    "שלום עולם مرحبا بالعالم.",
-    textArea,
-    6u,
-    fontDescriptionRuns.Begin(),
-    72u,
-    positions,
-    24u,
-    24u
-  };
-
-  if( !ReLayoutRightToLeftLinesTest( data ) )
-  {
-    tet_result(TET_FAIL);
-  }
-
-  tet_result(TET_PASS);
-  END_TEST;
-}
-
-int UtcDaliTextReorderLayout04(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline(" UtcDaliTextReorderLayout04");
-
-  // Reorder lines of the last paragraph.
-
-  const std::string fontHebrew( "TizenSansHebrew" );
-  const std::string fontArabic( "TizenSansArabic" );
-
-  // Set a known font description
-  FontDescriptionRun fontDescriptionRun01;
-  fontDescriptionRun01.characterRun.characterIndex = 0u;
-  fontDescriptionRun01.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun01.familyLength = fontHebrew.size();
-  fontDescriptionRun01.familyName = new char[fontDescriptionRun01.familyLength];
-  memcpy( fontDescriptionRun01.familyName, fontHebrew.c_str(), fontDescriptionRun01.familyLength );
-  fontDescriptionRun01.familyDefined = true;
-  fontDescriptionRun01.weightDefined = false;
-  fontDescriptionRun01.widthDefined = false;
-  fontDescriptionRun01.slantDefined = false;
-  fontDescriptionRun01.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun02;
-  fontDescriptionRun02.characterRun.characterIndex = 10u;
-  fontDescriptionRun02.characterRun.numberOfCharacters = 14u;
-  fontDescriptionRun02.familyLength = fontArabic.size();
-  fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength];
-  memcpy( fontDescriptionRun02.familyName, fontArabic.c_str(), fontDescriptionRun02.familyLength );
-  fontDescriptionRun02.familyDefined = true;
-  fontDescriptionRun02.weightDefined = false;
-  fontDescriptionRun02.widthDefined = false;
-  fontDescriptionRun02.slantDefined = false;
-  fontDescriptionRun02.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun03;
-  fontDescriptionRun03.characterRun.characterIndex = 24u;
-  fontDescriptionRun03.characterRun.numberOfCharacters = 14u;
-  fontDescriptionRun03.familyLength = fontArabic.size();
-  fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength];
-  memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength );
-  fontDescriptionRun03.familyDefined = true;
-  fontDescriptionRun03.weightDefined = false;
-  fontDescriptionRun03.widthDefined = false;
-  fontDescriptionRun03.slantDefined = false;
-  fontDescriptionRun03.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun04;
-  fontDescriptionRun04.characterRun.characterIndex = 38u;
-  fontDescriptionRun04.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun04.familyLength = fontHebrew.size();
-  fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength];
-  memcpy( fontDescriptionRun04.familyName, fontHebrew.c_str(), fontDescriptionRun04.familyLength );
-  fontDescriptionRun04.familyDefined = true;
-  fontDescriptionRun04.weightDefined = false;
-  fontDescriptionRun04.widthDefined = false;
-  fontDescriptionRun04.slantDefined = false;
-  fontDescriptionRun04.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun05;
-  fontDescriptionRun05.characterRun.characterIndex = 48u;
-  fontDescriptionRun05.characterRun.numberOfCharacters = 10u;
-  fontDescriptionRun05.familyLength = fontHebrew.size();
-  fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength];
-  memcpy( fontDescriptionRun05.familyName, fontHebrew.c_str(), fontDescriptionRun05.familyLength );
-  fontDescriptionRun05.familyDefined = true;
-  fontDescriptionRun05.weightDefined = false;
-  fontDescriptionRun05.widthDefined = false;
-  fontDescriptionRun05.slantDefined = false;
-  fontDescriptionRun05.sizeDefined = false;
-
-  FontDescriptionRun fontDescriptionRun06;
-  fontDescriptionRun06.characterRun.characterIndex = 58u;
-  fontDescriptionRun06.characterRun.numberOfCharacters = 15u;
-  fontDescriptionRun06.familyLength = fontArabic.size();
-  fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength];
-  memcpy( fontDescriptionRun06.familyName, fontArabic.c_str(), fontDescriptionRun06.familyLength );
-  fontDescriptionRun06.familyDefined = true;
-  fontDescriptionRun06.weightDefined = false;
-  fontDescriptionRun06.widthDefined = false;
-  fontDescriptionRun06.slantDefined = false;
-  fontDescriptionRun06.sizeDefined = false;
-
-  Vector<FontDescriptionRun> fontDescriptionRuns;
-  fontDescriptionRuns.PushBack( fontDescriptionRun01 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun02 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun03 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun04 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun05 );
-  fontDescriptionRuns.PushBack( fontDescriptionRun06 );
-
-  float positions[] =
-  {
-    0.f, -10.f, 11.f, -13.f, 18.f, -10.f, 23.f, -10.f, 31.f, -0.f, 36.f, -10.f, 44.f, -10.f, 49.f, -13.f, 57.f, -10.f, 65.f, -0.f, 68.f, -8.f, 75.f, -6.f, 80.f, -8.f, 86.f, -7.f, 91.f, -11.f, 93.f, -0.f,
-    0.f, -7.f, 5.f, -11.f, 6.f, -11.f, 9.f, -8.f, 17.f, -11.f, 18.f, -11.f, 22.f, -8.f, 28.f, -0.f,
-    0.f, -8.f, 7.f, -6.f, 12.f, -8.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 36.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
-    0.f, -10.f, 8.f, -10.f, 13.f, -13.f, 21.f, -10.f, 29.f, -0.f,
-    87.f, -10.f, 79.f, -13.f, 74.f, -10.f, 66.f, -10.f, 61.f, -0.f, 53.f, -10.f, 48.f, -10.f, 41.f, -13.f, 32.f, -10.f, 27.f, -0.f, 20.f, -8.f, 15.f, -6.f, 8.f, -8.f, 5.f, -7.f, 4.f, -11.f, 0.f, -0.f,
-    26.f, -7.f, 25.f, -11.f, 20.f, -11.f, 14.f, -8.f, 13.f, -11.f, 8.f, -11.f, 3.f, -8.f, 0.f, -2.f,
-  };
-
-  Size textArea( 100.f, 300.f );
-
-  ReLayoutRightToLeftLinesData data =
-  {
-    "Paragraphs with right to left text.",
-    "שלום עולם مرحبا بالعالم\n"
-    "مرحبا بالعالم שלום עולם\n"
-    "שלום עולם مرحبا بالعالم.",
-    textArea,
-    6u,
-    fontDescriptionRuns.Begin(),
-    72u,
-    positions,
-    48u,
-    24u
-  };
-
-  if( !ReLayoutRightToLeftLinesTest( data ) )
-  {
-    tet_result(TET_FAIL);
-  }
-
-  tet_result(TET_PASS);
-  END_TEST;
-}
-
 int UtcDaliTextAlign01(void)
 {
   ToolkitTestApplication application;
@@ -4351,7 +3980,7 @@ int UtcDaliTextAlign02(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun05 );
   fontDescriptionRuns.PushBack( fontDescriptionRun06 );
 
-  float positions[] = { 0.f, 0.f, 2.f, 61.f, 0.f, 0.f };
+  float positions[] = { 0.f, 0.f, 4.f, 61.f, 0.f, 0.f };
 
   Size textArea( 100.f, 300.f );
   AlignData data =
@@ -4593,7 +4222,7 @@ int UtcDaliTextAlign04(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun05 );
   fontDescriptionRuns.PushBack( fontDescriptionRun06 );
 
-  float positions[] = { 11.f, 17.f, 0.f, 0.f, 0.f, 0.f };
+  float positions[] = { 11.f, 18.f, 0.f, 0.f, 0.f, 0.f };
 
   Size textArea( 100.f, 300.f );
   AlignData data =
@@ -4714,7 +4343,7 @@ int UtcDaliTextAlign05(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun05 );
   fontDescriptionRuns.PushBack( fontDescriptionRun06 );
 
-  float positions[] = { 0.f, 0.f, -1.f, 30.f, 0.f, 0.f };
+  float positions[] = { 0.f, 0.f, 0.f, 30.f, 0.f, 0.f };
 
   Size textArea( 100.f, 300.f );
   AlignData data =
@@ -4956,7 +4585,7 @@ int UtcDaliTextAlign07(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun05 );
   fontDescriptionRuns.PushBack( fontDescriptionRun06 );
 
-  float positions[] = { 22.f, 35.f, 0.f, 0.f, 0.f, 0.f };
+  float positions[] = { 22.f, 36.f, 0.f, 0.f, 0.f, 0.f };
 
   Size textArea( 100.f, 300.f );
   AlignData data =
@@ -5198,7 +4827,7 @@ int UtcDaliTextAlign09(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun05 );
   fontDescriptionRuns.PushBack( fontDescriptionRun06 );
 
-  float positions[] = { 0.f, 0.f, 0.f, 0.f, 22.f, 42.f };
+  float positions[] = { 0.f, 0.f, 0.f, 0.f, 22.f, 43.f };
 
   Size textArea( 100.f, 300.f );
   AlignData data =
@@ -5440,7 +5069,7 @@ int UtcDaliTextAlign11(void)
   fontDescriptionRuns.PushBack( fontDescriptionRun05 );
   fontDescriptionRuns.PushBack( fontDescriptionRun06 );
 
-  float positions[] = { 22.f, 35.f, 2.f, 0.f, 0.f, 0.f };
+  float positions[] = { 22.f, 36.f, 4.f, 0.f, 0.f, 0.f };
 
   Size textArea( 100.f, 300.f );
   AlignData data =
index 025dd54..2bdd217 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 ba72d93..8d7c717 100755 (executable)
@@ -586,10 +586,10 @@ int UtcDaliTextViewModelElideText02(void)
   float positions01[] = { 0.f, 8.f, 16.f, 26.f, 33.f, 41.f, 45.f, 54.f, 64.0f };
 
   Size textSize02( 80.f, 100.f );
-  float positions02[] = { 75.f, 66.f, 57.f, 53.f, 46.f, 41.f, 33.f, 12.0f };
+  float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 10.0f };
 
   Size textSize03( 80.f, 100.f );
-  float positions03[] = { 79.f, 74.f, 71.f, 66.f, 58.f, 56.f, 52.f, 51.f, 46.f, 36.f, 33.f, 25.f, 8.f };
+  float positions03[] = { 74.f, 69.f, 66.f, 61.f, 53.f, 51.f, 47.f, 46.f, 41.f, 31.f, 28.f, 20.f, 7.f };
 
   Size textSize04( 80.f, 10.f );
   float positions04[] = { 2.f };
diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-TextField-internal.cpp
new file mode 100755 (executable)
index 0000000..5ac4ab1
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali-toolkit/internal/controls/text-controls/text-field-impl.h>
+#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-controller-impl.h>
+
+using namespace Dali;
+using namespace Toolkit;
+using namespace Text;
+
+int UtcDaliTextFieldMultipleBackgroundText(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliTextFieldMultipleBackgroundText" );
+
+  // Create a text field
+  TextField textField = TextField::New();
+  textField.SetSize( 400.f, 60.f );
+  textField.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  textField.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+  // Add the text field to the stage
+  Stage::GetCurrent().Add( textField );
+
+  application.SendNotification();
+  application.Render();
+
+  Toolkit::Internal::TextField& textFieldImpl = GetImpl( textField );
+  ControllerPtr controller = textFieldImpl.GetTextController();
+  Controller::Impl& controllerImpl = Controller::Impl::GetImplementation( *controller.Get() );
+
+  // Add multiple background colors for the text.
+  ColorRun backgroundColorRun1;
+  backgroundColorRun1.characterRun.characterIndex = 0u;
+  backgroundColorRun1.characterRun.numberOfCharacters = 1u;
+  backgroundColorRun1.color = Color::RED;
+  controllerImpl.mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun1 );
+
+  ColorRun backgroundColorRun2;
+  backgroundColorRun2.characterRun.characterIndex = 5u;
+  backgroundColorRun2.characterRun.numberOfCharacters = 8u;
+  backgroundColorRun2.color = Color::CYAN;
+  controllerImpl.mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun2 );
+
+  ColorRun backgroundColorRun3;
+  backgroundColorRun3.characterRun.characterIndex = 23u;
+  backgroundColorRun3.characterRun.numberOfCharacters = 6u;
+  backgroundColorRun3.color = Color::GREEN;
+  controllerImpl.mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun3 );
+
+  // Check the case where there is only one character in the text
+  controller->SetText( "S" );
+
+  application.SendNotification();
+  application.Render();
+
+  // The offscreen root actor should have one child: the renderable.
+  Actor stencil = textField.GetChildAt( 0u );
+  DALI_TEST_CHECK( stencil.GetChildCount() == 1u );
+
+  // The renderable actor should have two children: the text and the background.
+  Actor renderableActor = stencil.GetChildAt( 0u );
+  DALI_TEST_CHECK( renderableActor.GetChildCount() == 2u );
+
+  // Check that the background is created
+  Actor backgroundActor = renderableActor.GetChildAt( 0u );
+  DALI_TEST_CHECK( backgroundActor );
+  DALI_TEST_CHECK( backgroundActor.GetName() == "TextBackgroundColorActor" );
+
+  // Change the text to contain more characters
+  controller->SetText( "Text Multiple Background Test" );
+
+  application.SendNotification();
+  application.Render();
+
+  // Highlight the whole text
+  textFieldImpl.SelectWholeText();
+
+  application.SendNotification();
+  application.Render();
+
+  // Now the offscreen root actor should have three children: the renderable, the highlight, and the background.
+  DALI_TEST_CHECK( stencil.GetChildCount() == 3u );
+  // The renderable actor should have one child only: the text
+  DALI_TEST_CHECK( renderableActor.GetChildCount() == 1u );
+
+  // The background should now be lowered below the highlight
+  backgroundActor = stencil.GetChildAt( 0u );
+  DALI_TEST_CHECK( backgroundActor );
+  DALI_TEST_CHECK( backgroundActor.GetName() == "TextBackgroundColorActor" );
+
+  END_TEST;
+}
index c36fed6..df247e0 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 f8c0c36..b039c57 100755 (executable)
@@ -108,10 +108,6 @@ public:
     height = 100;
   }
 
-  void GetLayerInfo( Property::Map& map ) const
-  {
-  }
-
   Dali::VectorAnimationRenderer::UploadCompletedSignalType& UploadCompletedSignal()
   {
     return mUploadCompletedSignal;
@@ -186,6 +182,10 @@ VectorAnimationRenderer& VectorAnimationRenderer::operator=( const VectorAnimati
   return *this;
 }
 
+void VectorAnimationRenderer::Finalize()
+{
+}
+
 void VectorAnimationRenderer::SetRenderer( Renderer renderer )
 {
   Internal::Adaptor::GetImplementation( *this ).SetRenderer( renderer );
@@ -218,7 +218,6 @@ void VectorAnimationRenderer::GetDefaultSize( uint32_t& width, uint32_t& height
 
 void VectorAnimationRenderer::GetLayerInfo( Property::Map& map ) const
 {
-  Internal::Adaptor::GetImplementation( *this ).GetLayerInfo( map );
 }
 
 VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal()
index 834b05c..8cbab66 100644 (file)
@@ -318,6 +318,55 @@ int UtcDaliImageVisualNoPremultipliedAlpha02(void)
 
   DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
 
+  int srcFactorRgb    = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+  int destFactorRgb   = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+  int srcFactorAlpha  = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+  int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+  DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA );
+  DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+  DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+  DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
+
+  textureTrace.Reset();
+
+  // Make a new visual with the same image
+  Visual::Base newVisual = factory.CreateVisual( propertyMap );
+  DALI_TEST_CHECK( newVisual );
+
+  // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
+  // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
+
+  DummyControl newActor = DummyControl::New();
+  DummyControlImpl& newDummyImpl = static_cast< DummyControlImpl& >( newActor.GetImplementation() );
+  newDummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, newVisual );
+
+  newActor.SetSize( 200.f, 200.f );
+  DALI_TEST_EQUALS( newActor.GetRendererCount(), 0u, TEST_LOCATION );
+
+  Stage::GetCurrent().Add( newActor );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( newActor.GetRendererCount(), 1u, TEST_LOCATION );
+  auto newRenderer = newActor.GetRendererAt( 0 );
+  preMultipliedIndex = newRenderer.GetPropertyIndex( "preMultipliedAlpha" );
+  DALI_TEST_CHECK( preMultipliedIndex != Property::INVALID_INDEX );
+  preMultipliedAlpha = newRenderer.GetProperty< bool >( preMultipliedIndex );
+  preMultipliedAlpha2 = newRenderer.GetProperty< bool >( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+
+  DALI_TEST_EQUALS( preMultipliedAlpha, false, TEST_LOCATION );
+  DALI_TEST_EQUALS( preMultipliedAlpha2, false, TEST_LOCATION );
+
+  srcFactorRgb    = newRenderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+  destFactorRgb   = newRenderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+  srcFactorAlpha  = newRenderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+  destFactorAlpha = newRenderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+  DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA );
+  DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+  DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+  DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
+
   Stage::GetCurrent().Remove( actor );
   DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
 
@@ -1313,113 +1362,6 @@ int UtcDaliImageVisualAlphaMask(void)
   END_TEST;
 }
 
-int UtcDaliImageVisualJpgAlphaMask(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "Request image visual with a Property::Map containing 24 bit image and an Alpha mask" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  Property::Map propertyMap;
-  propertyMap.Insert( Toolkit::Visual::Property::TYPE,  Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::URL,  TEST_IMAGE_FILE_NAME );
-  propertyMap.Insert( ImageVisual::Property::ALPHA_MASK_URL, TEST_MASK_IMAGE_FILE_NAME );
-
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( visual );
-
-  Property::Map testMap;
-  visual.CreatePropertyMap( testMap );
-  DALI_TEST_EQUALS( *testMap.Find( ImageVisual::Property::ALPHA_MASK_URL ), Property::Value( TEST_MASK_IMAGE_FILE_NAME ), TEST_LOCATION );
-
-  // For tesing the LoadResourceFunc is called, a big image size should be set, so the atlasing is not applied.
-  // Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
-
-  TestGlAbstraction& gl = application.GetGlAbstraction();
-  TraceCallStack& textureTrace = gl.GetTextureTrace();
-  textureTrace.Enable( true );
-
-  DummyControl actor = DummyControl::New();
-  DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-
-  actor.SetSize( 200.f, 200.f );
-  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
-  DALI_TEST_EQUALS( actor.IsResourceReady(), false, TEST_LOCATION );
-
-  Stage::GetCurrent().Add( actor );
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 3 ), true, TEST_LOCATION );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
-  DALI_TEST_EQUALS( textureTrace.FindMethod( "BindTexture" ), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( actor.IsResourceReady(), true, TEST_LOCATION );
-
-  // Should not be pre-multiplied
-  Renderer renderer = actor.GetRendererAt( 0 );
-  Property::Value value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
-
-  bool enable;
-  DALI_TEST_CHECK( value.Get( enable ) );
-  DALI_TEST_CHECK( !enable );
-
-  int srcFactorRgb    = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
-  int destFactorRgb   = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
-  int srcFactorAlpha  = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
-  int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
-  DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA );
-  DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
-  DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
-  DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
-
-  // Make a new visual with the same image
-  Visual::Base newVisual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( newVisual );
-
-  DummyControl newActor = DummyControl::New();
-  DummyControlImpl& newDummyImpl = static_cast< DummyControlImpl& >( newActor.GetImplementation() );
-  newDummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, newVisual );
-
-  newActor.SetSize( 200.f, 200.f );
-  DALI_TEST_EQUALS( newActor.GetRendererCount(), 0u, TEST_LOCATION );
-  DALI_TEST_EQUALS( newActor.IsResourceReady(), false, TEST_LOCATION );
-
-  Stage::GetCurrent().Add( newActor );
-
-  application.SendNotification();
-  application.Render();
-
-  DALI_TEST_EQUALS( newActor.GetRendererCount(), 1u, TEST_LOCATION );
-  DALI_TEST_EQUALS( textureTrace.FindMethod( "BindTexture" ), true, TEST_LOCATION );
-  DALI_TEST_EQUALS( newActor.IsResourceReady(), true, TEST_LOCATION );
-
-  // Should not be pre-multiplied
-  renderer = newActor.GetRendererAt( 0 );
-  value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
-  DALI_TEST_CHECK( value.Get( enable ) );
-  DALI_TEST_CHECK( !enable );
-
-  srcFactorRgb    = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
-  destFactorRgb   = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
-  srcFactorAlpha  = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
-  destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
-  DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA );
-  DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
-  DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
-  DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
-
-  dummyImpl.UnregisterVisual(  Control::CONTROL_PROPERTY_END_INDEX + 1 );
-  DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
-
-  END_TEST;
-}
-
 int UtcDaliImageVisualRemoteAlphaMask(void)
 {
   ToolkitTestApplication application;
index 3bd3368..5fc985f 100644 (file)
@@ -39,9 +39,10 @@ uint32_t ApplyMask( AsyncImageLoader asyncImageLoader,
                     Devel::PixelBuffer pixelBuffer,
                     Devel::PixelBuffer maskPixelBuffer,
                     float contentScale,
-                    bool cropToMask )
+                    bool cropToMask,
+                    DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad )
 {
-  return GetImplementation( asyncImageLoader ).ApplyMask( pixelBuffer, maskPixelBuffer, contentScale, cropToMask );
+  return GetImplementation( asyncImageLoader ).ApplyMask( pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad );
 }
 
 PixelBufferLoadedSignalType& PixelBufferLoadedSignal( AsyncImageLoader asyncImageLoader )
index 681c00b..99ca154 100644 (file)
@@ -49,7 +49,7 @@ enum class PreMultiplyOnLoad
  * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
  * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
  * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
- * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha
+ * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask.
  * @return The loading task id
  */
 DALI_TOOLKIT_API uint32_t Load( AsyncImageLoader asyncImageLoader,
@@ -69,13 +69,15 @@ DALI_TOOLKIT_API uint32_t Load( AsyncImageLoader asyncImageLoader,
  * @param[in] maskPixelBuffer Pointer to raw masking data
  * @param[in] contentScale The factor to scale the content
  * @param[in] cropToMask Whether to crop the content to the mask size
+ * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha.
  * @return The masking task id
  */
 DALI_TOOLKIT_API uint32_t ApplyMask( AsyncImageLoader asyncImageLoader,
                                      Devel::PixelBuffer pixelBuffer,
                                      Devel::PixelBuffer maskPixelBuffer,
                                      float contentScale,
-                                     bool cropToMask );
+                                     bool cropToMask,
+                                     DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
 
 /**
  * Connect to this signal if you want to load a PixelBuffer instead of a PixelData.
index c2157f1..189ab8a 100644 (file)
@@ -46,7 +46,7 @@ YGSize MeasureChild(YGNodeRef child, float width, YGMeasureMode measureModeWidth
   // Get the Node from the YGNodeRef
   Toolkit::Flex::Node* childNode =  static_cast<Toolkit::Flex::Node*>(YGNodeGetContext(child));
 
-  YGSize childSize = YGSize{.width = 1, .height = 1};  // Initialise variable.
+  YGSize childSize{ 1, 1 }; // Initialise variable.
 
   DALI_ASSERT_DEBUG( childNode );
 
index eaab0e5..fae3c10 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 );
@@ -594,39 +582,11 @@ Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<Embe
   Size newLayoutSize;
   bool isAutoScrollEnabled = false;
   layoutEngine.LayoutText( layoutParameters,
-                           rendererParameters.positions,
-                           lines,
                            newLayoutSize,
                            textParameters.ellipsisEnabled,
                            isAutoScrollEnabled );
 
   ////////////////////////////////////////////////////////////////////////////////
-  // Reorder BiDirectional lines.
-  ////////////////////////////////////////////////////////////////////////////////
-
-  if( hasBidirectionalText )
-  {
-    // Reorder the line.
-    bidirectionalLineInfo.Reserve( 1u );
-
-    ReorderLines( bidirectionalInfo,
-                  0u,
-                  numberOfCharacters,
-                  lines,
-                  bidirectionalLineInfo );
-
-    // Set the bidirectional info per line into the layout parameters.
-    layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
-    layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
-
-    // Re-layout the text. Reorder those lines with right to left characters.
-    layoutEngine.ReLayoutRightToLeftLines( layoutParameters,
-                                           0u,
-                                           numberOfCharacters,
-                                           rendererParameters.positions );
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
   // Align the text.
   ////////////////////////////////////////////////////////////////////////////////
 
index 0def1bc..6a1f1c9 100755 (executable)
@@ -1463,8 +1463,14 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
 
     if( renderableActor != mRenderableActor )
     {
+      UnparentAndReset( mBackgroundActor );
       UnparentAndReset( mRenderableActor );
       mRenderableActor = renderableActor;
+
+      if ( mRenderableActor )
+      {
+        mBackgroundActor = mController->CreateBackgroundActor();
+      }
     }
   }
 
@@ -1472,9 +1478,12 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
   {
     const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
 
+    float renderableActorPositionX, renderableActorPositionY;
+
     if( mStencil )
     {
-      mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
+      renderableActorPositionX = scrollOffset.x + mAlignmentOffset;
+      renderableActorPositionY = scrollOffset.y;
     }
     else
     {
@@ -1488,13 +1497,17 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
         std::swap( padding.start, padding.end );
       }
 
-      mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset + padding.start, scrollOffset.y + padding.top );
+      renderableActorPositionX = scrollOffset.x + mAlignmentOffset + padding.start;
+      renderableActorPositionY = scrollOffset.y + padding.top;
     }
 
+    mRenderableActor.SetPosition( renderableActorPositionX, renderableActorPositionY );
 
     // Make sure the actors are parented correctly with/without clipping
     Actor self = mStencil ? mStencil : Self();
 
+    Actor highlightActor;
+
     for( std::vector<Actor>::iterator it = mClippingDecorationActors.begin(),
            endIt = mClippingDecorationActors.end();
          it != endIt;
@@ -1502,10 +1515,31 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
     {
       self.Add( *it );
       it->LowerToBottom();
+
+      if ( it->GetName() == "HighlightActor" )
+      {
+        highlightActor = *it;
+      }
     }
     mClippingDecorationActors.clear();
 
     self.Add( mRenderableActor );
+
+    if ( mBackgroundActor )
+    {
+      if ( mDecorator && mDecorator->IsHighlightVisible() )
+      {
+        self.Add( mBackgroundActor );
+        mBackgroundActor.SetPosition( renderableActorPositionX, renderableActorPositionY); // In text field's coords.
+        mBackgroundActor.LowerBelow( highlightActor );
+      }
+      else
+      {
+        mRenderableActor.Add( mBackgroundActor );
+        mBackgroundActor.SetPosition( 0.0f, 0.0f ); // In renderable actor's coords.
+        mBackgroundActor.LowerToBottom();
+      }
+    }
   }
 }
 
index 3b1062e..25bd4bd 100755 (executable)
@@ -268,6 +268,10 @@ private: // Implementation
   // Connection needed to re-render text, when a Text Field returns to the stage.
   void OnStageConnect( Dali::Actor actor );
 
+public: // For UTC only
+
+  Text::ControllerPtr GetTextController() { return mController; }
+
 private: // Data
 
   // Signals
@@ -285,6 +289,7 @@ private: // Data
 
   Actor mRenderableActor;
   Actor mActiveLayer;
+  Actor mBackgroundActor;
   CallbackBase* mIdleCallback;
 
   float mAlignmentOffset;
index 62a3fdd..6fe8eba 100644 (file)
@@ -69,14 +69,15 @@ uint32_t AsyncImageLoader::Load( const VisualUrl& url,
 uint32_t AsyncImageLoader::ApplyMask( Devel::PixelBuffer pixelBuffer,
                                       Devel::PixelBuffer maskPixelBuffer,
                                       float contentScale,
-                                      bool cropToMask )
+                                      bool cropToMask,
+                                      DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
 {
   if( !mIsLoadThreadStarted )
   {
     mLoadThread.Start();
     mIsLoadThreadStarted = true;
   }
-  mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, pixelBuffer, maskPixelBuffer, contentScale, cropToMask ) );
+  mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad ) );
 
   return mLoadTaskId;
 }
index 69a7617..a97088d 100644 (file)
@@ -65,12 +65,14 @@ public:
    * @param[in] maskPixelBuffer of the mask image
    * @param[in] contentScale The factor to scale the content
    * @param[in] cropToMask Whether to crop the content to the mask size
+   * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha.
    * @return The loading task id
    */
   uint32_t ApplyMask( Devel::PixelBuffer pixelBuffer,
                       Devel::PixelBuffer maskPixelBuffer,
                       float contentScale,
-                      bool cropToMask );
+                      bool cropToMask,
+                      DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
 
   /**
    * @copydoc Toolkit::AsyncImageLoader::ImageLoadedSignal
index 9756608..213173a 100644 (file)
@@ -49,7 +49,8 @@ LoadingTask::LoadingTask( uint32_t id, const VisualUrl& url, ImageDimensions dim
 {
 }
 
-LoadingTask::LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, bool cropToMask )
+LoadingTask::LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::PixelBuffer maskPixelBuffer, float contentScale, bool cropToMask,
+                          DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad )
 : pixelBuffer( pixelBuffer ),
   url( "" ),
   id( id ),
@@ -57,7 +58,7 @@ LoadingTask::LoadingTask( uint32_t id, Devel::PixelBuffer pixelBuffer, Devel::Pi
   fittingMode(),
   samplingMode(),
   orientationCorrection(),
-  preMultiplyOnLoad(),
+  preMultiplyOnLoad( preMultiplyOnLoad ),
   isMaskTask( true ),
   maskPixelBuffer( maskPixelBuffer ),
   contentScale( contentScale ),
@@ -75,7 +76,15 @@ void LoadingTask::Load()
   {
     pixelBuffer = Dali::DownloadImageSynchronously ( url.GetUrl(), dimensions, fittingMode, samplingMode, orientationCorrection );
   }
+}
+
+void LoadingTask::ApplyMask()
+{
+  pixelBuffer.ApplyMask( maskPixelBuffer, contentScale, cropToMask );
+}
 
+void LoadingTask::MultiplyAlpha()
+{
   if( pixelBuffer && Pixel::HasAlpha( pixelBuffer.GetPixelFormat() ) )
   {
     if( preMultiplyOnLoad == DevelAsyncImageLoader::PreMultiplyOnLoad::ON )
@@ -85,11 +94,6 @@ void LoadingTask::Load()
   }
 }
 
-void LoadingTask::ApplyMask()
-{
-  pixelBuffer.ApplyMask( maskPixelBuffer, contentScale, cropToMask );
-}
-
 ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger )
 : mTrigger( trigger ),
   mLogFactory( Dali::Adaptor::Get().GetLogFactory() )
@@ -121,6 +125,7 @@ void ImageLoadThread::Run()
     {
       task->ApplyMask();
     }
+    task->MultiplyAlpha();
 
     AddCompletedTask( task );
   }
index 53f6e47..779541a 100644 (file)
@@ -52,7 +52,7 @@ struct LoadingTask
    * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
    * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
    * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
-   * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha.
+   * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask.
    */
   LoadingTask( uint32_t id,
                const VisualUrl& url,
@@ -69,12 +69,14 @@ struct LoadingTask
    * @param [in] maskPixelBuffer of the mask image
    * @param [in] contentScale The factor to scale the content
    * @param [in] cropToMask Whether to crop the content to the mask size
+   * @param [in] preMultiplyOnLoad ON if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha.
    */
   LoadingTask( uint32_t id,
               Devel::PixelBuffer pixelBuffer,
               Devel::PixelBuffer maskPixelBuffer,
               float contentScale,
-              bool cropToMask );
+              bool cropToMask,
+              DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
 
   /**
    * Load the image
@@ -86,6 +88,11 @@ struct LoadingTask
    */
   void ApplyMask();
 
+  /**
+   * Multiply alpha
+   */
+  void MultiplyAlpha();
+
 private:
 
   // Undefined
index e34e6d0..c04918b 100644 (file)
@@ -37,7 +37,8 @@ struct BidirectionalLineInfoRun
 {
   CharacterRun       characterRun;       ///< The initial character index within the whole text and the number of characters of the run.
   CharacterIndex*    visualToLogicalMap; ///< Pointer to the visual to logical map table.
-  CharacterDirection direction;          ///< Direction of the first character of the paragraph.
+  CharacterDirection direction:1;        ///< Direction of the first character of the paragraph.
+  bool               isIdentity:1;       ///< Whether the map is the identity.
 };
 
 } // namespace Text
index 34af0f7..44a9614 100644 (file)
@@ -40,6 +40,7 @@ struct BidirectionalParagraphInfoRun
 {
   CharacterRun  characterRun;           ///< The initial character index within the whole text and the number of characters of the run.
   BidiInfoIndex bidirectionalInfoIndex; ///< Index to the table with the bidirectional info per paragraph.
+  CharacterDirection direction;         ///< The paragraph's direction.
 };
 
 } // namespace Text
index 26e99b7..165ae0d 100755 (executable)
@@ -31,58 +31,6 @@ namespace Toolkit
 namespace Text
 {
 
-namespace
-{
-
-/**
- * @brief Get the lines of a paragraph.
- *
- * @param[in] paragraphInfo The paragraph.
- * @param[in] lines The lines.
- * @param[in] lineIndex Index pointing the first line to be checked.
- * @param[out] firstLine Index to the first line of the paragraph.
- * @param[out] numberOfLines The number of lines.
- */
-void GetLines( const BidirectionalParagraphInfoRun& paragraphInfo,
-               const Vector<LineRun>& lines,
-               unsigned int lineIndex,
-               unsigned int& firstLine,
-               unsigned int& numberOfLines )
-{
-  firstLine = lineIndex;
-  numberOfLines = 0u;
-
-  const CharacterIndex lastCharacterIndex = paragraphInfo.characterRun.characterIndex + paragraphInfo.characterRun.numberOfCharacters;
-  bool firstLineFound = false;
-
-  for( Vector<LineRun>::ConstIterator it = lines.Begin() + lineIndex,
-         endIt = lines.End();
-       it != endIt;
-       ++it )
-  {
-    const LineRun& line = *it;
-
-    if( ( line.characterRun.characterIndex + line.characterRun.numberOfCharacters > paragraphInfo.characterRun.characterIndex ) &&
-        ( lastCharacterIndex > line.characterRun.characterIndex ) )
-    {
-      firstLineFound = true;
-      ++numberOfLines;
-    }
-    else if( lastCharacterIndex <= line.characterRun.characterIndex )
-    {
-      // nothing else to do.
-      break;
-    }
-
-    if( !firstLineFound )
-    {
-      ++firstLine;
-    }
-  }
-}
-
-} // namespace
-
 void SetBidirectionalInfo( const Vector<Character>& text,
                            const Vector<ScriptRun>& scripts,
                            const Vector<LineBreakInfo>& lineBreakInfo,
@@ -171,6 +119,8 @@ void SetBidirectionalInfo( const Vector<Character>& text,
                                                                                    matchSystemLanguageDirection,
                                                                                    layoutDirection );
 
+        bidirectionalRun.direction = bidirectionalSupport.GetParagraphDirection( bidirectionalRun.bidirectionalInfoIndex );
+
         bidirectionalInfo.Insert( bidirectionalInfo.Begin() + bidiInfoIndex, bidirectionalRun );
         ++bidiInfoIndex;
       }
@@ -195,118 +145,49 @@ void SetBidirectionalInfo( const Vector<Character>& text,
   }
 }
 
-void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
-                   CharacterIndex startIndex,
-                   Length numberOfCharacters,
-                   Vector<LineRun>& lineRuns,
-                   Vector<BidirectionalLineInfoRun>& lineInfoRuns )
+void ReorderLine( const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo,
+                  Vector<BidirectionalLineInfoRun>& lineInfoRuns,
+                  BidirectionalLineRunIndex bidiLineIndex,
+                  CharacterIndex startIndex,
+                  Length numberOfCharacters,
+                  CharacterDirection direction )
 {
-  // Find where to insert the new paragraphs.
-  BidirectionalLineRunIndex bidiLineInfoIndex = 0u;
-  for( Vector<BidirectionalLineInfoRun>::ConstIterator it = lineInfoRuns.Begin(),
-         endIt = lineInfoRuns.End();
-       it != endIt;
-       ++it )
-  {
-    const BidirectionalLineInfoRun& run = *it;
-
-    if( startIndex < run.characterRun.characterIndex + run.characterRun.numberOfCharacters )
-    {
-      // Found where to insert the bidi line info.
-      break;
-    }
-    ++bidiLineInfoIndex;
-  }
-
   // Handle to the bidirectional info module in text-abstraction.
   TextAbstraction::BidirectionalSupport bidirectionalSupport = TextAbstraction::BidirectionalSupport::Get();
 
-  const CharacterIndex lastCharacter = startIndex + numberOfCharacters;
+  // Creates a bidirectional info for the line run.
+  BidirectionalLineInfoRun lineInfoRun;
+  lineInfoRun.characterRun.characterIndex = startIndex;
+  lineInfoRun.characterRun.numberOfCharacters = numberOfCharacters;
+  lineInfoRun.direction = direction;
+  lineInfoRun.isIdentity = true;
 
-  // Keep an index to the first line to be checked if it's contained inside the paragraph.
-  // Avoids check the lines from the beginning for each paragraph.
-  unsigned int lineIndex = 0u;
+  // Allocate space for the conversion maps.
+  // The memory is freed after the visual to logical to visual conversion tables are built in the logical model.
+  lineInfoRun.visualToLogicalMap = reinterpret_cast<CharacterIndex*>( malloc( numberOfCharacters * sizeof( CharacterIndex ) ) );
 
-  for( Vector<BidirectionalParagraphInfoRun>::ConstIterator it = bidirectionalInfo.Begin(),
-         endIt = bidirectionalInfo.End();
-       it != endIt;
-       ++it )
+  if( nullptr != lineInfoRun.visualToLogicalMap )
   {
-    const BidirectionalParagraphInfoRun& paragraphInfo = *it;
-
-    if( paragraphInfo.characterRun.characterIndex < startIndex )
-    {
-      // Do not process, the paragraph has already been processed.
-      continue;
-    }
-
-    if( lastCharacter <= paragraphInfo.characterRun.characterIndex )
-    {
-      // Do not process paragraphs beyond startIndex + numberOfCharacters.
-      break;
-    }
-
-    const CharacterDirection direction = bidirectionalSupport.GetParagraphDirection( paragraphInfo.bidirectionalInfoIndex );
-
-    // Get the lines for this paragraph.
-    unsigned int firstLine = 0u;
-    unsigned int numberOfLines = 0u;
-
-    // Get an index to the first line and the number of lines of the current paragraph.
-    GetLines( paragraphInfo,
-              lineRuns,
-              lineIndex,
-              firstLine,
-              numberOfLines );
-
-    lineIndex = firstLine + numberOfLines;
-
-    // Traverse the lines and reorder them
-    for( Vector<LineRun>::Iterator lineIt = lineRuns.Begin() + firstLine,
-           endLineIt = lineRuns.Begin() + firstLine + numberOfLines;
-           lineIt != endLineIt;
-         ++lineIt )
+    // Reorders the line.
+    bidirectionalSupport.Reorder( bidirectionalParagraphInfo.bidirectionalInfoIndex,
+                                  lineInfoRun.characterRun.characterIndex - bidirectionalParagraphInfo.characterRun.characterIndex,
+                                  lineInfoRun.characterRun.numberOfCharacters,
+                                  lineInfoRun.visualToLogicalMap );
+
+    // For those LTR lines inside a bidirectional paragraph.
+    // It will save to relayout the line after reordering.
+    for( unsigned int i=0; i<numberOfCharacters; ++i )
     {
-      LineRun& line = *lineIt;
-
-      // Sets the paragraph's direction.
-      line.direction = direction;
-
-      // Creates a bidirectional info for the line run.
-      BidirectionalLineInfoRun lineInfoRun;
-      lineInfoRun.characterRun.characterIndex = line.characterRun.characterIndex;
-      lineInfoRun.characterRun.numberOfCharacters = line.characterRun.numberOfCharacters;
-      lineInfoRun.direction = direction;
-
-      // Allocate space for the conversion maps.
-      // The memory is freed after the visual to logical to visual conversion tables are built in the logical model.
-      lineInfoRun.visualToLogicalMap = reinterpret_cast<CharacterIndex*>( malloc( line.characterRun.numberOfCharacters * sizeof( CharacterIndex ) ) );
-
-      if( NULL != lineInfoRun.visualToLogicalMap )
+      if( i != *( lineInfoRun.visualToLogicalMap + i ) )
       {
-        // Reorders the line.
-        bidirectionalSupport.Reorder( paragraphInfo.bidirectionalInfoIndex,
-                                      line.characterRun.characterIndex - paragraphInfo.characterRun.characterIndex,
-                                      line.characterRun.numberOfCharacters,
-                                      lineInfoRun.visualToLogicalMap );
+        lineInfoRun.isIdentity = false;
+        break;
       }
-
-      // Push the run into the vector.
-      lineInfoRuns.Insert( lineInfoRuns.Begin() + bidiLineInfoIndex, lineInfoRun );
-      ++bidiLineInfoIndex;
     }
   }
 
-  // Update indices of the bidi runs.
-  for( Vector<BidirectionalLineInfoRun>::Iterator it = lineInfoRuns.Begin() + bidiLineInfoIndex,
-         endIt = lineInfoRuns.End();
-       it != endIt;
-       ++it )
-  {
-    BidirectionalLineInfoRun& run = *it;
-
-    run.characterRun.characterIndex += numberOfCharacters;
-  }
+  // Push the run into the vector.
+  lineInfoRuns.Insert( lineInfoRuns.Begin() + bidiLineIndex, lineInfoRun );
 }
 
 bool GetMirroredText( const Vector<Character>& text,
index 1ca4eca..4f92c62 100755 (executable)
@@ -59,26 +59,21 @@ void SetBidirectionalInfo( const Vector<Character>& text,
                            Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT );
 
 /**
- * Sets the visual to logical map tables.
+ * @brief Sets the visual to logical map table for a given line.
  *
- * Any map tables previously set are removed.
- * It sets the paragraph's direction to each line.
- *
- * @pre The @p logicalModel needs to have a text set.
- * @pre The @p logicalModel needs to have the bidirectional info indices for each paragraph set.
- * @pre The @p visualModel needs to have the laid-out lines info set.
- *
- * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
+ * @param[in] bidirectionalParagraphInfo The paragraph's bidirectional info.
+ * @param[out] lineInfoRuns Line runs with the visual to logical conversion maps.
+ * @param[in] bidiLineIndex Index to the line's bidirectional info.
  * @param[in] startIndex The character from where the bidirectional info is set.
  * @param[in] numberOfCharacters The number of characters.
- * @param[in,out] lineRuns The line runs converted to characters.
- * @param[out] lineInfoRuns line runs with the visual to logical conversion maps.
+ * @param[in] direction The direction of the line.
  */
-void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
-                   CharacterIndex startIndex,
-                   Length numberOfCharacters,
-                   Vector<LineRun>& lineRuns,
-                   Vector<BidirectionalLineInfoRun>& lineInfoRuns );
+void ReorderLine( const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo,
+                  Vector<BidirectionalLineInfoRun>& lineInfoRuns,
+                  BidirectionalLineRunIndex bidiLineIndex,
+                  CharacterIndex startIndex,
+                  Length numberOfCharacters,
+                  CharacterDirection direction );
 
 /**
  * @brief Replaces any character in the right to left paragraphs which could be mirrored.
@@ -100,7 +95,7 @@ bool GetMirroredText( const Vector<Character>& text,
                       Vector<Character>& mirroredText );
 
 /**
- * @brief Retrieves the character's directions.
+ * @brief Retrieves the characters' directions.
  *
  * @pre The @p logicalModel needs to have a text set.
  * @pre The @p logicalModel needs to have the bidirectional info indices for each paragraph set.
index d0f89d9..0cb8b4c 100644 (file)
@@ -1148,9 +1148,7 @@ struct Decorator::Impl : public ConnectionTracker
     {
       mHighlightActor = Actor::New();
 
-#ifdef DECORATOR_DEBUG
       mHighlightActor.SetName( "HighlightActor" );
-#endif
       mHighlightActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
       mHighlightActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
       mHighlightActor.SetColor( mHighlightColor );
index 6e8be71..d73ee6a 100755 (executable)
@@ -25,7 +25,7 @@
 #include <dali/devel-api/text-abstraction/font-client.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
+#include <dali-toolkit/internal/text/bidirectional-support.h>
 #include <dali-toolkit/internal/text/cursor-helper-functions.h>
 #include <dali-toolkit/internal/text/glyph-metrics-helper.h>
 #include <dali-toolkit/internal/text/layouts/layout-parameters.h>
@@ -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 )
@@ -66,17 +67,18 @@ inline bool isEmptyLineAtLast( const Vector<LineRun>& lines, const Vector<LineRu
 struct LineLayout
 {
   LineLayout()
-  : glyphIndex( 0u ),
-    characterIndex( 0u ),
-    numberOfGlyphs( 0u ),
-    numberOfCharacters( 0u ),
-    ascender( -MAX_FLOAT ),
-    descender( MAX_FLOAT ),
-    lineSpacing( 0.f ),
-    penX( 0.f ),
-    previousAdvance( 0.f ),
-    length( 0.f ),
-    wsLengthEndOfLine( 0.f )
+  : glyphIndex{ 0u },
+    characterIndex{ 0u },
+    numberOfGlyphs{ 0u },
+    numberOfCharacters{ 0u },
+    ascender{ -MAX_FLOAT },
+    descender{ MAX_FLOAT },
+    lineSpacing{ 0.f },
+    penX{ 0.f },
+    previousAdvance{ 0.f },
+    length{ 0.f },
+    whiteSpaceLengthEndOfLine{ 0.f },
+    direction{ LTR }
   {}
 
   ~LineLayout()
@@ -88,29 +90,47 @@ struct LineLayout
     characterIndex = 0u;
     numberOfGlyphs = 0u;
     numberOfCharacters = 0u;
-    ascender = 0.f;
+    ascender = -MAX_FLOAT;
     descender = MAX_FLOAT;
+    direction = LTR;
   }
 
-  GlyphIndex     glyphIndex;         ///< Index of the first glyph to be laid-out.
-  CharacterIndex characterIndex;     ///< Index of the first character to be laid-out.
-  Length         numberOfGlyphs;     ///< The number of glyph which fit in one line.
-  Length         numberOfCharacters; ///< The number of characters which fit in one line.
-  float          ascender;           ///< The maximum ascender of all fonts in the line.
-  float          descender;          ///< The minimum descender of all fonts in the line.
-  float          lineSpacing;        ///< The line spacing
-  float          penX;               ///< The origin of the current glyph ( is the start point plus the accumulation of all advances ).
-  float          previousAdvance;    ///< The advance of the previous glyph.
-  float          length;             ///< The current length of the line.
-  float          wsLengthEndOfLine;  ///< The length of the white spaces at the end of the line.
+  GlyphIndex         glyphIndex;                ///< Index of the first glyph to be laid-out.
+  CharacterIndex     characterIndex;            ///< Index of the first character to be laid-out.
+  Length             numberOfGlyphs;            ///< The number of glyph which fit in one line.
+  Length             numberOfCharacters;        ///< The number of characters which fit in one line.
+  float              ascender;                  ///< The maximum ascender of all fonts in the line.
+  float              descender;                 ///< The minimum descender of all fonts in the line.
+  float              lineSpacing;               ///< The line spacing
+  float              penX;                      ///< The origin of the current glyph ( is the start point plus the accumulation of all advances ).
+  float              previousAdvance;           ///< The advance of the previous glyph.
+  float              length;                    ///< The current length of the line.
+  float              whiteSpaceLengthEndOfLine; ///< The length of the white spaces at the end of the line.
+  CharacterDirection direction;
+};
+
+struct LayoutBidiParameters
+{
+  void Clear()
+  {
+    paragraphDirection = LTR;
+    bidiParagraphIndex = 0u;
+    bidiLineIndex = 0u;
+    isBidirectional = false;
+  }
+
+  CharacterDirection paragraphDirection = LTR;   ///< The paragraph's direction.
+  BidirectionalRunIndex bidiParagraphIndex = 0u; ///< Index to the paragraph's bidi info.
+  BidirectionalLineRunIndex bidiLineIndex = 0u;  ///< Index where to insert the next bidi line info.
+  bool isBidirectional = false;                  ///< Whether the text is bidirectional.
 };
 
 struct Engine::Impl
 {
   Impl()
-  : mLayout( Layout::Engine::SINGLE_LINE_BOX ),
-    mCursorWidth( 0.f ),
-    mDefaultLineSpacing( LINE_SPACING )
+  : mLayout{ Layout::Engine::SINGLE_LINE_BOX },
+    mCursorWidth{ 0.f },
+    mDefaultLineSpacing{ LINE_SPACING }
   {
   }
 
@@ -162,7 +182,7 @@ struct Engine::Impl
     lineLayout.previousAdvance = tmpLineLayout.previousAdvance;
 
     lineLayout.length = tmpLineLayout.length;
-    lineLayout.wsLengthEndOfLine = tmpLineLayout.wsLengthEndOfLine;
+    lineLayout.whiteSpaceLengthEndOfLine = tmpLineLayout.whiteSpaceLengthEndOfLine;
 
     // Sets the maximum ascender.
     lineLayout.ascender = std::max( lineLayout.ascender, tmpLineLayout.ascender );
@@ -171,33 +191,261 @@ struct Engine::Impl
     lineLayout.descender = std::min( lineLayout.descender, tmpLineLayout.descender );
   }
 
+  void LayoutRightToLeft( const Parameters& parameters,
+                          const BidirectionalLineInfoRun& bidirectionalLineInfo,
+                          float& length,
+                          float& whiteSpaceLengthEndOfLine )
+  {
+    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 GlyphIndex* const charactersToGlyphsBuffer = parameters.textModel->mVisualModel->mCharactersToGlyph.Begin();
+
+    const float outlineWidth = static_cast<float>( parameters.textModel->GetOutlineWidth() );
+    const GlyphIndex lastGlyphOfParagraphPlusOne = parameters.startGlyphIndex + parameters.numberOfGlyphs;
+
+    CharacterIndex characterLogicalIndex = 0u;
+    CharacterIndex characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *( bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex );
+
+    if( RTL == bidirectionalLineInfo.direction )
+    {
+      while( TextAbstraction::IsWhiteSpace( *( textBuffer + characterVisualIndex ) ) )
+      {
+        const GlyphInfo& glyphInfo = *( glyphsBuffer + *( charactersToGlyphsBuffer + characterVisualIndex ) );
+
+        whiteSpaceLengthEndOfLine += glyphInfo.advance;
+
+        ++characterLogicalIndex;
+        characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *( bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex );
+      }
+    }
+
+    const GlyphIndex glyphIndex = *( charactersToGlyphsBuffer + characterVisualIndex );
+
+    // Check whether the first glyph comes from a character that is shaped in multiple glyphs.
+    const Length numberOfGLyphsInGroup = GetNumberOfGlyphsOfGroup( glyphIndex,
+                                                                   lastGlyphOfParagraphPlusOne,
+                                                                   charactersPerGlyphBuffer );
+
+    GlyphMetrics glyphMetrics;
+    GetGlyphsMetrics( glyphIndex,
+                      numberOfGLyphsInGroup,
+                      glyphMetrics,
+                      glyphsBuffer,
+                      mMetrics );
+
+    float penX = -glyphMetrics.xBearing + mCursorWidth + outlineWidth;
+
+    // Traverses the characters of the right to left paragraph.
+    for( ; characterLogicalIndex < bidirectionalLineInfo.characterRun.numberOfCharacters; )
+    {
+      // Convert the character in the logical order into the character in the visual order.
+      const CharacterIndex characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *( bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex );
+      const bool isWhiteSpace = TextAbstraction::IsWhiteSpace( *( textBuffer + characterVisualIndex ) );
+
+      const GlyphIndex glyphIndex = *( charactersToGlyphsBuffer + characterVisualIndex );
+
+      // Check whether this glyph comes from a character that is shaped in multiple glyphs.
+      const Length numberOfGLyphsInGroup = GetNumberOfGlyphsOfGroup( glyphIndex,
+                                                                     lastGlyphOfParagraphPlusOne,
+                                                                     charactersPerGlyphBuffer );
+
+      characterLogicalIndex += *( charactersPerGlyphBuffer + glyphIndex + numberOfGLyphsInGroup - 1u );
+
+      GlyphMetrics glyphMetrics;
+      GetGlyphsMetrics( glyphIndex,
+                        numberOfGLyphsInGroup,
+                        glyphMetrics,
+                        glyphsBuffer,
+                        mMetrics );
+
+      if( isWhiteSpace )
+      {
+        if( RTL == bidirectionalLineInfo.direction )
+        {
+          length += glyphMetrics.advance;
+        }
+        else
+        {
+          whiteSpaceLengthEndOfLine += glyphMetrics.advance;
+        }
+        penX += glyphMetrics.advance;
+      }
+      else
+      {
+        if( LTR == bidirectionalLineInfo.direction )
+        {
+          whiteSpaceLengthEndOfLine = 0.f;
+        }
+        length = std::max( length, penX + glyphMetrics.xBearing + glyphMetrics.width );
+        penX += ( glyphMetrics.advance + parameters.interGlyphExtraAdvance );
+      }
+    }
+  }
+
+  void ReorderBiDiLayout( const Parameters& parameters,
+                          LayoutBidiParameters& bidiParameters,
+                          const LineLayout& currentLineLayout,
+                          LineLayout& lineLayout,
+                          bool breakInCharacters )
+  {
+    const Length* const charactersPerGlyphBuffer = parameters.textModel->mVisualModel->mCharactersPerGlyph.Begin();
+
+    // The last glyph to be laid-out.
+    const GlyphIndex lastGlyphOfParagraphPlusOne = parameters.startGlyphIndex + parameters.numberOfGlyphs;
+
+    const Vector<BidirectionalParagraphInfoRun>& bidirectionalParagraphsInfo = parameters.textModel->mLogicalModel->mBidirectionalParagraphInfo;
+
+    const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo = bidirectionalParagraphsInfo[bidiParameters.bidiParagraphIndex];
+    if( ( lineLayout.characterIndex >= bidirectionalParagraphInfo.characterRun.characterIndex ) &&
+        ( lineLayout.characterIndex < bidirectionalParagraphInfo.characterRun.characterIndex + bidirectionalParagraphInfo.characterRun.numberOfCharacters ) )
+    {
+      Vector<BidirectionalLineInfoRun>& bidirectionalLinesInfo = parameters.textModel->mLogicalModel->mBidirectionalLineInfo;
+
+      // Sets the visual to logical map tables needed to reorder the text.
+      ReorderLine( bidirectionalParagraphInfo,
+                   bidirectionalLinesInfo,
+                   bidiParameters.bidiLineIndex,
+                   lineLayout.characterIndex,
+                   lineLayout.numberOfCharacters,
+                   bidiParameters.paragraphDirection );
+
+      // Recalculate the length of the line and update the layout.
+      const BidirectionalLineInfoRun& bidirectionalLineInfo = *( bidirectionalLinesInfo.Begin() + bidiParameters.bidiLineIndex );
+
+      if( !bidirectionalLineInfo.isIdentity )
+      {
+        float length = 0.f;
+        float whiteSpaceLengthEndOfLine = 0.f;
+        LayoutRightToLeft( parameters,
+                           bidirectionalLineInfo,
+                           length,
+                           whiteSpaceLengthEndOfLine );
+
+        lineLayout.whiteSpaceLengthEndOfLine = whiteSpaceLengthEndOfLine;
+        if( !Equals( length, lineLayout.length ) )
+        {
+          const bool isMultiline = mLayout == MULTI_LINE_BOX;
+
+          if( isMultiline && ( length > parameters.boundingBox.width ) )
+          {
+            if( breakInCharacters || ( isMultiline && ( 0u == currentLineLayout.numberOfGlyphs ) ) )
+            {
+              // The word doesn't fit in one line. It has to be split by character.
+
+              // Remove the last laid out glyph(s) as they doesn't fit.
+              for( GlyphIndex glyphIndex = lineLayout.glyphIndex + lineLayout.numberOfGlyphs - 1u; glyphIndex >= lineLayout.glyphIndex; )
+              {
+                const Length numberOfGLyphsInGroup = GetNumberOfGlyphsOfGroup( glyphIndex,
+                                                                               lastGlyphOfParagraphPlusOne,
+                                                                               charactersPerGlyphBuffer );
+
+                const Length numberOfCharacters = *( charactersPerGlyphBuffer + glyphIndex + numberOfGLyphsInGroup - 1u );
+
+                lineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
+                lineLayout.numberOfCharacters -= numberOfCharacters;
+
+                AdjustLayout( parameters,
+                              bidiParameters,
+                              bidirectionalParagraphInfo,
+                              lineLayout );
+
+                if( lineLayout.length < parameters.boundingBox.width )
+                {
+                  break;
+                }
+
+                if( glyphIndex < numberOfGLyphsInGroup )
+                {
+                  // avoids go under zero for an unsigned int.
+                  break;
+                }
+
+                glyphIndex -= numberOfGLyphsInGroup;
+              }
+            }
+            else
+            {
+              lineLayout  = currentLineLayout;
+
+              AdjustLayout( parameters,
+                            bidiParameters,
+                            bidirectionalParagraphInfo,
+                            lineLayout );
+            }
+          }
+          else
+          {
+            lineLayout.length = length;
+          }
+        }
+      }
+    }
+  }
+
+  void AdjustLayout( const Parameters& parameters,
+                     LayoutBidiParameters& bidiParameters,
+                     const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo,
+                     LineLayout& lineLayout )
+  {
+    Vector<BidirectionalLineInfoRun>& bidirectionalLinesInfo = parameters.textModel->mLogicalModel->mBidirectionalLineInfo;
+
+    // Remove current reordered line.
+    bidirectionalLinesInfo.Erase( bidirectionalLinesInfo.Begin() + bidiParameters.bidiLineIndex );
+
+    // Re-build the conversion table without the removed glyphs.
+    ReorderLine( bidirectionalParagraphInfo,
+                 bidirectionalLinesInfo,
+                 bidiParameters.bidiLineIndex,
+                 lineLayout.characterIndex,
+                 lineLayout.numberOfCharacters,
+                 bidiParameters.paragraphDirection );
+
+    const BidirectionalLineInfoRun& bidirectionalLineInfo = *( bidirectionalLinesInfo.Begin() + bidiParameters.bidiLineIndex );
+
+    float length = 0.f;
+    float whiteSpaceLengthEndOfLine = 0.f;
+    LayoutRightToLeft( parameters,
+                       bidirectionalLineInfo,
+                       length,
+                       whiteSpaceLengthEndOfLine );
+
+    lineLayout.length = length;
+    lineLayout.whiteSpaceLengthEndOfLine = whiteSpaceLengthEndOfLine;
+  }
+
   /**
    * Retrieves the line layout for a given box width.
    *
-   * @note This method lais out text as it were left to right. At this point is not possible to reorder the line
-   *       because the number of characters of the line is not known (one of the responsabilities of this method
-   *       is calculate that). Due to glyph's 'x' bearing, width and advance, when right to left or mixed right to left
-   *       and left to right text is laid-out, it can be small differences in the line length. One solution is to
-   *       reorder and re-lay out the text after this method and add or remove one extra glyph if needed. However,
-   *       this method calculates which are the first and last glyphs of the line (the ones that causes the
-   *       differences). This is a good point to check if there is problems with the text exceeding the boundaries
-   *       of the control when there is right to left text.
+   * @note This method starts to layout text as if it was left to right. However, it might be differences in the length
+   *       of the line if it's a bidirectional one. If the paragraph is bidirectional, this method will call a function
+   *       to reorder the line and recalculate its length.
    *
+
    * @param[in] parameters The layout parameters.
+   * @param[] bidiParameters Bidirectional info for the current line.
    * @param[out] lineLayout The line layout.
-   * @param[in,out] paragraphDirection in: the current paragraph's direction, out: the next paragraph's direction. Is set after a must break.
    * @param[in] completelyFill Whether to completely fill the line ( even if the last word exceeds the boundaries ).
    */
   void GetLineLayoutForBox( const Parameters& parameters,
+                            LayoutBidiParameters& bidiParameters,
                             LineLayout& lineLayout,
-                            CharacterDirection& paragraphDirection,
                             bool completelyFill )
   {
     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 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 +457,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,10 +477,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;
-
-    // Initialize the advance of the previous glyph.
-    tmpLineLayout.previousAdvance = 0.f;
+    tmpLineLayout.penX = -glyphMetrics.xBearing + mCursorWidth + outlineWidth;
 
     // Calculate the line height if there is no characters.
     FontId lastFontId = glyphMetrics.fontId;
@@ -248,16 +493,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 +515,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 +530,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.
@@ -294,21 +539,22 @@ struct Engine::Impl
       const float previousTmpPenX = tmpLineLayout.penX;
       const float previousTmpAdvance = tmpLineLayout.previousAdvance;
       const float previousTmpLength = tmpLineLayout.length;
-      const float previousTmpWsLengthEndOfLine = tmpLineLayout.wsLengthEndOfLine;
+      const float previousTmpWhiteSpaceLengthEndOfLine = tmpLineLayout.whiteSpaceLengthEndOfLine;
 
       if( isWhiteSpace )
       {
         // Add the length to the length of white spaces at the end of the line.
-        tmpLineLayout.wsLengthEndOfLine += glyphMetrics.advance; // The advance is used as the width is always zero for the white spaces.
+        tmpLineLayout.whiteSpaceLengthEndOfLine += glyphMetrics.advance; // The advance is used as the width is always zero for the white spaces.
       }
       else
       {
-        tmpLineLayout.penX += tmpLineLayout.previousAdvance + tmpLineLayout.wsLengthEndOfLine;
+        tmpLineLayout.penX += tmpLineLayout.previousAdvance + tmpLineLayout.whiteSpaceLengthEndOfLine;
         tmpLineLayout.previousAdvance = ( glyphMetrics.advance + parameters.interGlyphExtraAdvance );
+
         tmpLineLayout.length = tmpLineLayout.penX + glyphMetrics.xBearing + glyphMetrics.width;
 
         // Clear the white space length at the end of the line.
-        tmpLineLayout.wsLengthEndOfLine = 0.f;
+        tmpLineLayout.whiteSpaceLengthEndOfLine = 0.f;
       }
 
       // Check if the accumulated length fits in the width of the box.
@@ -329,7 +575,7 @@ struct Engine::Impl
             tmpLineLayout.penX = previousTmpPenX;
             tmpLineLayout.previousAdvance = previousTmpAdvance;
             tmpLineLayout.length = previousTmpLength;
-            tmpLineLayout.wsLengthEndOfLine = previousTmpWsLengthEndOfLine;
+            tmpLineLayout.whiteSpaceLengthEndOfLine = previousTmpWhiteSpaceLengthEndOfLine;
           }
 
           // Add part of the word to the line layout.
@@ -342,20 +588,35 @@ struct Engine::Impl
 
         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--GetLineLayoutForBox.\n" );
 
+        // Reorder the RTL line.
+        if( bidiParameters.isBidirectional )
+        {
+          ReorderBiDiLayout( parameters,
+                             bidiParameters,
+                             lineLayout,
+                             lineLayout,
+                             true );
+        }
+
         return;
       }
 
       if( ( isMultiline || isLastGlyph ) &&
           ( TextAbstraction::LINE_MUST_BREAK == lineBreakInfo ) )
       {
+        LineLayout currentLineLayout = lineLayout;
+
         // Must break the line. Update the line layout and return.
         MergeLineLayout( lineLayout, tmpLineLayout );
 
-        // Set the next paragraph's direction.
-        if( !isLastGlyph &&
-            ( NULL != parameters.characterDirectionBuffer ) )
+       // Reorder the RTL line.
+        if( bidiParameters.isBidirectional )
         {
-          paragraphDirection = *( parameters.characterDirectionBuffer + 1u + characterLastIndex );
+          ReorderBiDiLayout( parameters,
+                             bidiParameters,
+                             currentLineLayout,
+                             lineLayout,
+                             false );
         }
 
         DALI_LOG_INFO( gLogFilter, Debug::Verbose, "  Must break\n" );
@@ -410,6 +671,69 @@ struct Engine::Impl
     }
   }
 
+  void SetGlyphPositions( const Parameters& layoutParameters,
+                          Vector2* glyphPositionsBuffer,
+                          LayoutBidiParameters& layoutBidiParameters,
+                          const LineLayout& layout )
+  {
+    const Character* const textBuffer = layoutParameters.textModel->mLogicalModel->mText.Begin();
+    const BidirectionalLineInfoRun& bidiLine = layoutParameters.textModel->mLogicalModel->mBidirectionalLineInfo[layoutBidiParameters.bidiLineIndex];
+    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();
+
+    CharacterIndex characterLogicalIndex = 0u;
+    CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *( bidiLine.visualToLogicalMap + characterLogicalIndex );
+
+    float penX = 0.f;
+    while( TextAbstraction::IsWhiteSpace( *( textBuffer + characterVisualIndex ) ) )
+    {
+      const GlyphIndex glyphIndex = *( charactersToGlyphsBuffer + characterVisualIndex );
+      const GlyphInfo& glyph = *( glyphsBuffer + glyphIndex );
+
+      Vector2& position = *( glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex );
+      position.x = penX;
+      position.y = -glyph.yBearing;
+
+      penX += glyph.advance;
+
+      ++characterLogicalIndex;
+      characterVisualIndex = bidiLine.characterRun.characterIndex + *( bidiLine.visualToLogicalMap + characterLogicalIndex );
+    }
+
+    const GlyphIndex glyphIndex = *( charactersToGlyphsBuffer + characterVisualIndex );
+    const GlyphInfo& glyph = *( glyphsBuffer + glyphIndex );
+
+    penX += -glyph.xBearing;
+
+    // Traverses the characters of the right to left paragraph.
+    for( ; characterLogicalIndex < bidiLine.characterRun.numberOfCharacters;
+         ++characterLogicalIndex )
+    {
+      // Convert the character in the logical order into the character in the visual order.
+      const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *( bidiLine.visualToLogicalMap + characterLogicalIndex );
+
+      // Get the number of glyphs of the character.
+      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 = *( charactersToGlyphsBuffer + characterVisualIndex ) + index;
+
+        DALI_ASSERT_DEBUG( 0u <= glyphIndex && glyphIndex < layoutParameters.textModel->mVisualModel->mGlyphs.Count() );
+
+        const GlyphInfo& glyph = *( glyphsBuffer + glyphIndex );
+        Vector2& position = *( glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex );
+
+        position.x = std::round( penX + glyph.xBearing );
+        position.y = -glyph.yBearing;
+
+       penX += ( glyph.advance + layoutParameters.interGlyphExtraAdvance );
+      }
+    }
+  }
+
   /**
    * @brief Resizes the line buffer.
    *
@@ -425,7 +749,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 )
@@ -458,13 +782,13 @@ struct Engine::Impl
    * return Whether the line is ellipsized.
    */
   bool EllipsisLine( const Parameters& layoutParameters,
+                     LayoutBidiParameters& layoutBidiParameters,
                      const LineLayout& layout,
                      Size& layoutSize,
                      LineRun* linesBuffer,
                      Vector2* glyphPositionsBuffer,
                      Length& numberOfLines,
                      float penY,
-                     CharacterDirection currentParagraphDirection,
                      bool& isAutoScrollEnabled )
   {
     const bool ellipsis = isAutoScrollEnabled ? ( penY - layout.descender > layoutParameters.boundingBox.height ) :
@@ -480,7 +804,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 )
       {
@@ -503,18 +827,17 @@ struct Engine::Impl
       }
 
       GetLineLayoutForBox( layoutParameters,
+                           layoutBidiParameters,
                            ellipsisLayout,
-                           currentParagraphDirection,
                            true );
 
       lineRun->glyphRun.numberOfGlyphs = ellipsisLayout.numberOfGlyphs;
       lineRun->characterRun.characterIndex = ellipsisLayout.characterIndex;
       lineRun->characterRun.numberOfCharacters = ellipsisLayout.numberOfCharacters;
       lineRun->width = ellipsisLayout.length;
-      lineRun->extraLength = std::ceil( ellipsisLayout.wsLengthEndOfLine );
+      lineRun->extraLength = std::ceil( ellipsisLayout.whiteSpaceLengthEndOfLine );
       lineRun->ascender = ellipsisLayout.ascender;
       lineRun->descender = ellipsisLayout.descender;
-      lineRun->direction = !RTL;
       lineRun->ellipsis = true;
 
       layoutSize.width = layoutParameters.boundingBox.width;
@@ -523,11 +846,50 @@ struct Engine::Impl
         layoutSize.height += ( lineRun->ascender + -lineRun->descender ) + lineRun->lineSpacing;
       }
 
-      SetGlyphPositions( layoutParameters.glyphsBuffer + lineRun->glyphRun.glyphIndex,
-                         ellipsisLayout.numberOfGlyphs,
-                         layoutParameters.outlineWidth,
-                         layoutParameters.interGlyphExtraAdvance,
-                         glyphPositionsBuffer + lineRun->glyphRun.glyphIndex - layoutParameters.startGlyphIndex );
+      const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
+      const float outlineWidth = static_cast<float>( layoutParameters.textModel->GetOutlineWidth() );
+
+      const Vector<BidirectionalLineInfoRun>& bidirectionalLinesInfo = layoutParameters.textModel->mLogicalModel->mBidirectionalLineInfo;
+
+      if( layoutBidiParameters.isBidirectional )
+      {
+        layoutBidiParameters.bidiLineIndex = 0u;
+        for( Vector<BidirectionalLineInfoRun>::ConstIterator it = bidirectionalLinesInfo.Begin(),
+               endIt = bidirectionalLinesInfo.End();
+             it != endIt;
+             ++it, ++layoutBidiParameters.bidiLineIndex )
+        {
+          const BidirectionalLineInfoRun& run = *it;
+
+          if( ellipsisLayout.characterIndex == run.characterRun.characterIndex )
+          {
+            // Found where to insert the bidi line info.
+            break;
+          }
+        }
+      }
+
+      const BidirectionalLineInfoRun* const bidirectionalLineInfo = ( layoutBidiParameters.isBidirectional && !bidirectionalLinesInfo.Empty() ) ? &bidirectionalLinesInfo[layoutBidiParameters.bidiLineIndex] : nullptr;
+
+      if( ( nullptr != bidirectionalLineInfo ) &&
+          !bidirectionalLineInfo->isIdentity &&
+          ( ellipsisLayout.characterIndex == bidirectionalLineInfo->characterRun.characterIndex ) )
+      {
+        lineRun->direction = RTL;
+        SetGlyphPositions( layoutParameters,
+                           glyphPositionsBuffer,
+                           layoutBidiParameters,
+                           ellipsisLayout );
+      }
+      else
+      {
+        lineRun->direction = LTR;
+        SetGlyphPositions( glyphsBuffer + lineRun->glyphRun.glyphIndex,
+                           ellipsisLayout.numberOfGlyphs,
+                           outlineWidth,
+                           layoutParameters.interGlyphExtraAdvance,
+                           glyphPositionsBuffer + lineRun->glyphRun.glyphIndex - layoutParameters.startGlyphIndex );
+      }
     }
 
     return ellipsis;
@@ -563,22 +925,21 @@ struct Engine::Impl
 
     if( isLastLine && !layoutParameters.isLastNewParagraph )
     {
-      const float width = layout.length + layout.wsLengthEndOfLine;
-      if( MULTI_LINE_BOX == mLayout )
+      lineRun.width = layout.length;
+      if( LTR == layout.direction )
       {
-        lineRun.width = ( width > layoutParameters.boundingBox.width ) ? layoutParameters.boundingBox.width : width;
+        lineRun.width += layout.whiteSpaceLengthEndOfLine;
+        lineRun.extraLength = 0.f;
       }
       else
       {
-        lineRun.width = width;
+        lineRun.extraLength = layout.whiteSpaceLengthEndOfLine;
       }
-
-      lineRun.extraLength = 0.f;
     }
     else
     {
       lineRun.width = layout.length;
-      lineRun.extraLength = std::ceil( layout.wsLengthEndOfLine );
+      lineRun.extraLength = std::ceil( layout.whiteSpaceLengthEndOfLine );
     }
 
     // Rounds upward to avoid a non integer size.
@@ -586,7 +947,7 @@ struct Engine::Impl
 
     lineRun.ascender = layout.ascender;
     lineRun.descender = layout.descender;
-    lineRun.direction = !RTL;
+    lineRun.direction = layout.direction;
     lineRun.ellipsis = false;
 
     // Update the actual size.
@@ -615,8 +976,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 +999,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;
 
@@ -697,9 +1060,7 @@ struct Engine::Impl
     }
   }
 
-  bool LayoutText( const Parameters& layoutParameters,
-                   Vector<Vector2>& glyphPositions,
-                   Vector<LineRun>& lines,
+  bool LayoutText( Parameters& layoutParameters,
                    Size& layoutSize,
                    bool elideTextEnabled,
                    bool& isAutoScrollEnabled )
@@ -707,6 +1068,8 @@ struct Engine::Impl
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->LayoutText\n" );
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "  box size %f, %f\n", layoutParameters.boundingBox.width, layoutParameters.boundingBox.height );
 
+    Vector<LineRun>& lines = layoutParameters.textModel->mVisualModel->mLines;
+
     if( 0u == layoutParameters.numberOfGlyphs )
     {
       // Add an extra line if the last character is a new paragraph character and the last line doesn't have zero characters.
@@ -746,6 +1109,8 @@ struct Engine::Impl
     }
 
     const GlyphIndex lastGlyphPlusOne = layoutParameters.startGlyphIndex + layoutParameters.numberOfGlyphs;
+    const Length totalNumberOfGlyphs = layoutParameters.textModel->mVisualModel->mGlyphs.Count();
+    Vector<Vector2>& glyphPositions = layoutParameters.textModel->mVisualModel->mGlyphPositions;
 
     // 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 +1119,29 @@ struct Engine::Impl
       Vector<LineRun>::Iterator lastLine = lines.End() - 1u;
 
       if( ( 0u == lastLine->characterRun.numberOfCharacters ) &&
-          ( lastGlyphPlusOne == layoutParameters.totalNumberOfGlyphs ) )
+          ( lastGlyphPlusOne == totalNumberOfGlyphs ) )
       {
         lines.Remove( lastLine );
       }
     }
 
-    // Set the first paragraph's direction.
-    CharacterDirection paragraphDirection = ( NULL != layoutParameters.characterDirectionBuffer ) ? *layoutParameters.characterDirectionBuffer : !RTL;
+    // Retrieve BiDi info.
+    const bool hasBidiParagraphs = !layoutParameters.textModel->mLogicalModel->mBidirectionalParagraphInfo.Empty();
+
+    const CharacterIndex* const glyphsToCharactersBuffer = hasBidiParagraphs ? layoutParameters.textModel->mVisualModel->mGlyphsToCharacters.Begin() : nullptr;
+    const Vector<BidirectionalParagraphInfoRun>& bidirectionalParagraphsInfo = layoutParameters.textModel->mLogicalModel->mBidirectionalParagraphInfo;
+    const Vector<BidirectionalLineInfoRun>& bidirectionalLinesInfo = layoutParameters.textModel->mLogicalModel->mBidirectionalLineInfo;
+
+    // Set the layout bidirectional paramters.
+    LayoutBidiParameters layoutBidiParameters;
 
     // 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.
@@ -794,17 +1166,74 @@ struct Engine::Impl
 
     float penY = CalculateLineOffset( lines,
                                       layoutParameters.startLineIndex );
-
     for( GlyphIndex index = layoutParameters.startGlyphIndex; index < lastGlyphPlusOne; )
     {
-      CharacterDirection currentParagraphDirection = paragraphDirection;
+      layoutBidiParameters.Clear();
+
+      if( hasBidiParagraphs )
+      {
+        const CharacterIndex startCharacterIndex = *( glyphsToCharactersBuffer + index );
+
+        for( Vector<BidirectionalParagraphInfoRun>::ConstIterator it = bidirectionalParagraphsInfo.Begin(),
+               endIt = bidirectionalParagraphsInfo.End();
+             it != endIt;
+             ++it, ++layoutBidiParameters.bidiParagraphIndex )
+        {
+          const BidirectionalParagraphInfoRun& run = *it;
+
+          const CharacterIndex lastCharacterIndex = run.characterRun.characterIndex + run.characterRun.numberOfCharacters;
+
+          if( lastCharacterIndex <= startCharacterIndex )
+          {
+            // Do not process, the paragraph has already been processed.
+            continue;
+          }
+
+          if( startCharacterIndex >= run.characterRun.characterIndex && startCharacterIndex < lastCharacterIndex )
+          {
+            layoutBidiParameters.paragraphDirection = run.direction;
+            layoutBidiParameters.isBidirectional = true;
+          }
+
+          // Has already been found.
+          break;
+        }
+
+        if( layoutBidiParameters.isBidirectional )
+        {
+          for( Vector<BidirectionalLineInfoRun>::ConstIterator it = bidirectionalLinesInfo.Begin(),
+                 endIt = bidirectionalLinesInfo.End();
+               it != endIt;
+               ++it, ++layoutBidiParameters.bidiLineIndex )
+          {
+            const BidirectionalLineInfoRun& run = *it;
+
+            const CharacterIndex lastCharacterIndex = run.characterRun.characterIndex + run.characterRun.numberOfCharacters;
+
+            if( lastCharacterIndex <= startCharacterIndex )
+            {
+              // skip
+              continue;
+            }
+
+            if( startCharacterIndex < lastCharacterIndex )
+            {
+              // Found where to insert the bidi line info.
+              break;
+            }
+          }
+        }
+      }
+
+      CharacterDirection currentParagraphDirection = layoutBidiParameters.paragraphDirection;
 
       // Get the layout for the line.
       LineLayout layout;
+      layout.direction = layoutBidiParameters.paragraphDirection;
       layout.glyphIndex = index;
       GetLineLayoutForBox( layoutParameters,
+                           layoutBidiParameters,
                            layout,
-                           paragraphDirection,
                            false );
 
       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "           glyph index %d\n", layout.glyphIndex );
@@ -835,15 +1264,17 @@ struct Engine::Impl
       bool ellipsis = false;
       if( elideTextEnabled )
       {
+        layoutBidiParameters.paragraphDirection = currentParagraphDirection;
+
         // Does the ellipsis of the last line.
         ellipsis = EllipsisLine( layoutParameters,
+                                 layoutBidiParameters,
                                  layout,
                                  layoutSize,
                                  linesBuffer,
                                  glyphPositionsBuffer,
                                  numberOfLines,
                                  penY,
-                                 currentParagraphDirection,
                                  isAutoScrollEnabled );
       }
 
@@ -855,10 +1286,11 @@ 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 )
         {
+
           // Reserve more space for the next lines.
           linesBuffer = ResizeLinesBuffer( lines,
                                            newLines,
@@ -877,7 +1309,7 @@ struct Engine::Impl
 
         const GlyphIndex nextIndex = index + layout.numberOfGlyphs;
 
-        if( ( nextIndex == layoutParameters.totalNumberOfGlyphs ) &&
+        if( ( nextIndex == totalNumberOfGlyphs ) &&
             layoutParameters.isLastNewParagraph &&
             ( mLayout == MULTI_LINE_BOX ) )
         {
@@ -902,12 +1334,30 @@ struct Engine::Impl
                             numberOfLines );
         } // whether to add a last line.
 
-        // Sets the positions of the glyphs.
-        SetGlyphPositions( layoutParameters.glyphsBuffer + index,
-                           layout.numberOfGlyphs,
-                           layoutParameters.outlineWidth,
-                           layoutParameters.interGlyphExtraAdvance,
-                           glyphPositionsBuffer + index - layoutParameters.startGlyphIndex );
+        const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
+        const float outlineWidth = static_cast<float>( layoutParameters.textModel->GetOutlineWidth() );
+
+        const BidirectionalLineInfoRun* const bidirectionalLineInfo = ( layoutBidiParameters.isBidirectional && !bidirectionalLinesInfo.Empty() ) ? &bidirectionalLinesInfo[layoutBidiParameters.bidiLineIndex] : nullptr;
+
+        if( ( nullptr != bidirectionalLineInfo ) &&
+            !bidirectionalLineInfo->isIdentity &&
+            ( layout.characterIndex == bidirectionalLineInfo->characterRun.characterIndex ) )
+        {
+          SetGlyphPositions( layoutParameters,
+                             glyphPositionsBuffer,
+                             layoutBidiParameters,
+                             layout );
+        }
+        else
+        {
+
+          // Sets the positions of the glyphs.
+          SetGlyphPositions( glyphsBuffer + index,
+                             layout.numberOfGlyphs,
+                             outlineWidth,
+                             layoutParameters.interGlyphExtraAdvance,
+                             glyphPositionsBuffer + index - layoutParameters.startGlyphIndex );
+        }
 
         // Updates the vertical pen's position.
         penY += -layout.descender + layout.lineSpacing + mDefaultLineSpacing;
@@ -922,7 +1372,7 @@ struct Engine::Impl
       glyphPositions.Insert( glyphPositions.Begin() + layoutParameters.startGlyphIndex,
                              newGlyphPositions.Begin(),
                              newGlyphPositions.End() );
-      glyphPositions.Resize( layoutParameters.totalNumberOfGlyphs );
+      glyphPositions.Resize( totalNumberOfGlyphs );
 
       newLines.Resize( numberOfLines );
 
@@ -963,65 +1413,6 @@ struct Engine::Impl
     return true;
   }
 
-  void ReLayoutRightToLeftLines( const Parameters& layoutParameters,
-                                 CharacterIndex startIndex,
-                                 Length numberOfCharacters,
-                                 Vector<Vector2>& glyphPositions )
-  {
-    const CharacterIndex lastCharacterIndex = startIndex + numberOfCharacters;
-
-    // Traverses the paragraphs with right to left characters.
-    for( LineIndex lineIndex = 0u; lineIndex < layoutParameters.numberOfBidirectionalInfoRuns; ++lineIndex )
-    {
-      const BidirectionalLineInfoRun& bidiLine = *( layoutParameters.lineBidirectionalInfoRunsBuffer + lineIndex );
-
-      if( startIndex >= bidiLine.characterRun.characterIndex + bidiLine.characterRun.numberOfCharacters )
-      {
-        // Do not reorder the line if it has been already reordered.
-        continue;
-      }
-
-      if( bidiLine.characterRun.characterIndex >= lastCharacterIndex )
-      {
-        // Do not reorder the lines after the last requested character.
-        break;
-      }
-
-      const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *bidiLine.visualToLogicalMap;
-      const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + *( layoutParameters.charactersToGlyphsBuffer + characterVisualIndex ) );
-
-      float penX = -glyph.xBearing + layoutParameters.outlineWidth + mCursorWidth;
-
-      Vector2* glyphPositionsBuffer = glyphPositions.Begin();
-
-      // Traverses the characters of the right to left paragraph.
-      for( CharacterIndex characterLogicalIndex = 0u;
-           characterLogicalIndex < bidiLine.characterRun.numberOfCharacters;
-           ++characterLogicalIndex )
-      {
-        // Convert the character in the logical order into the character in the visual order.
-        const CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *( bidiLine.visualToLogicalMap + characterLogicalIndex );
-
-        // Get the number of glyphs of the character.
-        const Length numberOfGlyphs = *( layoutParameters.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;
-
-          DALI_ASSERT_DEBUG( 0u <= glyphIndex && glyphIndex < layoutParameters.totalNumberOfGlyphs );
-
-          const GlyphInfo& glyph = *( layoutParameters.glyphsBuffer + glyphIndex );
-          Vector2& position = *( glyphPositionsBuffer + glyphIndex );
-
-          position.x = std::round( penX + glyph.xBearing );
-          penX += ( glyph.advance + layoutParameters.interGlyphExtraAdvance );
-        }
-      }
-    }
-  }
-
   void Align( const Size& size,
               CharacterIndex startIndex,
               Length numberOfCharacters,
@@ -1080,6 +1471,7 @@ struct Engine::Impl
   {
     line.alignmentOffset = 0.f;
     const bool isLineRTL = RTL == line.direction;
+
     // Whether to swap the alignment.
     // Swap if the line is RTL and is not required to match the direction of the system's language or if it's required to match the direction of the system's language and it's RTL.
     bool isLayoutRTL = isLineRTL;
@@ -1166,7 +1558,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 +1571,7 @@ struct Engine::Impl
 };
 
 Engine::Engine()
-: mImpl( NULL )
+: mImpl{ nullptr }
 {
   mImpl = new Engine::Impl();
 }
@@ -1215,32 +1607,17 @@ int Engine::GetCursorWidth() const
   return static_cast<int>( mImpl->mCursorWidth );
 }
 
-bool Engine::LayoutText( const Parameters& layoutParameters,
-                         Vector<Vector2>& glyphPositions,
-                         Vector<LineRun>& lines,
+bool Engine::LayoutText( Parameters& layoutParameters,
                          Size& layoutSize,
                          bool elideTextEnabled,
                          bool& isAutoScrollEnabled )
 {
   return mImpl->LayoutText( layoutParameters,
-                            glyphPositions,
-                            lines,
                             layoutSize,
                             elideTextEnabled,
                             isAutoScrollEnabled );
 }
 
-void Engine::ReLayoutRightToLeftLines( const Parameters& layoutParameters,
-                                       CharacterIndex startIndex,
-                                       Length numberOfCharacters,
-                                       Vector<Vector2>& glyphPositions )
-{
-  mImpl->ReLayoutRightToLeftLines( layoutParameters,
-                                   startIndex,
-                                   numberOfCharacters,
-                                   glyphPositions );
-}
-
 void Engine::Align( const Size& size,
                     CharacterIndex startIndex,
                     Length numberOfCharacters,
index 58466a9..af693da 100755 (executable)
@@ -103,38 +103,21 @@ public:
   /**
    * @brief Store the visual position of glyphs in the VisualModel.
    *
-   * @param[in] layoutParameters The parameters needed to layout the text.
-   * @param[out] glyphPositions The positions of all the glyphs.
-   * @param[out] lines The laid-out lines.
+   * Builds the bidirectional info and reorders RTL lines.
+   *
+   * @param[in,out] layoutParameters The parameters needed to layout the text.
    * @param[out] layoutSize The size of the text after it has been laid-out.
    * @param[in] elideTextEnabled Whether the text elide is enabled.
    * @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
    *
    * @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
    */
-  bool LayoutText( const Parameters& layoutParameters,
-                   Vector<Vector2>& glyphPositions,
-                   Vector<LineRun>& lines,
+  bool LayoutText( Parameters& layoutParameters,
                    Size& layoutSize,
                    bool elideTextEnabled,
                    bool& isAutoScrollEnabled );
 
   /**
-   * @brief Re-lays out those lines with right to left characters.
-   *
-   * It doesn't change the phisical position of the glyphs in the model but sets their new position.
-   *
-   * @param[in] layoutParameters The parameters needed to layout the text.
-   * @param[in] startIndex Character index of the line from where the lines are reordered.
-   * @param[in] numberOfCharacters The number of characters.
-   * @param[in,out] glyphPositions The positions of all the glyphs.
-   */
-  void ReLayoutRightToLeftLines( const Parameters& layoutParameters,
-                                 CharacterIndex startIndex,
-                                 Length numberOfCharacters,
-                                 Vector<Vector2>& glyphPositions );
-
-  /**
    * @brief Aligns the laid out lines.
    *
    * @param[in] size The size of the container where the text is laid-out.
index e877e64..b3aeaad 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 66c6d89..3d9440e 100755 (executable)
@@ -289,6 +289,14 @@ void LogicalModel::UpdateTextStyleRuns( CharacterIndex index, int numberOfCharac
                                  mColorRuns,
                                  removedColorRuns );
 
+  // Process the background color runs.
+  Vector<ColorRun> removedBackgroundColorRuns;
+  UpdateCharacterRuns<ColorRun>( index,
+                                 numberOfCharacters,
+                                 totalNumberOfCharacters,
+                                 mBackgroundColorRuns,
+                                 removedBackgroundColorRuns );
+
   // Process the font description runs.
   Vector<FontDescriptionRun> removedFontDescriptionRuns;
   UpdateCharacterRuns<FontDescriptionRun>( index,
index b2fc5a1..3c01dc6 100755 (executable)
@@ -211,9 +211,9 @@ public:
   Vector<ScriptRun>                     mScriptRuns;
   Vector<FontRun>                       mFontRuns;
   Vector<ColorRun>                      mColorRuns;
+  Vector<ColorRun>                      mBackgroundColorRuns;
   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 83a518b..c79dbd4 100755 (executable)
@@ -153,6 +153,16 @@ const ColorIndex* const ViewModel::GetColorIndices() const
   return mModel->GetColorIndices();
 }
 
+const Vector4* const ViewModel::GetBackgroundColors() const
+{
+  return mModel->GetBackgroundColors();
+}
+
+const ColorIndex* const ViewModel::GetBackgroundColorIndices() const
+{
+  return mModel->GetBackgroundColorIndices();
+}
+
 const Vector4& ViewModel::GetDefaultColor() const
 {
   return mModel->GetDefaultColor();
index bc7d45f..fe77f67 100755 (executable)
@@ -139,6 +139,16 @@ public:
   virtual const ColorIndex* const GetColorIndices() const;
 
   /**
+   * @copydoc ModelInterface::GetBackgroundColors()
+   */
+  virtual const Vector4* const GetBackgroundColors() const;
+
+  /**
+   * @copydoc ModelInterface::GetBackgroundColorIndices()
+   */
+  virtual const ColorIndex* const GetBackgroundColorIndices() const;
+
+  /**
    * @copydoc ModelInterface::GetDefaultColor()
    */
   virtual const Vector4& GetDefaultColor() const;
index 2c9a78d..fa48e52 100755 (executable)
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/key.h>
+#include <dali/public-api/rendering/renderer.h>
 #include <dali/integration-api/debug.h>
 #include <limits>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/internal/text/bidirectional-support.h>
 #include <dali-toolkit/internal/text/character-set-conversion.h>
 #include <dali-toolkit/internal/text/color-segmentation.h>
@@ -34,6 +36,8 @@
 #include <dali-toolkit/internal/text/text-control-interface.h>
 #include <dali-toolkit/internal/text/text-run-container.h>
 
+using namespace Dali;
+
 namespace
 {
 
@@ -56,6 +60,44 @@ const float MAX_FLOAT = std::numeric_limits<float>::max();
 const float MIN_FLOAT = std::numeric_limits<float>::min();
 const Dali::Toolkit::Text::CharacterDirection LTR = false; ///< Left To Right direction
 
+#define MAKE_SHADER(A)#A
+
+const char* VERTEX_SHADER_BACKGROUND = MAKE_SHADER(
+attribute mediump vec2    aPosition;
+attribute mediump vec4    aColor;
+varying   mediump vec4    vColor;
+uniform   highp mat4      uMvpMatrix;
+
+void main()
+{
+  mediump vec4 position = vec4( aPosition, 0.0, 1.0 );
+  gl_Position = uMvpMatrix * position;
+  vColor = aColor;
+}
+);
+
+const char* FRAGMENT_SHADER_BACKGROUND = MAKE_SHADER(
+varying mediump vec4      vColor;
+uniform lowp    vec4      uColor;
+
+void main()
+{
+  gl_FragColor = vColor * uColor;
+}
+);
+
+struct BackgroundVertex
+{
+  Vector2 mPosition;        ///< Vertex posiiton
+  Vector4 mColor;           ///< Vertex color
+};
+
+struct BackgroundMesh
+{
+  Vector< BackgroundVertex > mVertices;    ///< container of vertices
+  Vector< unsigned short > mIndices;       ///< container of indices
+};
+
 } // namespace
 
 namespace Dali
@@ -505,11 +547,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();
@@ -563,6 +600,7 @@ void Controller::Impl::ClearFullModelData( OperationsMask operations )
   if( NO_OPERATION != ( COLOR & operations ) )
   {
     mModel->mVisualModel->mColorIndices.Clear();
+    mModel->mVisualModel->mBackgroundColorIndices.Clear();
   }
 }
 
@@ -584,15 +622,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.
@@ -755,6 +784,13 @@ void Controller::Impl::ClearGlyphModelData( CharacterIndex startIndex, Character
       mModel->mVisualModel->mColorIndices.Erase( colorIndexBuffer + mTextUpdateInfo.mStartGlyphIndex,
                                                  colorIndexBuffer + endGlyphIndexPlusOne );
     }
+
+    if( 0u != mModel->mVisualModel->mBackgroundColorIndices.Count() )
+    {
+      ColorIndex* backgroundColorIndexBuffer = mModel->mVisualModel->mBackgroundColorIndices.Begin();
+      mModel->mVisualModel->mBackgroundColorIndices.Erase( backgroundColorIndexBuffer + mTextUpdateInfo.mStartGlyphIndex,
+                                                           backgroundColorIndexBuffer + endGlyphIndexPlusOne );
+    }
   }
 }
 
@@ -877,19 +913,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 );
 
@@ -1053,21 +1076,6 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
     updated = true;
   }
 
-  if( NO_OPERATION != ( COLOR & operations ) )
-  {
-    // Set the color runs in glyphs.
-    SetColorSegmentationInfo( mModel->mLogicalModel->mColorRuns,
-                              mModel->mVisualModel->mCharactersToGlyph,
-                              mModel->mVisualModel->mGlyphsPerCharacter,
-                              startIndex,
-                              mTextUpdateInfo.mStartGlyphIndex,
-                              requestedNumberOfCharacters,
-                              mModel->mVisualModel->mColors,
-                              mModel->mVisualModel->mColorIndices );
-
-    updated = true;
-  }
-
   if( ( NULL != mEventData ) &&
       mEventData->mPreEditFlag &&
       ( 0u != mModel->mVisualModel->mCharactersToGlyph.Count() ) )
@@ -1103,6 +1111,32 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
     }
   }
 
+  if( NO_OPERATION != ( COLOR & operations ) )
+  {
+    // Set the color runs in glyphs.
+    SetColorSegmentationInfo( mModel->mLogicalModel->mColorRuns,
+                              mModel->mVisualModel->mCharactersToGlyph,
+                              mModel->mVisualModel->mGlyphsPerCharacter,
+                              startIndex,
+                              mTextUpdateInfo.mStartGlyphIndex,
+                              requestedNumberOfCharacters,
+                              mModel->mVisualModel->mColors,
+                              mModel->mVisualModel->mColorIndices );
+
+    // Set the background color runs in glyphs.
+    SetColorSegmentationInfo( mModel->mLogicalModel->mBackgroundColorRuns,
+                              mModel->mVisualModel->mCharactersToGlyph,
+                              mModel->mVisualModel->mGlyphsPerCharacter,
+                              startIndex,
+                              mTextUpdateInfo.mStartGlyphIndex,
+                              requestedNumberOfCharacters,
+                              mModel->mVisualModel->mBackgroundColors,
+                              mModel->mVisualModel->mBackgroundColorIndices );
+
+    updated = true;
+  }
+
+
   // The estimated number of lines. Used to avoid reallocations when layouting.
   mTextUpdateInfo.mEstimatedNumberOfLines = std::max( mModel->mVisualModel->mLines.Count(), mModel->mLogicalModel->mParagraphInfo.Count() );
 
@@ -3089,6 +3123,169 @@ void Controller::Impl::RequestRelayout()
   }
 }
 
+Actor Controller::Impl::CreateBackgroundActor()
+{
+  // NOTE: Currently we only support background color for one line left-to-right text,
+  //       so the following calculation is based on one line left-to-right text only!
+
+  Actor actor;
+
+  Length numberOfGlyphs = mView.GetNumberOfGlyphs();
+  if( numberOfGlyphs > 0u )
+  {
+    Vector<GlyphInfo> glyphs;
+    glyphs.Resize( numberOfGlyphs );
+
+    Vector<Vector2> positions;
+    positions.Resize( numberOfGlyphs );
+
+    // Get the line where the glyphs are laid-out.
+    const LineRun* lineRun = mModel->mVisualModel->mLines.Begin();
+    float alignmentOffset = lineRun->alignmentOffset;
+    numberOfGlyphs = mView.GetGlyphs( glyphs.Begin(),
+                                      positions.Begin(),
+                                      alignmentOffset,
+                                      0u,
+                                      numberOfGlyphs );
+
+    glyphs.Resize( numberOfGlyphs );
+    positions.Resize( numberOfGlyphs );
+
+    const GlyphInfo* const glyphsBuffer = glyphs.Begin();
+    const Vector2* const positionsBuffer = positions.Begin();
+
+    BackgroundMesh mesh;
+    mesh.mVertices.Reserve( 4u * glyphs.Size() );
+    mesh.mIndices.Reserve( 6u * glyphs.Size() );
+
+    const Vector2 textSize = mView.GetLayoutSize();
+
+    const float offsetX = textSize.width * 0.5f;
+    const float offsetY = textSize.height * 0.5f;
+
+    const Vector4* const backgroundColorsBuffer = mView.GetBackgroundColors();
+    const ColorIndex* const backgroundColorIndicesBuffer = mView.GetBackgroundColorIndices();
+
+    Vector4 quad;
+    uint32_t numberOfQuads = 0u;
+
+    for( uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i )
+    {
+      const GlyphInfo& glyph = *( glyphsBuffer + i );
+
+      // Get the background color of the character.
+      // The color index zero is reserved for the default background color (i.e. Color::TRANSPARENT)
+      const ColorIndex backgroundColorIndex = ( nullptr == backgroundColorsBuffer ) ? 0u : *( backgroundColorIndicesBuffer + i );
+      const Vector4& backgroundColor = ( 0u == backgroundColorIndex ) ? Color::TRANSPARENT : *( backgroundColorsBuffer + backgroundColorIndex - 1u );
+
+      // Only create quads for glyphs with a background color
+      if ( backgroundColor != Color::TRANSPARENT )
+      {
+        const Vector2 position = *( positionsBuffer + i );
+
+        if ( i == 0u && glyphSize == 1u ) // Only one glyph in the whole text
+        {
+          quad.x = position.x;
+          quad.y = 0.0f;
+          quad.z = quad.x + std::max( glyph.advance, glyph.xBearing + glyph.width );
+          quad.w = textSize.height;
+        }
+        else if ( i == 0u ) // The first glyph in the whole text
+        {
+          quad.x = position.x;
+          quad.y = 0.0f;
+          quad.z = quad.x - glyph.xBearing + glyph.advance;
+          quad.w = textSize.height;
+        }
+        else if ( i == glyphSize - 1u ) // The last glyph in the whole text
+        {
+          quad.x = position.x - glyph.xBearing;
+          quad.y = 0.0f;
+          quad.z = quad.x + std::max( glyph.advance, glyph.xBearing + glyph.width );
+          quad.w = textSize.height;
+        }
+        else // The glyph in the middle of the text
+        {
+          quad.x = position.x - glyph.xBearing;
+          quad.y = 0.0f;
+          quad.z = quad.x + glyph.advance;
+          quad.w = textSize.height;
+        }
+
+        BackgroundVertex vertex;
+
+        // Top left
+        vertex.mPosition.x = quad.x - offsetX;
+        vertex.mPosition.y = quad.y - offsetY;
+        vertex.mColor = backgroundColor;
+        mesh.mVertices.PushBack( vertex );
+
+        // Top right
+        vertex.mPosition.x = quad.z - offsetX;
+        vertex.mPosition.y = quad.y - offsetY;
+        vertex.mColor = backgroundColor;
+        mesh.mVertices.PushBack( vertex );
+
+        // Bottom left
+        vertex.mPosition.x = quad.x - offsetX;
+        vertex.mPosition.y = quad.w - offsetY;
+        vertex.mColor = backgroundColor;
+        mesh.mVertices.PushBack( vertex );
+
+        // Bottom right
+        vertex.mPosition.x = quad.z - offsetX;
+        vertex.mPosition.y = quad.w - offsetY;
+        vertex.mColor = backgroundColor;
+        mesh.mVertices.PushBack( vertex );
+
+        // Six indices in counter clockwise winding
+        mesh.mIndices.PushBack( 1u + 4 * numberOfQuads );
+        mesh.mIndices.PushBack( 0u + 4 * numberOfQuads );
+        mesh.mIndices.PushBack( 2u + 4 * numberOfQuads );
+        mesh.mIndices.PushBack( 2u + 4 * numberOfQuads );
+        mesh.mIndices.PushBack( 3u + 4 * numberOfQuads );
+        mesh.mIndices.PushBack( 1u + 4 * numberOfQuads );
+
+        numberOfQuads++;
+      }
+    }
+
+    // Only create the background actor if there are glyphs with background color
+    if ( mesh.mVertices.Count() > 0u )
+    {
+      Property::Map quadVertexFormat;
+      quadVertexFormat[ "aPosition" ] = Property::VECTOR2;
+      quadVertexFormat[ "aColor" ] = Property::VECTOR4;
+
+      PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+      quadVertices.SetData( &mesh.mVertices[ 0 ], mesh.mVertices.Size() );
+
+      Geometry quadGeometry = Geometry::New();
+      quadGeometry.AddVertexBuffer( quadVertices );
+      quadGeometry.SetIndexBuffer( &mesh.mIndices[ 0 ], mesh.mIndices.Size() );
+
+      if( !mShaderBackground )
+      {
+        mShaderBackground = Shader::New( VERTEX_SHADER_BACKGROUND, FRAGMENT_SHADER_BACKGROUND );
+      }
+
+      Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, mShaderBackground );
+      renderer.SetProperty( Dali::Renderer::Property::BLEND_MODE, BlendMode::ON );
+      renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT );
+
+      actor = Actor::New();
+      actor.SetName( "TextBackgroundColorActor" );
+      actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+      actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+      actor.SetSize( textSize );
+      actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
+      actor.AddRenderer( renderer );
+    }
+  }
+
+  return actor;
+}
+
 } // namespace Text
 
 } // namespace Toolkit
index 5dd231a..064d644 100755 (executable)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/clipboard.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/public-api/rendering/shader.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/input-style.h>
@@ -724,6 +725,13 @@ struct Controller::Impl
    */
   void ScrollTextToMatchCursor( const CursorInfo& cursorInfo );
 
+  /**
+   * @brief Create an actor that renders the text background color
+   *
+   * @return the created actor or an empty handle if no background color needs to be rendered.
+   */
+  Actor CreateBackgroundActor();
+
 public:
 
   /**
@@ -780,6 +788,8 @@ public:
   bool mShouldClearFocusOnEscape:1;        ///< Whether text control should clear key input focus
   LayoutDirection::Type mLayoutDirection;  ///< Current system language direction
 
+  Shader mShaderBackground;                ///< The shader for text background.
+
   float mTextFitMinSize;                   ///< Minimum Font Size for text fit. Default 10
   float mTextFitMaxSize;                   ///< Maximum Font Size for text fit. Default 100
   float mTextFitStepSize;                  ///< Step Size for font intervalse. Default 1
index 139fbfd..a3d77d4 100755 (executable)
@@ -80,7 +80,6 @@ int ConvertPixelToPint( float pixel )
   return ( pixel * 72.f ) / static_cast< float >( horizontalDpi );
 }
 
-
 } // namespace
 
 namespace Dali
@@ -2045,7 +2044,6 @@ Vector3 Controller::GetNaturalSize()
                                                                            GET_SCRIPTS       |
                                                                            VALIDATE_FONTS    |
                                                                            GET_LINE_BREAKS   |
-                                                                           GET_WORD_BREAKS   |
                                                                            BIDI_INFO         |
                                                                            SHAPE_TEXT        |
                                                                            GET_GLYPH_METRICS );
@@ -2117,7 +2115,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 +2210,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 +2431,6 @@ Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection()
                                                                            GET_SCRIPTS       |
                                                                            VALIDATE_FONTS    |
                                                                            GET_LINE_BREAKS   |
-                                                                           GET_WORD_BREAKS   |
                                                                            BIDI_INFO         |
                                                                            SHAPE_TEXT        |
                                                                            GET_GLYPH_METRICS );
@@ -3715,6 +3710,17 @@ bool Controller::RemoveText( int cursorOffset,
         }
       }
 
+      // If the number of current text and the number of characters to be deleted are same,
+      // it means all texts should be removed and all Preedit variables should be initialized.
+      if( ( currentText.Count() - numberOfCharacters == 0 ) && ( cursorIndex == 0 ) )
+      {
+        if( mImpl->mEventData )
+        {
+          mImpl->mEventData->mPreEditStartPosition = 0;
+          mImpl->mEventData->mPreEditLength = 0;
+        }
+      }
+
       // Updates the text style runs by removing characters. Runs with no characters are removed.
       mImpl->mModel->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
 
@@ -3821,38 +3827,16 @@ 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;
     glyphPositions.Resize( totalNumberOfGlyphs );
 
     // Whether the last character is a new paragraph character.
+    const Character* const textBuffer = mImpl->mModel->mLogicalModel->mText.Begin();
     mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph =  TextAbstraction::IsNewParagraph( *( textBuffer + ( mImpl->mModel->mLogicalModel->mText.Count() - 1u ) ) );
     layoutParameters.isLastNewParagraph = mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph;
 
@@ -3888,8 +3872,6 @@ bool Controller::DoRelayout( const Size& size,
     bool isAutoScrollEnabled = mImpl->mIsAutoScrollEnabled;
     Size newLayoutSize;
     viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
-                                                   glyphPositions,
-                                                   mImpl->mModel->mVisualModel->mLines,
                                                    newLayoutSize,
                                                    elideTextEnabled,
                                                    isAutoScrollEnabled );
@@ -3906,46 +3888,10 @@ bool Controller::DoRelayout( const Size& size,
         mImpl->mIsTextDirectionRTL = false;
       }
 
-      // Reorder the lines
-      if( NO_OPERATION != ( REORDER & operations ) )
+      if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && !mImpl->mModel->mVisualModel->mLines.Empty() )
       {
-        Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mImpl->mModel->mLogicalModel->mBidirectionalParagraphInfo;
-        Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = mImpl->mModel->mLogicalModel->mBidirectionalLineInfo;
-
-        // Check first if there are paragraphs with bidirectional info.
-        if( 0u != bidirectionalInfo.Count() )
-        {
-          // Get the lines
-          const Length numberOfLines = mImpl->mModel->mVisualModel->mLines.Count();
-
-          // Reorder the lines.
-          bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
-          ReorderLines( bidirectionalInfo,
-                        startIndex,
-                        requestedNumberOfCharacters,
-                        mImpl->mModel->mVisualModel->mLines,
-                        bidirectionalLineInfo );
-
-          // Set the bidirectional info per line into the layout parameters.
-          layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
-          layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
-
-          // Re-layout the text. Reorder those lines with right to left characters.
-          mImpl->mLayoutEngine.ReLayoutRightToLeftLines( layoutParameters,
-                                                         startIndex,
-                                                         requestedNumberOfCharacters,
-                                                         glyphPositions );
-
-          if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && ( numberOfLines > 0 ) )
-          {
-            const LineRun* const firstline = mImpl->mModel->mVisualModel->mLines.Begin();
-            if ( firstline )
-            {
-              mImpl->mIsTextDirectionRTL = firstline->direction;
-            }
-          }
-        }
-      } // REORDER
+        mImpl->mIsTextDirectionRTL = mImpl->mModel->mVisualModel->mLines[0u].direction;
+      }
 
       // Sets the layout size.
       if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
@@ -4354,6 +4300,11 @@ bool Controller::ShouldClearFocusOnEscape() const
   return mImpl->mShouldClearFocusOnEscape;
 }
 
+Actor Controller::CreateBackgroundActor()
+{
+  return mImpl->CreateBackgroundActor();
+}
+
 // private : Private contructors & copy operator.
 
 Controller::Controller()
index 18ff68e..82a7a15 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
   };
 
@@ -1488,6 +1487,13 @@ public: // Text-input Event Queuing.
    */
   bool ShouldClearFocusOnEscape() const;
 
+  /**
+   * @brief Create an actor that renders the text background color
+   *
+   * @return the created actor or an empty handle if no background color needs to be rendered.
+   */
+  Actor CreateBackgroundActor();
+
 protected: // Inherit from Text::Decorator::ControllerInterface.
 
   /**
index a301d03..812ba7c 100755 (executable)
@@ -162,6 +162,20 @@ public:
   virtual const ColorIndex* const GetColorIndices() const = 0;
 
   /**
+   * @brief Retrieves the vector of background colors.
+   *
+   * @return Pointer to the vector of background colors.
+   */
+  virtual const Vector4* const GetBackgroundColors() const = 0;
+
+  /**
+   * @brief Retrieves the vector of indices to the vector of background colors.
+   *
+   * @return Pointer to a vector which stores for each glyph the index to the vector of background colors.
+   */
+  virtual const ColorIndex* const GetBackgroundColorIndices() const = 0;
+
+  /**
    * @brief Retrieves the text's default color.
    *
    * @return The default color.
index da87e0c..c1767d8 100755 (executable)
@@ -112,6 +112,16 @@ const ColorIndex* const Model::GetColorIndices() const
   return mVisualModel->mColorIndices.Begin();
 }
 
+const Vector4* const Model::GetBackgroundColors() const
+{
+  return mVisualModel->mBackgroundColors.Begin();
+}
+
+const ColorIndex* const Model::GetBackgroundColorIndices() const
+{
+  return mVisualModel->mBackgroundColorIndices.Begin();
+}
+
 const Vector4& Model::GetDefaultColor() const
 {
   return mVisualModel->mTextColor;
index 3230e47..5edb294 100755 (executable)
@@ -139,6 +139,16 @@ public:
   virtual const ColorIndex* const GetColorIndices() const override;
 
   /**
+   * @copydoc ModelInterface::GetBackgroundColors()
+   */
+  virtual const Vector4* const GetBackgroundColors() const override;
+
+  /**
+   * @copydoc ModelInterface::GetBackgroundColorIndices()
+   */
+  virtual const ColorIndex* const GetBackgroundColorIndices() const override;
+
+  /**
    * @copydoc ModelInterface::GetDefaultColor()
    */
   virtual const Vector4& GetDefaultColor() const override;
index 8fba9b5..6ad85d4 100644 (file)
@@ -301,11 +301,11 @@ void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, T
 
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters horizontalAlign[%f], verticalAlign[%f]\n", horizontalAlign, verticalAlign );
 
-  scrollingTextActor.RegisterProperty( "uTextureSize", textureSize );
-  scrollingTextActor.RegisterProperty( "uHorizontalAlign", horizontalAlign );
-  scrollingTextActor.RegisterProperty( "uVerticalAlign", verticalAlign );
-  scrollingTextActor.RegisterProperty( "uGap", wrapGap );
-  mScrollDeltaIndex = scrollingTextActor.RegisterProperty( "uDelta", 0.0f );
+  shader.RegisterProperty( "uTextureSize", textureSize );
+  shader.RegisterProperty( "uHorizontalAlign", horizontalAlign );
+  shader.RegisterProperty( "uVerticalAlign", verticalAlign );
+  shader.RegisterProperty( "uGap", wrapGap );
+  mScrollDeltaIndex = shader.RegisterProperty( "uDelta", 0.0f );
 
   float scrollAmount = std::max( textureSize.width, controlSize.width );
   float scrollDuration =  scrollAmount / mScrollSpeed;
@@ -336,8 +336,9 @@ void TextScroller::StartScrolling( Actor scrollingTextActor, float scrollAmount,
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::StartScrolling scrollAmount[%f] scrollDuration[%f], loop[%d] speed[%d]\n", scrollAmount, scrollDuration, loopCount, mScrollSpeed );
 
+  Shader shader = mRenderer.GetShader();
   mScrollAnimation = Animation::New( scrollDuration );
-  mScrollAnimation.AnimateTo( Property( scrollingTextActor, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) );
+  mScrollAnimation.AnimateTo( Property( shader, mScrollDeltaIndex ), scrollAmount, TimePeriod( mLoopDelay, scrollDuration ) );
   mScrollAnimation.SetEndAction( Animation::Discard );
   mScrollAnimation.SetLoopCount( loopCount );
   mScrollAnimation.FinishedSignal().Connect( this, &TextScroller::AutoScrollAnimationFinished );
index 9e8020c..4aad47b 100755 (executable)
@@ -114,6 +114,20 @@ public:
   virtual const ColorIndex* const GetColorIndices() const = 0;
 
   /**
+   * @brief Retrieves the vector of background colors.
+   *
+   * @return Pointer to the vector of background colors.
+   */
+  virtual const Vector4* const GetBackgroundColors() const = 0;
+
+  /**
+   * @brief Retrieves the vector of indices to the vector of background colors.
+   *
+   * @return Pointer to a vector which stores for each glyph the index to the vector of background colors.
+   */
+  virtual const ColorIndex* const GetBackgroundColorIndices() const = 0;
+
+  /**
    * @brief Retrieves the text color
    *
    * @return The text color
index 929c17c..9d9f991 100755 (executable)
@@ -326,6 +326,26 @@ const ColorIndex* const View::GetColorIndices() const
   return NULL;
 }
 
+const Vector4* const View::GetBackgroundColors() const
+{
+  if( mImpl->mVisualModel )
+  {
+    return mImpl->mVisualModel->mBackgroundColors.Begin();
+  }
+
+  return nullptr;
+}
+
+const ColorIndex* const View::GetBackgroundColorIndices() const
+{
+  if( mImpl->mVisualModel )
+  {
+    return mImpl->mVisualModel->mBackgroundColorIndices.Begin();
+  }
+
+  return nullptr;
+}
+
 const Vector4& View::GetTextColor() const
 {
   if( mImpl->mVisualModel )
index e7d1942..91b7867 100755 (executable)
@@ -90,6 +90,16 @@ public:
   virtual const ColorIndex* const GetColorIndices() const;
 
   /**
+   * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColors()
+   */
+  virtual const Vector4* const GetBackgroundColors() const;
+
+  /**
+   * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColorIndices()
+   */
+  virtual const ColorIndex* const GetBackgroundColorIndices() const;
+
+  /**
    * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextColor()
    */
   virtual const Vector4& GetTextColor() const;
index 4b82cef..853e946 100755 (executable)
@@ -389,6 +389,8 @@ public:
   Vector<GlyphRun>       mUnderlineRuns;        ///< Runs of glyphs that are underlined.
   Vector<Vector4>        mColors;               ///< Colors of the glyphs.
   Vector<ColorIndex>     mColorIndices;         ///< Indices to the vector of colors for each glyphs.
+  Vector<Vector4>        mBackgroundColors;     ///< Background colors of the glyphs.
+  Vector<ColorIndex>     mBackgroundColorIndices; ///< Indices to the vector of background colors for each glyphs.
 
   Vector4                mTextColor;            ///< The text color
   Vector4                mShadowColor;          ///< Color of drop shadow
@@ -399,7 +401,7 @@ public:
   Vector2                mShadowOffset;         ///< Offset for drop shadow, 0 indicates no shadow
   float                  mUnderlineHeight;      ///< Fixed height for underline to override font metrics.
   float                  mShadowBlurRadius;     ///< Blur radius of shadow, 0 indicates no blur.
-  uint16_t           mOutlineWidth;         ///< Width of outline.
+  uint16_t               mOutlineWidth;         ///< Width of outline.
 
 private:
 
index ac89867..8258fb7 100644 (file)
@@ -100,7 +100,7 @@ void VectorAnimationTask::Finalize()
     mAnimationFinishedTrigger.reset();
   }
 
-  mVectorRenderer.Reset();
+  mVectorRenderer.Finalize();
 }
 
 void VectorAnimationTask::SetRenderer( Renderer renderer )
index cb2d08a..08cad31 100644 (file)
@@ -76,15 +76,15 @@ void VectorRasterizeThread::SetCompletedCallback( CallbackBase* callback )
 
 void VectorRasterizeThread::AddTask( VectorAnimationTaskPtr task )
 {
+  // Lock while adding task to the queue
+  ConditionalWait::ScopedLock lock( mConditionalWait );
+
   if( !mIsThreadStarted )
   {
     Start();
     mIsThreadStarted = true;
   }
 
-  // Lock while adding task to the queue
-  ConditionalWait::ScopedLock lock( mConditionalWait );
-
   if( mRasterizeTasks.end() == std::find( mRasterizeTasks.begin(), mRasterizeTasks.end(), task ) )
   {
     mRasterizeTasks.push_back( task );
index 6f1aadb..6dcc2fc 100644 (file)
@@ -707,7 +707,8 @@ void TextureManager::LoadTexture( TextureInfo& textureInfo, TextureUploadObserve
   {
     auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders;
     auto loadingHelperIt = loadersContainer.GetNext();
-    auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF;
+    auto premultiplyOnLoad = ( textureInfo.preMultiplyOnLoad && textureInfo.maskTextureId == INVALID_TEXTURE_ID ) ?
+                               DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF;
     DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End());
     loadingHelperIt->Load(textureInfo.textureId, textureInfo.url,
                           textureInfo.desiredSize, textureInfo.fittingMode,
@@ -893,8 +894,9 @@ void TextureManager::ApplyMask( TextureInfo& textureInfo, TextureId maskTextureI
     textureInfo.loadState = MASK_APPLYING;
     auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders;
     auto loadingHelperIt = loadersContainer.GetNext();
+    auto premultiplyOnLoad = textureInfo.preMultiplyOnLoad ? DevelAsyncImageLoader::PreMultiplyOnLoad::ON : DevelAsyncImageLoader::PreMultiplyOnLoad::OFF;
     DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End());
-    loadingHelperIt->ApplyMask( textureInfo.textureId, pixelBuffer, maskPixelBuffer, textureInfo.scaleFactor, textureInfo.cropToMask );
+    loadingHelperIt->ApplyMask( textureInfo.textureId, pixelBuffer, maskPixelBuffer, textureInfo.scaleFactor, textureInfo.cropToMask, premultiplyOnLoad );
   }
 }
 
@@ -1155,13 +1157,14 @@ void TextureManager::AsyncLoadingHelper::Load(TextureId          textureId,
 }
 
 void TextureManager::AsyncLoadingHelper::ApplyMask( TextureId textureId,
-                                               Devel::PixelBuffer pixelBuffer,
-                                               Devel::PixelBuffer maskPixelBuffer,
-                                               float contentScale,
-                                               bool cropToMask )
+                                                    Devel::PixelBuffer pixelBuffer,
+                                                    Devel::PixelBuffer maskPixelBuffer,
+                                                    float contentScale,
+                                                    bool cropToMask,
+                                                    DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad )
 {
   mLoadingInfoContainer.push_back(AsyncLoadingInfo(textureId));
-  auto id = DevelAsyncImageLoader::ApplyMask( mLoader, pixelBuffer, maskPixelBuffer, contentScale, cropToMask );
+  auto id = DevelAsyncImageLoader::ApplyMask( mLoader, pixelBuffer, maskPixelBuffer, contentScale, cropToMask, preMultiplyOnLoad );
   mLoadingInfoContainer.back().loadId = id;
 }
 
index ca899fd..b782517 100755 (executable)
@@ -712,7 +712,7 @@ private:
      * @param[in] samplingMode          The SamplingMode to use
      * @param[in] orientationCorrection Whether to use image metadata to rotate or flip the image,
      *                                  e.g., from portrait to landscape
-     * @param[in] preMultiplyOnLoad     if the image's color should be multiplied by it's alpha.
+     * @param[in] preMultiplyOnLoad     if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha or if the image need to be applied alpha mask.
      */
     void Load(TextureId textureId,
               const VisualUrl& url,
@@ -729,12 +729,14 @@ private:
      * @param [in] maskPixelBuffer of the mask image
      * @param [in] contentScale The factor to scale the content
      * @param [in] cropToMask Whether to crop the content to the mask size
+     * @param [in] preMultiplyOnLoad if the image's color should be multiplied by it's alpha. Set to OFF if there is no alpha.
      */
     void ApplyMask( TextureId textureId,
                     Devel::PixelBuffer pixelBuffer,
                     Devel::PixelBuffer maskPixelBuffer,
                     float contentScale,
-                    bool cropToMask );
+                    bool cropToMask,
+                    DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad );
 
   public:
     AsyncLoadingHelper(const AsyncLoadingHelper&) = delete;
index f4e7c95..ee0a8bf 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 44;
+const unsigned int TOOLKIT_MICRO_VERSION = 48;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
diff --git a/dali-toolkit/styles/2048x1080/dali-toolkit-default-theme.json b/dali-toolkit/styles/2048x1080/dali-toolkit-default-theme.json
new file mode 100755 (executable)
index 0000000..2028c16
--- /dev/null
@@ -0,0 +1,377 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * This file is part of Dali Toolkit
+ *
+ * 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.
+ */
+
+
+//******************************************************************************
+//
+// Default Reference style theme for a 2048x1080 (2K) resolution, Andriod xxxhdpi DPI.
+//
+//******************************************************************************
+
+{
+  "config":
+  {
+    "brokenImageUrl":"{DALI_IMAGE_DIR}broken.png",
+    "alwaysShowFocus":true,
+    "clearFocusOnEscape":false
+  },
+  "styles":
+  {
+    "Tooltip":
+    {
+      "tooltip":
+      {
+        "content":
+        {
+          "pointSize":6
+        },
+        "waitTime":0.5,
+        "background":
+        {
+          "visual":"{DALI_IMAGE_DIR}tooltip.9.png",
+          "border":[1,5,5,1]
+        },
+        "tail":
+        {
+          "visibility":false,
+          "aboveVisual":"{DALI_IMAGE_DIR}tooltip-tail-above.png",
+          "belowVisual":"{DALI_IMAGE_DIR}tooltip-tail-below.png"
+        },
+        "position":"BELOW",
+        "hoverPointOffset":[10,10],
+        "movementThreshold":5,
+        "disappearOnMovement":false
+      }
+    },
+    "TextLabel":
+    {
+      "pointSize":8,
+      "enableAutoScroll":false,
+      "autoScrollLoopCount":2,
+      "autoScrollGap":50,
+      "autoScrollSpeed":80,
+      "ignoreSpacesAfterText":false
+    },
+
+    "TextLabelFontSize0":
+    {
+      "pointSize":4
+    },
+    "TextLabelFontSize1":
+    {
+      "pointSize":6
+    },
+    "TextLabelFontSize2":
+    {
+      "pointSize":8
+    },
+    "TextLabelFontSize3":
+    {
+      "pointSize":10
+    },
+    "TextLabelFontSize4":
+    {
+      "pointSize":12
+    },
+
+    "TextField":
+    {
+      "pointSize":8,
+      "primaryCursorColor":[0.0,0.72,0.9,1.0],
+      "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+      "cursorWidth":6,
+      "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+      "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+      "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+      "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
+      "enableSelection":false
+    },
+
+    "TextFieldFontSize0":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize1":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize2":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize3":
+    {
+      "pointSize":10
+    },
+    "TextFieldFontSize4":
+    {
+      "pointSize":10
+    },
+    "TextSelectionPopup":
+    {
+      "popupMaxSize":[1700,100],
+      "optionDividerSize":[2,0],
+      "popupDividerColor":[0.23,0.72,0.8,0.11],
+      "popupIconColor":[1.0,1.0,1.0,1.0],
+      "popupPressedColor":[0.24,0.72,0.8,0.11],
+      "background": {
+        "rendererType": "image",
+        "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+        },
+      "backgroundBorder": {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+        "mixColor":[0.24,0.72,0.8,1.0]
+        },
+      "popupFadeInDuration":0.25,
+      "popupFadeOutDuration":0.25
+    },
+    "TextSelectionPopupButton":
+    {
+      "label":
+      {
+        "visualType":"TEXT",
+        "pointSize":10
+      },
+      "unselectedBackgroundVisual":
+      {
+        "visualType": "IMAGE",
+        "url": ""
+      },
+      "selectedBackgroundVisual":
+      {
+        "visualType": "IMAGE",
+        "url": ""
+      }
+    },
+    "TextSelectionToolbar":
+    {
+      "enableOvershoot":true,
+      "enableScrollBar":true,
+      "scrollView":
+      {
+        "overshootAnimationSpeed":360.0,
+        "overshootSize":[2048.0,130.0]
+      }
+    },
+    "TextSelectionScrollBar":
+    {
+      "indicatorShowDuration":0.25,
+      "indicatorHideDuration":0.25,
+      "indicatorTransientDuration":1.0
+    },
+    "TextSelectionScrollIndicator":
+    {
+      "image":
+      {
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png"
+      },
+      "color":[0.0,0.72,0.9,0.7]
+    },
+    "ScrollView":
+    {
+      "overshootEffectColor":"B018",
+      "overshootAnimationSpeed":960.0,
+      "overshootSize":[2048.0,130.0]
+    },
+    "ItemView":
+    {
+      "overshootEffectColor":"B018",
+      "overshootAnimationSpeed":960.0,
+      "overshootSize":[2048.0,130.0]
+    },
+    "ScrollBar":
+    {
+      "indicatorShowDuration":0.25,
+      "indicatorHideDuration":0.25,
+      "color":[0.0,0.72,0.9,0.7]
+    },
+    "TextEditor":
+    {
+      "pointSize":8,
+      "primaryCursorColor":[0.0,0.72,0.9,1.0],
+      "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+      "cursorWidth":6,
+      "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+      "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+      "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+      "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
+      "enableScrollBar":true,
+      "scrollBarShowDuration":0.8,
+      "scrollBarFadeDuration":0.5,
+      "enableSelection":false
+    },
+    "ProgressBar":
+    {
+      "trackVisual":{
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-track.9.png"
+      },
+      "progressVisual":{
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-progress.9.png"
+      },
+      "secondaryProgressVisual":{
+        "visualType":"IMAGE",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-secondary-progress.9.png"
+      },
+      "indeterminateVisual":{
+        "visualType":"IMAGE",
+        "pixelArea":[0.0, 0.0, 10.0, 1.0],
+        "wrapModeU":"REPEAT",
+        "url":"{DALI_IMAGE_DIR}progress-bar-skin-indeterminate.png"
+      },
+      "indeterminateVisualAnimation":
+      [
+        {
+          "target":"indeterminateVisual",
+          "property":"pixelArea",
+          "initialValue":[0.0, 0.0, 10.0, 1.0],
+          "targetValue":[-1.0, 0.0, 10.0, 1.0],
+          "animator":
+          {
+            "alphaFunction":"DEFAULT",
+            "timePeriod":
+            {
+              "duration":0.8,
+              "delay":0
+            }
+          }
+        }
+      ],
+      "labelVisual":{
+        "visualType": "TEXT",
+        "textColor": [ 1.0, 1.0, 1.0, 1.0 ],
+        "pointSize" : 10.0, // Point size must always be provided to Text Visual
+        "horizontalAlignment": "CENTER",
+        "verticalAlignment": "CENTER"
+      },
+      "progressValue": 0.0,
+      "secondaryProgressValue":0.0,
+      "indeterminate": false
+    },
+    "Button":
+    {
+      "styles":["Tooltip"],
+      "initialAutoRepeatingDelay":2.0,
+      "nextAutoRepeatingDelay":0.9
+      // Note: Visuals added to Button will be used in all derived buttons unless overridden.
+    },
+    "PushButton":
+    {
+      "styles":["Button"],
+      "autoRepeating":false,
+      "togglable":false,
+      "labelPadding":[ 12.0, 12.0, 12.0, 12.0 ],
+      "label":
+       {
+         "visualType": "TEXT",
+         "horizontalAlignment": "CENTER",
+         "pointSize" : 10.0, // Point size must always be provided to Text Visual
+         "verticalAlignment": "CENTER"
+       },
+      "unselectedBackgroundVisual":
+       {
+         "visualType": "IMAGE",
+         "url": "{DALI_IMAGE_DIR}button-up.9.png"
+       },
+       "selectedBackgroundVisual":
+       {
+         "visualType": "IMAGE",
+         "url": "{DALI_IMAGE_DIR}button-down.9.png"
+       },
+       "disabledSelectedBackgroundVisual":
+       {
+         "visualType": "IMAGE",
+         "url": "{DALI_IMAGE_DIR}button-down-disabled.9.png"
+       },
+       "disabledUnselectedBackgroundVisual":
+       {
+         "visualType": "IMAGE",
+         "url": "{DALI_IMAGE_DIR}button-disabled.9.png"
+       }
+    },
+    "ToggleButton":
+    {
+      "styles":["Button"]
+    },
+    "CheckBoxButton":
+    {
+      "styles":["Button"],
+      "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+      "label":
+       {
+         "visualType": "TEXT",
+         "pointSize" : 10.0, // Point size must always be provided to Text Visual
+         "verticalAlignment": "CENTER"
+       },
+      "unselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-unselected.png"
+      },
+      "selectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-selected.png"
+      },
+      "disabledUnselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-unselected-disabled.png"
+      },
+      "disabledSelectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}checkbox-selected-disabled.png"
+      }
+    },
+    "RadioButton":
+    {
+      "styles":["Button"],
+      "labelPadding":[ 12.0, 12.0, 0.0, 0.0 ],
+      "label":
+       {
+         "visualType": "TEXT",
+         "pointSize" : 10.0, // Point size must always be provided to Text Visual
+         "verticalAlignment": "CENTER"
+       },
+      "unselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-unselected.png"
+      },
+      "selectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-selected.png"
+      },
+      "disabledUnselectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-unselected-disabled.png"
+      },
+      "disabledSelectedVisual":
+      {
+        "visualType": "IMAGE",
+        "url": "{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
+      }
+    }
+  }
+}
diff --git a/dali-toolkit/styles/2048x1080/images/cursor_handler_drop_center.png b/dali-toolkit/styles/2048x1080/images/cursor_handler_drop_center.png
new file mode 100644 (file)
index 0000000..244096f
Binary files /dev/null and b/dali-toolkit/styles/2048x1080/images/cursor_handler_drop_center.png differ
diff --git a/dali-toolkit/styles/2048x1080/images/selection_handle_drop_left.png b/dali-toolkit/styles/2048x1080/images/selection_handle_drop_left.png
new file mode 100644 (file)
index 0000000..244096f
Binary files /dev/null and b/dali-toolkit/styles/2048x1080/images/selection_handle_drop_left.png differ
diff --git a/dali-toolkit/styles/2048x1080/images/selection_handle_drop_right.png b/dali-toolkit/styles/2048x1080/images/selection_handle_drop_right.png
new file mode 100644 (file)
index 0000000..244096f
Binary files /dev/null and b/dali-toolkit/styles/2048x1080/images/selection_handle_drop_right.png differ
index 603f977..f8b45f9 100644 (file)
@@ -1082,7 +1082,7 @@ static unsigned int nsvg__parseColorHex(const char* str)
 static unsigned int nsvg__parseColorRGB(const char* str)
 {
        int r = -1, g = -1, b = -1;
-       char s1[32]="", s2[32]="";
+       char s1[33]="", s2[33]="";
        /**
         * In the original file, the formatted data reading did not specify the string with width limitation.
         * To prevent the possible overflow, we replace '%s' with '%32s' here.
@@ -1320,7 +1320,7 @@ static int nsvg__parseUnits(const char* units)
 static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
 {
        NSVGcoordinate coord = {0, NSVG_UNITS_USER};
-       char units[32]="";
+       char units[33]="";
        /**
         * In the original file, the formatted data reading did not specify the string with width limitation.
         * To prevent the possible overflow, we replace '%s' with '%32s' here.
index 9c3b751..f479b2c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    1.4.44
+Version:    1.4.48
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT