Fixed crash when Visual model positions < glyphs
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / segmentation.h
1 #ifndef __DALI_TOOLKIT_TEXT_SEGMENTATION_H__
2 #define __DALI_TOOLKIT_TEXT_SEGMENTATION_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 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali-toolkit/internal/text/text-definitions.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Text
32 {
33
34 class LogicalModel;
35
36 /**
37  * Sets line break info.
38  *
39  * Possible values for LineBreakInfo are:
40  *
41  *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
42  *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
43  *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
44  *
45  * @param[in] text Vector of UTF-32 characters.
46  * @param[out] lineBreakInfo The line break info
47  */
48 void SetLineBreakInfo( const Vector<Character>& text,
49                        Vector<LineBreakInfo>& lineBreakInfo );
50
51 /**
52  * Replaces line break info.
53  *
54  * @pre The @p model needs to have a text set.
55  *
56  * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
57  * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
58  *
59  * @param[in,out] model The text's logical model.
60  * @param[in] characterIndex Index to the first character.
61  * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
62  * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
63  */
64 void ReplaceLineBreakInfo( LogicalModel& model,
65                            CharacterIndex characterIndex,
66                            Length numberOfCharactersToRemove,
67                            Length numberOfCharactersToInsert );
68
69 /**
70  * Sets word break info.
71  *
72  * - 0 is a WORD_BREAK.    Text can be broken into a new word.
73  * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
74  *
75  * @param[in] text Vector of UTF-32 characters.
76  * @param[out] wordBreakInfo The word break info.
77  */
78 void SetWordBreakInfo( const Vector<Character>& text,
79                        Vector<WordBreakInfo>& wordBreakInfo );
80
81 /**
82  * Replaces word break info.
83  *
84  * @pre The @p model needs to have a text set.
85  *
86  * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
87  * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
88  *
89  * @param[in,out] model The text's logical model.
90  * @param[in] characterIndex Index to the first character.
91  * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
92  * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
93  */
94 void ReplaceWordBreakInfo( LogicalModel& model,
95                            CharacterIndex characterIndex,
96                            Length numberOfCharactersToRemove,
97                            Length numberOfCharactersToInsert );
98
99 } // namespace Text
100
101 } // namespace Toolkit
102
103 } // namespace Dali
104
105 #endif // __DALI_TOOLKIT_TEXT_SEGMENTATION_H__