X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fbidirectional-support.h;h=46c368e9a5c1e1dceaddb98d5618b23e929b9e87;hp=227133e238665ef12092d9665808b2c6f697e8eb;hb=7018f61b640b6fcf9cb576b537bafcb6bb8240e8;hpb=b0d779c1461781f29868f5414d2475ab0ba9766b diff --git a/dali-toolkit/internal/text/bidirectional-support.h b/dali-toolkit/internal/text/bidirectional-support.h index 227133e..46c368e 100644 --- a/dali-toolkit/internal/text/bidirectional-support.h +++ b/dali-toolkit/internal/text/bidirectional-support.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__ -#define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__ +#ifndef DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H +#define DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include // INTERNAL INCLUDES @@ -29,101 +30,89 @@ namespace Dali { - namespace Toolkit { - namespace Text { - -class LogicalModel; -class VisualModel; - /** * Sets the bidirectional info into the logical model. * * @param[in] text Vector of UTF-32 characters. * @param[in] scripts Vector containing the script runs for the whole text. * @param[in] lineBreakInfo The line break info. + * @param[in] startIndex The character from where the bidirectional info is set. + * @param[in] numberOfCharacters The number of characters. * @param[out] bidirectionalInfo Vector with the bidirectional infor for each paragraph. + * @param[in] matchSystemLanguageDirection Whether match for system language direction or not. + * @param[in] layoutDirection The direction of the system language. */ -void SetBidirectionalInfo( const Vector& text, - const Vector& scripts, - const Vector& lineBreakInfo, - Vector& bidirectionalInfo ); +void SetBidirectionalInfo(const Vector& text, + const Vector& scripts, + const Vector& lineBreakInfo, + CharacterIndex startIndex, + Length numberOfCharacters, + Vector& bidirectionalInfo, + bool matchSystemLanguageDirection = false, + Dali::LayoutDirection::Type layoutDirection = LayoutDirection::LEFT_TO_RIGHT); /** - * Replaces the bidirectional info from the logical model. - * - * @pre The @p model needs to have a text set. - * @pre The @p model needs to have the line break info set. - * - * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. - * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. - * - * @param[in,out] model The text's logical model. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharactersToRemove The number of characters removed from the text. - * @param[in] numberOfCharactersToInsert The number of characters inserted in the text. + * @brief Sets the visual to logical map table for a given line. + * + * @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] direction The direction of the line. */ -void ReplaceBidirectionalInfo( LogicalModel& model, - CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - Length numberOfCharactersToInsert ); +void ReorderLine(const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo, + Vector& lineInfoRuns, + BidirectionalLineRunIndex bidiLineIndex, + CharacterIndex startIndex, + Length numberOfCharacters, + CharacterDirection direction); /** - * Sets the visual to logical and logical to visual map tables. - * - * Any map tables previously set are removed. - * - * @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. + * @brief Replaces any character in the right to left paragraphs which could be mirrored. * + * @param[in] text The text. + * @param[in] directions Vector with the direction of each paragraph. * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph. - * @param[in] lineRuns The line runs converted to characters. - * @param[out] lineInfoRuns line runs with the visual to logical and logical to visual conversion maps. + * @param[in] startIndex The character from where the text is mirrored. + * @param[in] numberOfCharacters The number of characters. + * @param[out] mirroredText The mirroredText. + * + * @return @e true if a character has been replaced. */ -void ReorderLines( const Vector& bidirectionalInfo, - const Vector& lineRuns, - Vector& lineInfoRuns ); +bool GetMirroredText(const Vector& text, + const Vector& directions, + const Vector& bidirectionalInfo, + CharacterIndex startIndex, + Length numberOfCharacters, + Vector& mirroredText); /** - * Replaces the visual to logical and logical to visual map tables. + * @brief Retrieves the characters' directions. * * @pre The @p logicalModel needs to have a text set. - * @pre The @p logicalModel needs to have the line break info set. - * @pre The @p visualModel needs to have the laid-out lines info set. - * - * If the @p numberOfCharactersToRemove is zero, this operation is like an insert. - * If the @p numberOfCharactersToInsert is zero, this operation is like a remove. + * @pre The @p logicalModel needs to have the bidirectional info indices for each paragraph set. * - * @param[in,out] logicalModel The text's logical model. - * @param[in] visualModel The text's visual model. - * @param[in] characterIndex Index to the first character. - * @param[in] numberOfCharactersToRemove The number of characters removed from the text. - * @param[in] numberOfCharactersToInsert The number of characters inserted in the text. + * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph. + * @param[in] totalNumberOfCharacters The number of characters of the whole text. + * @param[in] startIndex The character from where the direction info is set. + * @param[in] numberOfCharacters The number of characters. + * @param[out] directions The direction, @e false is left to right and @e true is right to left, of each character of the paragraph. */ -void ReorderLines( LogicalModel& logicalModel, - const VisualModel& visualModel, - CharacterIndex characterIndex, - Length numberOfCharactersToRemove, - Length numberOfCharactersToInsert ); +void GetCharactersDirection(const Vector& bidirectionalInfo, + Length totalNumberOfCharacters, + CharacterIndex startIndex, + Length numberOfCharacters, + Vector& directions); -/** - * @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& text, - Vector& mirroredText ); } // namespace Text } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__ +#endif // DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H