Merge "Update README for dali-swig" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / layouts / layout-parameters.h
1 #ifndef DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
2 #define DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
3
4 /*
5  * Copyright (c) 2016 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 // EXTERNAL INCLUDES
22 #include <dali/public-api/math/vector2.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/text/text-definitions.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Text
34 {
35
36 struct BidirectionalLineInfoRun;
37
38 namespace Layout
39 {
40
41 /**
42  * @brief Struct used to pass parameters.
43  */
44 struct Parameters
45 {
46   /**
47    * Constructor with the needed parameters to layout the text.
48    *
49    * @param[in] boundingBox The size of the box containing the text.
50    * @param[in] textBuffer The text buffer.
51    * @param[in] lineBreakInfoBuffer The line break info.
52    * @param[in] wordBreakInfoBuffer The word break info.
53    * @param[in] characterDirectionBuffer Vector with the direction of each character.
54    * @param[in] glyphsBuffer Vector with glyphs.
55    * @param[in] glyphsToCharactersBuffer Vector with indices pointing the first character of each glyph.
56    * @param[in] charactersPerGlyphBuffer Vector with the number of characters that forms each glyph.
57    * @param[in] charactersToGlyphsBuffer Vector with indices pointing the first glyph of each character.
58    * @param[in] glyphsPerCharacterBuffer Vector with the number of glyphs shaped from the character.
59    * @param[in] totalNumberOfGlyphs The number of glyphs.
60    * @param[in] horizontalAlignment The horizontal alignment.
61    */
62   Parameters( const Vector2& boundingBox,
63               const Character* const textBuffer,
64               const LineBreakInfo* const lineBreakInfoBuffer,
65               const WordBreakInfo* const wordBreakInfoBuffer,
66               const CharacterDirection* const characterDirectionBuffer,
67               const GlyphInfo* const glyphsBuffer,
68               const CharacterIndex* const glyphsToCharactersBuffer,
69               const Length* const charactersPerGlyphBuffer,
70               const GlyphIndex* const charactersToGlyphsBuffer,
71               const Length* const glyphsPerCharacterBuffer,
72               Length totalNumberOfGlyphs,
73               HorizontalAlignment horizontalAlignment )
74   : boundingBox( boundingBox ),
75     textBuffer( textBuffer ),
76     lineBreakInfoBuffer( lineBreakInfoBuffer ),
77     wordBreakInfoBuffer( wordBreakInfoBuffer ),
78     characterDirectionBuffer( characterDirectionBuffer ),
79     glyphsBuffer( glyphsBuffer ),
80     glyphsToCharactersBuffer( glyphsToCharactersBuffer ),
81     charactersPerGlyphBuffer( charactersPerGlyphBuffer ),
82     charactersToGlyphsBuffer( charactersToGlyphsBuffer ),
83     glyphsPerCharacterBuffer( glyphsPerCharacterBuffer ),
84     lineBidirectionalInfoRunsBuffer( NULL ),
85     numberOfBidirectionalInfoRuns( 0u ),
86     startGlyphIndex( 0u ),
87     numberOfGlyphs( 0u ),
88     totalNumberOfGlyphs( totalNumberOfGlyphs ),
89     horizontalAlignment( horizontalAlignment ),
90     startLineIndex( 0u ),
91     estimatedNumberOfLines( 0u ),
92     isLastNewParagraph( false )
93   {}
94
95   Vector2                         boundingBox;                     ///< The size of the box containing the text.
96   const Character* const          textBuffer;                      ///< The text buffer.
97   const LineBreakInfo* const      lineBreakInfoBuffer;             ///< The line break info.
98   const WordBreakInfo* const      wordBreakInfoBuffer;             ///< The word break info.
99   const CharacterDirection* const characterDirectionBuffer;        ///< Vector with the direction of each character.
100   const GlyphInfo* const          glyphsBuffer;                    ///< Vector with glyphs.
101   const CharacterIndex* const     glyphsToCharactersBuffer;        ///< Vector with indices pointing the first character of each glyph.
102   const Length* const             charactersPerGlyphBuffer;        ///< Vector with the number of characters that forms each glyph.
103   const GlyphIndex* const         charactersToGlyphsBuffer;        ///< Vector with indices pointing the first glyph of each character.
104   const Length* const             glyphsPerCharacterBuffer;        ///< Vector with the number of glyphs shaped from the character.
105   BidirectionalLineInfoRun*       lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
106   Length                          numberOfBidirectionalInfoRuns;   ///< The number of lines with bidirectional info.
107   GlyphIndex                      startGlyphIndex;                 ///< Index to the first glyph to layout.
108   Length                          numberOfGlyphs;                  ///< The number of glyphs to layout.
109   Length                          totalNumberOfGlyphs;             ///< The number of glyphs.
110   HorizontalAlignment             horizontalAlignment;             ///< The horizontal alignment.
111   LineIndex                       startLineIndex;                  ///< The line index where to insert the new lines.
112   Length                          estimatedNumberOfLines;          ///< The estimated number of lines.
113   bool                            isLastNewParagraph;              ///< Whether the last character is a new paragraph character.
114 };
115
116 } // namespace Layout
117
118 } // namespace Text
119
120 } // namespace Toolkit
121
122 } // namespace Dali
123
124 #endif // DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H