Add the paragraph's direction to all lines. 94/37594/3
authorVictor Cebollada <v.cebollada@samsung.com>
Tue, 31 Mar 2015 14:58:09 +0000 (15:58 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Tue, 7 Apr 2015 14:45:21 +0000 (15:45 +0100)
Change-Id: I9438a02451723298cf0ccb01d6c542b30eb44c76
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/text/bidirectional-support.cpp
dali-toolkit/internal/text/bidirectional-support.h
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/line-run.h

index c982018..c58c126 100644 (file)
@@ -170,7 +170,7 @@ void ReplaceBidirectionalInfo( LogicalModel& model,
 }
 
 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
 }
 
 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
-                   const Vector<LineRun>& lineRuns,
+                   Vector<LineRun>& lineRuns,
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns )
 {
   // Handle to the bidirectional info module in text-abstraction.
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns )
 {
   // Handle to the bidirectional info module in text-abstraction.
@@ -202,12 +202,15 @@ void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInf
     lineIndex = firstLine + numberOfLines;
 
     // Traverse the lines and reorder them
     lineIndex = firstLine + numberOfLines;
 
     // Traverse the lines and reorder them
-    for( Vector<LineRun>::ConstIterator lineIt = lineRuns.Begin() + firstLine,
+    for( Vector<LineRun>::Iterator lineIt = lineRuns.Begin() + firstLine,
            endLineIt = lineRuns.Begin() + firstLine + numberOfLines;
            lineIt != endLineIt;
          ++lineIt )
     {
            endLineIt = lineRuns.Begin() + firstLine + numberOfLines;
            lineIt != endLineIt;
          ++lineIt )
     {
-      const LineRun& line = *lineIt;
+      LineRun& line = *lineIt;
+
+      // Sets the paragraph's direction.
+      line.direction = direction;
 
       // Creates a bidirectional info for the line run.
       BidirectionalLineInfoRun lineInfoRun;
 
       // Creates a bidirectional info for the line run.
       BidirectionalLineInfoRun lineInfoRun;
index 95f438a..f51e5e7 100644 (file)
@@ -75,17 +75,18 @@ void ReplaceBidirectionalInfo( LogicalModel& model,
  * Sets the visual to logical map tables.
  *
  * Any map tables previously set are removed.
  * Sets the visual to logical map tables.
  *
  * 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.
  *
  * @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] lineRuns The line runs converted to characters.
+ * @param[in,out] lineRuns The line runs converted to characters.
  * @param[out] lineInfoRuns line runs with the visual to logical conversion maps.
  */
 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
  * @param[out] lineInfoRuns line runs with the visual to logical conversion maps.
  */
 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
-                   const Vector<LineRun>& lineRuns,
+                   Vector<LineRun>& lineRuns,
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns );
 
 /**
                    Vector<BidirectionalLineInfoRun>& lineInfoRuns );
 
 /**
index fa1e919..a88a877 100644 (file)
@@ -475,6 +475,7 @@ struct LayoutEngine::Impl
     lineRun.lineSize.width = layout.length;
     lineRun.lineSize.height = layout.ascender + layout.descender;
     lineRun.extraLength = layout.wsLengthEndOfLine;
     lineRun.lineSize.width = layout.length;
     lineRun.lineSize.height = layout.ascender + layout.descender;
     lineRun.extraLength = layout.wsLengthEndOfLine;
+    lineRun.direction = false;
 
     lines.PushBack( lineRun );
 
 
     lines.PushBack( lineRun );
 
@@ -533,6 +534,7 @@ struct LayoutEngine::Impl
       lineRun.lineSize.width = layout.length + ( ( layout.widthAdvanceDiff > 0.f ) ? layout.widthAdvanceDiff : 0.f );
       lineRun.lineSize.height = layout.ascender + layout.descender;
       lineRun.extraLength = layout.wsLengthEndOfLine;
       lineRun.lineSize.width = layout.length + ( ( layout.widthAdvanceDiff > 0.f ) ? layout.widthAdvanceDiff : 0.f );
       lineRun.lineSize.height = layout.ascender + layout.descender;
       lineRun.extraLength = layout.wsLengthEndOfLine;
+      lineRun.direction = false;
 
       lines.PushBack( lineRun );
 
 
       lines.PushBack( lineRun );
 
index fd5371d..7df4bec 100644 (file)
@@ -38,11 +38,12 @@ namespace Text
  */
 struct LineRun
 {
  */
 struct LineRun
 {
-  GlyphIndex   glyphIndex;     ///< The initial glyph index.
-  Length       numberOfGlyphs; ///< The number of glyphs of the run.
-  CharacterRun characterRun;   ///< The initial character and the number of characters.
-  Size         lineSize;       ///< The size of the line.
-  float        extraLength;    ///< The length of the white spaces at the end of the line.
+  GlyphIndex         glyphIndex;     ///< The initial glyph index.
+  Length             numberOfGlyphs; ///< The number of glyphs of the run.
+  CharacterRun       characterRun;   ///< The initial character and the number of characters.
+  Size               lineSize;       ///< The size of the line.
+  float              extraLength;    ///< The length of the white spaces at the end of the line.
+  CharacterDirection direction;      ///< Direction of the first character of the paragraph.
 };
 
 } // namespace Text
 };
 
 } // namespace Text