a370c0289ae87e9019de511762ec26fbe47a1f95
[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) 2015 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 /**
39  * @brief Struct used to pass parameters.
40  */
41 struct LayoutParameters
42 {
43   /**
44    * Constructor with the needed parameters to layout the text.
45    *
46    * @param[in] boundingBox The size of the box containing the text.
47    * @param[in] textBuffer The text buffer.
48    * @param[in] lineBreakInfoBuffer The line break info.
49    * @param[in] wordBreakInfoBuffer The word break info.
50    * @param[in] totalNumberOfGlyphs The number of glyphs.
51    * @param[in] glyphsBuffer A vector with glyphs.
52    * @param[in] glyphsToCharactersBuffer Vector with indices pointing the first character of each glyph.
53    * @param[in] charactersPerGlyphBuffer Vector with the number of characters that forms each glyph.
54    */
55   LayoutParameters( const Vector2& boundingBox,
56                     const Character* const textBuffer,
57                     const LineBreakInfo* const lineBreakInfoBuffer,
58                     const WordBreakInfo* const wordBreakInfoBuffer,
59                     Length totalNumberOfGlyphs,
60                     const GlyphInfo* const glyphsBuffer,
61                     const CharacterIndex* const glyphsToCharactersBuffer,
62                     const Length* const charactersPerGlyphBuffer )
63   : boundingBox( boundingBox ),
64     textBuffer( textBuffer ),
65     lineBreakInfoBuffer( lineBreakInfoBuffer ),
66     wordBreakInfoBuffer( wordBreakInfoBuffer ),
67     totalNumberOfGlyphs( totalNumberOfGlyphs ),
68     glyphsBuffer( glyphsBuffer ),
69     glyphsToCharactersBuffer( glyphsToCharactersBuffer ),
70     charactersPerGlyphBuffer( charactersPerGlyphBuffer ),
71     charactersToGlyphsBuffer( NULL ),
72     glyphsPerCharacterBuffer( NULL ),
73     lineBidirectionalInfoRunsBuffer( NULL ),
74     numberOfBidirectionalInfoRuns( 0u )
75   {}
76
77   Vector2                     boundingBox;
78   const Character* const      textBuffer;
79   const LineBreakInfo* const  lineBreakInfoBuffer;
80   const WordBreakInfo* const  wordBreakInfoBuffer;
81   Length                      totalNumberOfGlyphs;
82   const GlyphInfo* const      glyphsBuffer;
83   const CharacterIndex* const glyphsToCharactersBuffer;
84   const Length* const         charactersPerGlyphBuffer;
85   GlyphIndex*                 charactersToGlyphsBuffer;        ///< The character to glyph conversion table.
86   Length*                     glyphsPerCharacterBuffer;        ///< The number of glyphs per character.
87   BidirectionalLineInfoRun*   lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
88   Length                      numberOfBidirectionalInfoRuns;   ///< The number of lines with bidirectional info.
89 };
90
91 } // namespace Text
92
93 } // namespace Toolkit
94
95 } // namespace Dali
96
97 #endif // __DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H__