[dali_2.1.7] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / layouts / layout-engine-helper-functions.h
1 #ifndef DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_HELPER_FUNCTIONS_H
2 #define DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_HELPER_FUNCTIONS_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDE
22 #include <dali-toolkit/internal/text/logical-model-impl.h>
23 #include <dali-toolkit/internal/text/visual-model-impl.h>
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Text
30 {
31 namespace Layout
32 {
33 /**
34    * @brief Calculate glyph positions when set glyph positions for left to right.
35    *
36    * @param[in] visualModel The visual model.
37    * @param[in] logicalModel The logical model.
38    * @param[in] interGlyphExtraAdvance Extra advance added to each glyph.
39    * @param[in] numberOfGlyphs The number of glyphs.
40    * @param[in] startIndexForGlyph The index of the first glyph in the line.
41    * @param[in] startIndexForGlyphPositions The index of the first glyph for GlyphPositions.
42    * @param[in,out] glyphPositionsBuffer The glyph positions buffer.
43    * @param[in,out] penX The current position for the horizontal pen.
44    */
45 void CalculateGlyphPositionsLTR(const VisualModelPtr&  visualModel,
46                                 const LogicalModelPtr& logicalModel,
47                                 const float            interGlyphExtraAdvance,
48                                 const Length           numberOfGlyphs,
49                                 const GlyphIndex       startIndexForGlyph,
50                                 const GlyphIndex       startIndexForGlyphPositions,
51                                 Vector2*               glyphPositionsBuffer,
52                                 float&                 penX);
53
54 /**
55    * @brief Calculate glyph positions when set glyph positions for right to left.
56    *
57    * @param[in] visualModel The visual model.
58    * @param[in] logicalModel The logical model.
59    * @param[in] bidiLineIndex Index to the line's bidirectional info.
60    * @param[in] startGlyphIndex The index of the first glyph in the line.
61    * @param[in,out] glyphPositionsBuffer The glyph positions buffer.
62    * @param[in] characterVisualIndex The character visual index.
63    * @param[in] characterLogicalIndex The character logical index.
64    * @param[in,out] penX The current position for the horizontal pen.
65    */
66 void CalculateGlyphPositionsRTL(const VisualModelPtr&            visualModel,
67                                 const LogicalModelPtr&           logicalModel,
68                                 const BidirectionalLineRunIndex& bidiLineIndex,
69                                 const GlyphIndex&                startGlyphIndex,
70                                 Vector2*                         glyphPositionsBuffer,
71                                 CharacterIndex&                  characterVisualIndex,
72                                 CharacterIndex&                  characterLogicalIndex,
73                                 float&                           penX);
74
75 /**
76    * @brief Calculate glyph positions when set glyph positions for right to left.
77    *
78    * @param[in] visualModel The visual model.
79    * @param[in] textBuffer The text buffer.
80    * @param[in] startGlyphIndex The index of the first glyph in the line.
81    * @param[in] interGlyphExtraAdvance Extra advance added to each glyph.
82    * @param[in] bidiLineCharacterRun The initial character index within the whole text and the number of characters of the run for BidirectionalLine.
83    * @param[in] bidiLineVisualToLogicalMap Pointer to the visual to logical map table for BidirectionalLine.
84    * @param[in,out] glyphPositionsBuffer The glyph positions buffer.
85    * @param[in,out] characterLogicalIndex The character logical index.
86    * @param[in,out] penX The current position for the horizontal pen.
87    */
88 void TraversesCharactersForGlyphPositionsRTL(const VisualModelPtr&  visualModel,
89                                              const Character* const textBuffer,
90                                              const GlyphIndex&      startGlyphIndex,
91                                              const float            interGlyphExtraAdvance,
92                                              const CharacterRun&    bidiLineCharacterRun,
93                                              CharacterIndex*        bidiLineVisualToLogicalMap,
94                                              Vector2*               glyphPositionsBuffer,
95                                              CharacterIndex&        characterLogicalIndex,
96                                              float&                 penX);
97
98 } // namespace Layout
99
100 } // namespace Text
101
102 } // namespace Toolkit
103
104 } // namespace Dali
105
106 #endif // DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_HELPER_FUNCTIONS_H