2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/hyphenator.h>
22 #include <dali/devel-api/text-abstraction/hyphenation.h>
25 #include <dali-toolkit/internal/text/character-set-conversion.h>
27 #include <cstring> // for strcmp
35 const char* UTF8 = "UTF-8";
37 Vector<bool> GetWordHyphens(const Character* word,
43 if(0u == wordSize || word == nullptr)
45 // Nothing to do if there are no characters.
49 TextAbstraction::Hyphenation hyphenation = TextAbstraction::Hyphenation::Get();
51 // first get the needed encoding
53 if(strcmp(hyphenation.GetDictionaryEncoding(lang), UTF8) == 0)
55 Utf32ToUtf8(word, wordSize, text);
59 text = std::string((char*)word, (size_t)(wordSize * sizeof(Character)));
62 return hyphenation.GetWordHyphens(text.c_str(), (int)text.length(), lang);
67 } // namespace Toolkit