1 #ifndef DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H
2 #define DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H
5 * Copyright (c) 2022 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/devel-api/text-abstraction/text-abstraction-definitions.h>
23 #include <dali/public-api/dali-adaptor-common.h>
26 #include <dali/public-api/object/base-handle.h>
30 namespace TextAbstraction
32 namespace Internal DALI_INTERNAL
36 } // namespace DALI_INTERNAL
38 } // namespace TextAbstraction
40 namespace TextAbstraction
46 class DALI_ADAPTOR_API Segmentation : public BaseHandle
50 * @brief Create an uninitialized TextAbstraction handle.
58 * This is non-virtual since derived Handle types must not contain data or virtual methods.
63 * @brief This constructor is used by Segmentation::Get().
65 * @param[in] implementation A pointer to the internal segmentation object.
67 explicit DALI_INTERNAL Segmentation(Internal::Segmentation* implementation);
70 * @brief Retrieve a handle to the Segmentation instance.
72 * @return A handle to the Segmentation
74 static Segmentation Get();
77 * @brief Retrieves the line break info.
79 * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
81 * Possible values for LineBreakInfo are:
83 * - 0 is a LINE_MUST_BREAK. Text must be broken into a new line.
84 * - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
85 * - 2 is a LINE_NO_BREAK. Text can't be broken into a new line.
88 i.e. Hello big\nworld produces:
92 * @param[in] text Pointer to the first character of the text coded in UTF32.
93 * @param[in] numberOfCharacters The number of characters.
94 * @param[out] breakInfo The line break info.
96 void GetLineBreakPositions(const Character* const text,
97 Length numberOfCharacters,
98 LineBreakInfo* breakInfo);
101 * @brief Retrieves the word break info.
103 * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
105 * Possible values for WordBreakInfo are:
107 * - 0 is a WORD_BREAK. Text can be broken into a new word.
108 * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
111 i.e. Hello big\nworld produces:
115 * @param[in] text Pointer to the first character of the text coded in UTF32.
116 * @param[in] numberOfCharacters The number of characters.
117 * @param[out] breakInfo The word break info.
119 void GetWordBreakPositions(const Character* const text,
120 Length numberOfCharacters,
121 WordBreakInfo* breakInfo);
124 * @brief Retrieves the line break info from utf8.
126 * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
128 * Possible values for LineBreakInfo are:
130 * - 0 is a LINE_MUST_BREAK. Text must be broken into a new line.
131 * - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
132 * - 2 is a LINE_NO_BREAK. Text can't be broken into a new line.
135 i.e. Hello big\nworld produces:
139 * @param[in] text Pointer to the first character of the text coded in UTF8.
140 * @param[in] numberOfCharacters The number of characters.
141 * @param[out] breakInfo The line break info.
143 void GetLineBreakPositionsUtf8(const uint8_t* const text,
144 Length numberOfCharacters,
145 LineBreakInfo* breakInfo);
148 * @brief Retrieves the word break info from utf8.
150 * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
152 * Possible values for WordBreakInfo are:
154 * - 0 is a WORD_BREAK. Text can be broken into a new word.
155 * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
158 i.e. Hello big\nworld produces:
162 * @param[in] text Pointer to the first character of the text coded in UTF8.
163 * @param[in] numberOfCharacters The number of characters.
164 * @param[out] breakInfo The word break info.
166 void GetWordBreakPositionsUtf8(const uint8_t* const text,
167 Length numberOfCharacters,
168 WordBreakInfo* breakInfo);
171 } // namespace TextAbstraction
175 #endif // DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H