1 #ifndef DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
2 #define DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
5 * Copyright (c) 2017 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/math/vector2.h>
25 #include <dali-toolkit/public-api/text/text-enumerations.h>
26 #include <dali-toolkit/internal/text/text-definitions.h>
37 struct BidirectionalLineInfoRun;
43 * @brief Struct used to pass parameters.
48 * Constructor with the needed parameters to layout the text.
50 * @param[in] boundingBox The size of the box containing the text.
51 * @param[in] textBuffer The text buffer.
52 * @param[in] lineBreakInfoBuffer The line break info.
53 * @param[in] wordBreakInfoBuffer The word break info.
54 * @param[in] characterDirectionBuffer Vector with the direction of each character.
55 * @param[in] glyphsBuffer Vector with glyphs.
56 * @param[in] glyphsToCharactersBuffer Vector with indices pointing the first character of each glyph.
57 * @param[in] charactersPerGlyphBuffer Vector with the number of characters that forms each glyph.
58 * @param[in] charactersToGlyphsBuffer Vector with indices pointing the first glyph of each character.
59 * @param[in] glyphsPerCharacterBuffer Vector with the number of glyphs shaped from the character.
60 * @param[in] totalNumberOfGlyphs The number of glyphs.
61 * @param[in] horizontalAlignment The horizontal alignment.
62 * @param[in] lineWrapMode The text wrap mode.
64 Parameters( const Vector2& boundingBox,
65 const Character* const textBuffer,
66 const LineBreakInfo* const lineBreakInfoBuffer,
67 const WordBreakInfo* const wordBreakInfoBuffer,
68 const CharacterDirection* const characterDirectionBuffer,
69 const GlyphInfo* const glyphsBuffer,
70 const CharacterIndex* const glyphsToCharactersBuffer,
71 const Length* const charactersPerGlyphBuffer,
72 const GlyphIndex* const charactersToGlyphsBuffer,
73 const Length* const glyphsPerCharacterBuffer,
74 Length totalNumberOfGlyphs,
75 Text::HorizontalAlignment::Type horizontalAlignment,
76 Text::LineWrap::Mode lineWrapMode )
77 : boundingBox( boundingBox ),
78 textBuffer( textBuffer ),
79 lineBreakInfoBuffer( lineBreakInfoBuffer ),
80 wordBreakInfoBuffer( wordBreakInfoBuffer ),
81 characterDirectionBuffer( characterDirectionBuffer ),
82 glyphsBuffer( glyphsBuffer ),
83 glyphsToCharactersBuffer( glyphsToCharactersBuffer ),
84 charactersPerGlyphBuffer( charactersPerGlyphBuffer ),
85 charactersToGlyphsBuffer( charactersToGlyphsBuffer ),
86 glyphsPerCharacterBuffer( glyphsPerCharacterBuffer ),
87 lineBidirectionalInfoRunsBuffer( NULL ),
88 numberOfBidirectionalInfoRuns( 0u ),
89 startGlyphIndex( 0u ),
91 totalNumberOfGlyphs( totalNumberOfGlyphs ),
92 horizontalAlignment( horizontalAlignment ),
94 estimatedNumberOfLines( 0u ),
95 lineWrapMode( lineWrapMode ),
96 isLastNewParagraph( false )
99 Vector2 boundingBox; ///< The size of the box containing the text.
100 const Character* const textBuffer; ///< The text buffer.
101 const LineBreakInfo* const lineBreakInfoBuffer; ///< The line break info.
102 const WordBreakInfo* const wordBreakInfoBuffer; ///< The word break info.
103 const CharacterDirection* const characterDirectionBuffer; ///< Vector with the direction of each character.
104 const GlyphInfo* const glyphsBuffer; ///< Vector with glyphs.
105 const CharacterIndex* const glyphsToCharactersBuffer; ///< Vector with indices pointing the first character of each glyph.
106 const Length* const charactersPerGlyphBuffer; ///< Vector with the number of characters that forms each glyph.
107 const GlyphIndex* const charactersToGlyphsBuffer; ///< Vector with indices pointing the first glyph of each character.
108 const Length* const glyphsPerCharacterBuffer; ///< Vector with the number of glyphs shaped from the character.
109 BidirectionalLineInfoRun* lineBidirectionalInfoRunsBuffer; ///< Bidirectional conversion tables per line.
110 Length numberOfBidirectionalInfoRuns; ///< The number of lines with bidirectional info.
111 GlyphIndex startGlyphIndex; ///< Index to the first glyph to layout.
112 Length numberOfGlyphs; ///< The number of glyphs to layout.
113 Length totalNumberOfGlyphs; ///< The number of glyphs.
114 HorizontalAlignment::Type horizontalAlignment; ///< The horizontal alignment.
115 LineIndex startLineIndex; ///< The line index where to insert the new lines.
116 Length estimatedNumberOfLines; ///< The estimated number of lines.
117 Text::LineWrap::Mode lineWrapMode; ///< The line wrap mode for moving to next line.
118 bool isLastNewParagraph; ///< Whether the last character is a new paragraph character.
121 } // namespace Layout
125 } // namespace Toolkit
129 #endif // DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H