1 #ifndef DALI_PLATFORM_TEXT_ABSTRACTION_HYPHENATION_H
2 #define DALI_PLATFORM_TEXT_ABSTRACTION_HYPHENATION_H
5 * Copyright (c) 2021 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
39 * @brief Hyphenation provides an interface to retrieve possible hyphenation of the text.
41 * This module get the hyphen positions for a word.
42 * To get the hyphen positions it needs to load the dictionary for the word language.
43 * also it need the word to be send using the correct encoding which can be known using
46 * Hyphenation hyphenation = Hyphenation::Get();
48 * Character* text = "Hyphenation";
50 * // get a vector of booleans that indicates possible hyphen locations.
51 * Vector<bool> *hyphens = hyphenation.GetWordHyphens(text, 11, "en_US");
55 class DALI_ADAPTOR_API Hyphenation : public BaseHandle
59 * @brief Create an uninitialized Hyphenation handle.
67 * This is non-virtual since derived Handle types must not contain data or virtual methods.
72 * @brief This constructor is used by Hyphenation::Get().
74 * @param[in] implementation A pointer to the internal hyphenation object.
76 explicit DALI_INTERNAL Hyphenation(Internal::Hyphenation* implementation);
79 * @brief Retrieve a handle to the Hyphenation instance.
81 * @return A handle to the Hyphenation.
83 static Hyphenation Get();
87 * Gets the encoding of the dictionary for the given language
89 * @param[in] lang language to get encoding for (en_US).
91 * @return The encoding of the language (UTF-32).
93 const char* GetDictionaryEncoding(const char* lang);
96 * Gets a vector booleans that indicates possible hyphen locations.
98 * @param[in] word the word to get possible hyphens for.
99 * @param[in] wordSize the word size in bytes.
100 * @param[in] lang the language for the word
102 * @return vector of boolean, true if possible to hyphenate at this character position.
104 Vector<bool> GetWordHyphens(const char* word,
109 } // namespace TextAbstraction
113 #endif // DALI_PLATFORM_TEXT_ABSTRACTION_HYPHENATION_H