1 #ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__
2 #define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/dali-vector.h>
25 #include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
26 #include <dali-toolkit/internal/text/bidirectional-paragraph-info-run.h>
27 #include <dali-toolkit/internal/text/line-run.h>
28 #include <dali-toolkit/internal/text/script-run.h>
43 * Sets the bidirectional info into the logical model.
45 * @param[in] text Vector of UTF-32 characters.
46 * @param[in] scripts Vector containing the script runs for the whole text.
47 * @param[in] lineBreakInfo The line break info.
48 * @param[out] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
50 void SetBidirectionalInfo( const Vector<Character>& text,
51 const Vector<ScriptRun>& scripts,
52 const Vector<LineBreakInfo>& lineBreakInfo,
53 Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
56 * Sets the visual to logical map tables.
58 * Any map tables previously set are removed.
59 * It sets the paragraph's direction to each line.
61 * @pre The @p logicalModel needs to have a text set.
62 * @pre The @p logicalModel needs to have the bidirectional info indices for each paragraph set.
63 * @pre The @p visualModel needs to have the laid-out lines info set.
65 * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
66 * @param[in,out] lineRuns The line runs converted to characters.
67 * @param[out] lineInfoRuns line runs with the visual to logical conversion maps.
69 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
70 Vector<LineRun>& lineRuns,
71 Vector<BidirectionalLineInfoRun>& lineInfoRuns );
74 * @brief Replaces any character in the right to left paragraphs which could be mirrored.
76 * @param[in] text The text.
77 * @param[in] mirroredText The mirroredText.
78 * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
80 * @return @e true if a character has been replaced.
82 bool GetMirroredText( const Vector<Character>& text,
83 Vector<Character>& mirroredText,
84 const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
87 * @brief Retrieves the character's directions.
89 * @pre The @p logicalModel needs to have a text set.
90 * @pre The @p logicalModel needs to have the bidirectional info indices for each paragraph set.
92 * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
93 * @param[out] directions The direction, @e false is left to right and @e true is right to left, of each character of the paragraph.
95 void GetCharactersDirection( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
96 Vector<CharacterDirection>& directions );
100 } // namespace Toolkit
104 #endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__