Change-Id: Ie1392451f1aad81b05d7762b6838c14cccfc0913
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
+bool GetMirroredText( const Vector<Character>& text,
+ Vector<Character>& mirroredText )
+{
+ // Handle to the bidirectional info module in text-abstraction.
+ TextAbstraction::BidirectionalSupport bidirectionalSupport = TextAbstraction::BidirectionalSupport::Get();
+
+ mirroredText = text;
+
+ return bidirectionalSupport.GetMirroredText( mirroredText.Begin(),
+ mirroredText.Count() );
+}
+
} // namespace Text
} // namespace Toolkit
} // namespace Text
} // namespace Toolkit
Length numberOfCharactersToRemove,
Length numberOfCharactersToInsert );
Length numberOfCharactersToRemove,
Length numberOfCharactersToInsert );
+/**
+ * @brief Replaces any character which could be mirrored.
+ *
+ * @param[in] text The text.
+ * @param[in] mirroredText The mirroredText.
+ *
+ * @return @e true if a character has been replaced.
+ */
+bool GetMirroredText( const Vector<Character>& text,
+ Vector<Character>& mirroredText );
} // namespace Text
} // namespace Toolkit
} // namespace Text
} // namespace Toolkit
VALIDATE_FONTS |
GET_LINE_BREAKS |
GET_WORD_BREAKS |
VALIDATE_FONTS |
GET_LINE_BREAKS |
GET_WORD_BREAKS |
SHAPE_TEXT |
GET_GLYPH_METRICS );
// Make sure the model is up-to-date before layouting
SHAPE_TEXT |
GET_GLYPH_METRICS );
// Make sure the model is up-to-date before layouting
VALIDATE_FONTS |
GET_LINE_BREAKS |
GET_WORD_BREAKS |
VALIDATE_FONTS |
GET_LINE_BREAKS |
GET_WORD_BREAKS |
SHAPE_TEXT |
GET_GLYPH_METRICS );
// Make sure the model is up-to-date before layouting
SHAPE_TEXT |
GET_GLYPH_METRICS );
// Make sure the model is up-to-date before layouting
+ Vector<Character> mirroredUtf32Characters;
+ bool textMirrored = false;
if( BIDI_INFO & operations )
{
// Count the number of LINE_NO_BREAK to reserve some space for the vector of paragraph's
if( BIDI_INFO & operations )
{
// Count the number of LINE_NO_BREAK to reserve some space for the vector of paragraph's
scripts,
lineBreakInfo,
bidirectionalInfo );
scripts,
lineBreakInfo,
bidirectionalInfo );
+
+ if( 0u != bidirectionalInfo.Count() )
+ {
+ // This paragraph has right to left text. Some characters may need to be mirrored.
+ // TODO: consider if the mirrored string can be stored as well.
+
+ textMirrored = GetMirroredText( utf32Characters, mirroredUtf32Characters );
+ }
}
Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
}
Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
if( SHAPE_TEXT & operations )
{
Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
if( SHAPE_TEXT & operations )
{
+ const Vector<Character>& textToShape = textMirrored ? mirroredUtf32Characters : utf32Characters;
- ShapeText( utf32Characters,
+ ShapeText( textToShape,
lineBreakInfo,
scripts,
validFonts,
lineBreakInfo,
scripts,
validFonts,