There is a problem that ellipsis does not work properly when MIN_LINE_SIZE is set.
[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) 2017 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/public-api/text/text-enumerations.h>
26 #include <dali-toolkit/internal/text/text-definitions.h>
27 #include <dali-toolkit/internal/text/text-model.h>
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace Text
36 {
37
38 struct BidirectionalLineInfoRun;
39
40 namespace Layout
41 {
42
43 /**
44  * @brief Struct used to pass parameters.
45  */
46 struct Parameters
47 {
48   /**
49    * Constructor with the needed parameters to layout the text.
50    *
51    * @param[in] boundingBox The size of the box containing the text.
52    * @param[in,out] textModel The text's model.
53    */
54   Parameters( const Vector2& boundingBox,
55               ModelPtr textModel )
56   : boundingBox{ boundingBox },
57     textModel{ textModel },
58     lineBidirectionalInfoRunsBuffer{ nullptr },
59     numberOfBidirectionalInfoRuns{ 0u },
60     startGlyphIndex{ 0u },
61     numberOfGlyphs{ 0u },
62     startLineIndex{ 0u },
63     estimatedNumberOfLines{ 0u },
64     interGlyphExtraAdvance{ 0.f },
65     isLastNewParagraph{ false }
66   {}
67
68   Vector2                         boundingBox;                     ///< The size of the box containing the text.
69   ModelPtr textModel;
70   BidirectionalLineInfoRun*       lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
71   Length                          numberOfBidirectionalInfoRuns;   ///< The number of lines with bidirectional info.
72   GlyphIndex                      startGlyphIndex;                 ///< Index to the first glyph to layout.
73   Length                          numberOfGlyphs;                  ///< The number of glyphs to layout.
74   LineIndex                       startLineIndex;                  ///< The line index where to insert the new lines.
75   Length                          estimatedNumberOfLines;          ///< The estimated number of lines.
76   float                           interGlyphExtraAdvance;          ///< Extra advance added to each glyph.
77   bool                            isLastNewParagraph:1;            ///< Whether the last character is a new paragraph character.
78 };
79
80 } // namespace Layout
81
82 } // namespace Text
83
84 } // namespace Toolkit
85
86 } // namespace Dali
87
88 #endif // DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H