CharacterIndex startIndex,
Length numberOfCharacters,
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
- bool matchSystemLanguageDirection,
+ bool matchLayoutDirection,
Dali::LayoutDirection::Type layoutDirection)
{
// Find where to insert the new paragraphs.
// Create the bidirectional info for the whole paragraph and store the index to the table with this info in the run.
bidirectionalRun.bidirectionalInfoIndex = bidirectionalSupport.CreateInfo(textBuffer + bidirectionalRun.characterRun.characterIndex,
bidirectionalRun.characterRun.numberOfCharacters,
- matchSystemLanguageDirection,
+ matchLayoutDirection,
layoutDirection);
bidirectionalRun.direction = bidirectionalSupport.GetParagraphDirection(bidirectionalRun.bidirectionalInfoIndex);
BidirectionalLineRunIndex bidiLineIndex,
CharacterIndex startIndex,
Length numberOfCharacters,
+ CharacterIndex startIndexInSecondHalfLine,
+ Length numberOfCharactersInSecondHalfLine,
CharacterDirection direction)
{
// Handle to the bidirectional info module in text-abstraction.
lineInfoRun.direction = direction;
lineInfoRun.isIdentity = true;
+ lineInfoRun.characterRunForSecondHalfLine.characterIndex = startIndexInSecondHalfLine;
+ lineInfoRun.characterRunForSecondHalfLine.numberOfCharacters = numberOfCharactersInSecondHalfLine;
+
// 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)));
- if(nullptr != lineInfoRun.visualToLogicalMap)
+ lineInfoRun.visualToLogicalMapSecondHalf = reinterpret_cast<CharacterIndex*>(malloc(numberOfCharactersInSecondHalfLine * sizeof(CharacterIndex)));
+
+ if(nullptr != lineInfoRun.visualToLogicalMap && nullptr != lineInfoRun.visualToLogicalMapSecondHalf)
{
// Reorders the line.
bidirectionalSupport.Reorder(bidirectionalParagraphInfo.bidirectionalInfoIndex,
lineInfoRun.characterRun.numberOfCharacters,
lineInfoRun.visualToLogicalMap);
+ bidirectionalSupport.Reorder(bidirectionalParagraphInfo.bidirectionalInfoIndex,
+ lineInfoRun.characterRunForSecondHalfLine.characterIndex - bidirectionalParagraphInfo.characterRun.characterIndex,
+ lineInfoRun.characterRunForSecondHalfLine.numberOfCharacters,
+ lineInfoRun.visualToLogicalMapSecondHalf);
+
// 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)
break;
}
}
+
+ for(unsigned int i = 0; i < numberOfCharactersInSecondHalfLine; ++i)
+ {
+ if(i != *(lineInfoRun.visualToLogicalMapSecondHalf + i))
+ {
+ lineInfoRun.isIdentity = false;
+ break;
+ }
+ }
}
// Push the run into the vector.
const Length numberOfLeftToRightCharacters = paragraph.characterRun.characterIndex - index;
if(numberOfLeftToRightCharacters > 0u)
{
- memset(directionsBuffer + index - startIndex, false, numberOfLeftToRightCharacters * sizeof(bool));
+ memset(directionsBuffer + static_cast<std::size_t>(index - startIndex), false, static_cast<std::size_t>(numberOfLeftToRightCharacters) * sizeof(bool));
}
// Set the directions of the bidirectional text.
bidirectionalSupport.GetCharactersDirection(paragraph.bidirectionalInfoIndex,
- directionsBuffer + paragraph.characterRun.characterIndex - startIndex,
+ directionsBuffer + static_cast<std::size_t>(paragraph.characterRun.characterIndex - startIndex),
paragraph.characterRun.numberOfCharacters);
// Update the index.
}
// Fills with left to right those paragraphs without right to left characters.
- memset(directionsBuffer + index - startIndex, false, (lastCharacter - index) * sizeof(bool));
+ memset(directionsBuffer + static_cast<std::size_t>(index - startIndex), false, static_cast<std::size_t>(lastCharacter - index) * sizeof(bool));
// If the direction info is updated, it needs to be inserted in the model.
if(updateCurrentBuffer)