From 438b85b845eb6ce7d1d8f800be64704b74838b59 Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Tue, 31 Mar 2015 15:58:09 +0100 Subject: [PATCH] Add the paragraph's direction to all lines. Change-Id: I9438a02451723298cf0ccb01d6c542b30eb44c76 Signed-off-by: Victor Cebollada --- dali-toolkit/internal/text/bidirectional-support.cpp | 9 ++++++--- dali-toolkit/internal/text/bidirectional-support.h | 5 +++-- dali-toolkit/internal/text/layouts/layout-engine.cpp | 2 ++ dali-toolkit/internal/text/line-run.h | 11 ++++++----- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dali-toolkit/internal/text/bidirectional-support.cpp b/dali-toolkit/internal/text/bidirectional-support.cpp index c982018..c58c126 100644 --- a/dali-toolkit/internal/text/bidirectional-support.cpp +++ b/dali-toolkit/internal/text/bidirectional-support.cpp @@ -170,7 +170,7 @@ void ReplaceBidirectionalInfo( LogicalModel& model, } void ReorderLines( const Vector& bidirectionalInfo, - const Vector& lineRuns, + Vector& lineRuns, Vector& lineInfoRuns ) { // Handle to the bidirectional info module in text-abstraction. @@ -202,12 +202,15 @@ void ReorderLines( const Vector& bidirectionalInf lineIndex = firstLine + numberOfLines; // Traverse the lines and reorder them - for( Vector::ConstIterator lineIt = lineRuns.Begin() + firstLine, + for( Vector::Iterator lineIt = lineRuns.Begin() + firstLine, 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; diff --git a/dali-toolkit/internal/text/bidirectional-support.h b/dali-toolkit/internal/text/bidirectional-support.h index 95f438a..f51e5e7 100644 --- a/dali-toolkit/internal/text/bidirectional-support.h +++ b/dali-toolkit/internal/text/bidirectional-support.h @@ -75,17 +75,18 @@ void ReplaceBidirectionalInfo( LogicalModel& model, * 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. - * @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& bidirectionalInfo, - const Vector& lineRuns, + Vector& lineRuns, Vector& lineInfoRuns ); /** diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp index fa1e919..a88a877 100644 --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -475,6 +475,7 @@ struct LayoutEngine::Impl lineRun.lineSize.width = layout.length; lineRun.lineSize.height = layout.ascender + layout.descender; lineRun.extraLength = layout.wsLengthEndOfLine; + lineRun.direction = false; 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.direction = false; lines.PushBack( lineRun ); diff --git a/dali-toolkit/internal/text/line-run.h b/dali-toolkit/internal/text/line-run.h index fd5371d..7df4bec 100644 --- a/dali-toolkit/internal/text/line-run.h +++ b/dali-toolkit/internal/text/line-run.h @@ -38,11 +38,12 @@ namespace Text */ 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 -- 2.7.4