CHECK_MODULE_AND_SET( LIBDRM libdrm [] )
CHECK_MODULE_AND_SET( LIBCURL libcurl [] )
CHECK_MODULE_AND_SET( HARFBUZZ harfbuzz [] )
-CHECK_MODULE_AND_SET( HYPHEN libhyphen [] )
CHECK_MODULE_AND_SET( FRIBIDI fribidi [] )
CHECK_MODULE_AND_SET( CAIRO cairo [] )
CHECK_MODULE_AND_SET( EVAS evas [] )
-lturbojpeg
-ljpeg
)
-
-if( NOT ANDROID_PROFILE )
- SET( DALI_LDFLAGS ${DALI_LDFLAGS}
- -lhyphen
- )
-ENDIF()
-
ENDIF()
# Android includes pthread with android lib
)
ENDIF()
-# Set the linker flags
-SET(REQUIRED_LIBS
- -lhyphen
-)
-
-FIND_LIBRARY( HYPHEN_LIBRARY NAMES hyphen )
-IF (${HYPHEN_LIBRARY} MATCHES "HYPHEN_LIBRARY-NOTFOUND")
- UNSET (HYPHEN_LIBRARY_AVAILABLE)
-ELSE()
- SET (HYPHEN_LIBRARY_AVAILABLE "HYPHEN_LIBRARY_AVAILABLE")
- ADD_DEFINITIONS(-DHYPHEN_LIBRARY_AVAILABLE="${HYPHEN_LIBRARY_AVAILABLE}")
-
- #The path of hyphen library dictionary
- IF (NOT "${HYPHEN_DIC}")
- FIND_PATH(HYPHEN_DIC hyph_en_US.dic HINTS "/usr/local/share/hyphen" "/usr/share/hyphen" )
- IF ( NOT HYPHEN_DIC MATCHES "HYPHEN_DIC-NOTFOUND")
- ADD_DEFINITIONS(-DHYPHEN_DIC="${HYPHEN_DIC}")
- ENDIF()
- ENDIF()
- MESSAGE (HYPHEN_DIC: "${HYPHEN_DIC}")
-
-ENDIF()
-
)
ENDIF()
-# Set the linker flags
-SET(REQUIRED_LIBS
- -lhyphen
-)
-
-FIND_LIBRARY( HYPHEN_LIBRARY NAMES hyphen )
-IF (${HYPHEN_LIBRARY} MATCHES "HYPHEN_LIBRARY-NOTFOUND")
- UNSET (HYPHEN_LIBRARY_AVAILABLE)
-ELSE()
- SET (HYPHEN_LIBRARY_AVAILABLE "HYPHEN_LIBRARY_AVAILABLE")
- ADD_DEFINITIONS(-DHYPHEN_LIBRARY_AVAILABLE="${HYPHEN_LIBRARY_AVAILABLE}")
-
- #The path of hyphen library dictionary
- IF (NOT "${HYPHEN_DIC}")
- FIND_PATH(HYPHEN_DIC hyph_en_US.dic HINTS "/usr/local/share/hyphen" "/usr/share/hyphen" )
- IF ( NOT HYPHEN_DIC MATCHES "HYPHEN_DIC-NOTFOUND")
- ADD_DEFINITIONS(-DHYPHEN_DIC="${HYPHEN_DIC}")
- ENDIF()
- ENDIF()
- MESSAGE (HYPHEN_DIC: "${HYPHEN_DIC}")
-
-ENDIF()
)
ENDIF()
-# Set the linker flags
-SET(REQUIRED_LIBS
- -lhyphen
-)
-
-FIND_LIBRARY( HYPHEN_LIBRARY NAMES hyphen )
-IF (${HYPHEN_LIBRARY} MATCHES "HYPHEN_LIBRARY-NOTFOUND")
- UNSET (HYPHEN_LIBRARY_AVAILABLE)
-ELSE()
- SET (HYPHEN_LIBRARY_AVAILABLE "HYPHEN_LIBRARY_AVAILABLE")
- ADD_DEFINITIONS(-DHYPHEN_LIBRARY_AVAILABLE="${HYPHEN_LIBRARY_AVAILABLE}")
-
- #The path of hyphen library dictionary
- IF (NOT "${HYPHEN_DIC}")
- FIND_PATH(HYPHEN_DIC hyph_en_US.dic HINTS "/usr/local/share/hyphen" "/usr/share/hyphen" )
- IF ( NOT HYPHEN_DIC MATCHES "HYPHEN_DIC-NOTFOUND")
- ADD_DEFINITIONS(-DHYPHEN_DIC="${HYPHEN_DIC}")
- ENDIF()
- ENDIF()
- MESSAGE (HYPHEN_DIC: "${HYPHEN_DIC}")
-
-ENDIF()
-
-lpthread
-lturbojpeg
-ljpeg
- -lhyphen
)
-
-
-FIND_LIBRARY( HYPHEN_LIBRARY NAMES hyphen )
-IF (${HYPHEN_LIBRARY} MATCHES "HYPHEN_LIBRARY-NOTFOUND")
- UNSET (HYPHEN_LIBRARY_AVAILABLE)
-ELSE()
- SET (HYPHEN_LIBRARY_AVAILABLE "HYPHEN_LIBRARY_AVAILABLE")
- ADD_DEFINITIONS(-DHYPHEN_LIBRARY_AVAILABLE="${HYPHEN_LIBRARY_AVAILABLE}")
-
- #The path of hyphen library dictionary
- IF (NOT "${HYPHEN_DIC}")
- FIND_PATH(HYPHEN_DIC hyph_en_US.dic HINTS "/usr/local/share/hyphen" "/usr/share/hyphen" )
- IF ( NOT HYPHEN_DIC MATCHES "HYPHEN_DIC-NOTFOUND")
- ADD_DEFINITIONS(-DHYPHEN_DIC="${HYPHEN_DIC}")
- ENDIF()
- ENDIF()
- MESSAGE (HYPHEN_DIC: "${HYPHEN_DIC}")
-
-ENDIF()
-
${adaptor_devel_api_dir}/text-abstraction/shaping.cpp
${adaptor_devel_api_dir}/text-abstraction/text-renderer.cpp
${adaptor_devel_api_dir}/text-abstraction/text-renderer-layout-helper.cpp
- ${adaptor_devel_api_dir}/text-abstraction/hyphenation.cpp
)
${adaptor_devel_api_dir}/text-abstraction/text-abstraction-definitions.h
${adaptor_devel_api_dir}/text-abstraction/text-renderer.h
${adaptor_devel_api_dir}/text-abstraction/text-renderer-layout-helper.h
- ${adaptor_devel_api_dir}/text-abstraction/hyphenation.h
)
+++ /dev/null
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/devel-api/text-abstraction/hyphenation.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/text/text-abstraction/hyphenation-impl.h>
-
-namespace Dali
-{
-namespace TextAbstraction
-{
-Hyphenation::Hyphenation()
-{
-}
-
-Hyphenation::~Hyphenation()
-{
-}
-
-Hyphenation::Hyphenation(Internal::Hyphenation* impl)
-: BaseHandle(impl)
-{
-}
-
-Hyphenation Hyphenation::Get()
-{
- return Internal::Hyphenation::Get();
-}
-
-const char* Hyphenation::GetDictionaryEncoding(const char* lang)
-{
- return GetImplementation(*this).GetDictionaryEncoding(lang);
-}
-
-Vector<bool> Hyphenation::GetWordHyphens(const char* word,
- Length wordSize,
- const char* lang)
-{
- return GetImplementation(*this).GetWordHyphens(word,
- wordSize,
- lang);
-}
-
-} // namespace TextAbstraction
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_PLATFORM_TEXT_ABSTRACTION_HYPHENATION_H
-#define DALI_PLATFORM_TEXT_ABSTRACTION_HYPHENATION_H
-
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
-#include <dali/public-api/dali-adaptor-common.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-handle.h>
-
-namespace Dali
-{
-namespace TextAbstraction
-{
-namespace Internal DALI_INTERNAL
-{
-class Hyphenation;
-
-} // namespace DALI_INTERNAL
-
-/**
- * @brief Hyphenation provides an interface to retrieve possible hyphenation of the text.
- *
- * This module get the hyphen positions for a word.
- * To get the hyphen positions it needs to load the dictionary for the word language.
- * also it need the word to be send using the correct encoding which can be known using
- *
- * @code
- * Hyphenation hyphenation = Hyphenation::Get();
- *
- * Character* text = "Hyphenation";
- *
- * // get a vector of booleans that indicates possible hyphen locations.
- * Vector<bool> *hyphens = hyphenation.GetWordHyphens(text, 11, "en_US");
- *
- * @endcode
- */
-class DALI_ADAPTOR_API Hyphenation : public BaseHandle
-{
-public:
- /**
- * @brief Create an uninitialized Hyphenation handle.
- *
- */
- Hyphenation();
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~Hyphenation();
-
- /**
- * @brief This constructor is used by Hyphenation::Get().
- *
- * @param[in] implementation A pointer to the internal hyphenation object.
- */
- explicit DALI_INTERNAL Hyphenation(Internal::Hyphenation* implementation);
-
- /**
- * @brief Retrieve a handle to the Hyphenation instance.
- *
- * @return A handle to the Hyphenation.
- */
- static Hyphenation Get();
-
- /**
- *
- * Gets the encoding of the dictionary for the given language
- *
- * @param[in] lang language to get encoding for (en_US).
- *
- * @return The encoding of the language (UTF-32).
- */
- const char* GetDictionaryEncoding(const char* lang);
-
- /**
- * Gets a vector booleans that indicates possible hyphen locations.
- *
- * @param[in] word the word to get possible hyphens for.
- * @param[in] wordSize the word size in bytes.
- * @param[in] lang the language for the word
- *
- * @return vector of boolean, true if possible to hyphenate at this character position.
- */
- Vector<bool> GetWordHyphens(const char* word,
- Length wordSize,
- const char* lang);
-};
-
-} // namespace TextAbstraction
-
-} // namespace Dali
-
-#endif // DALI_PLATFORM_TEXT_ABSTRACTION_HYPHENATION_H
#define DALI_TEXT_ABSTRACTION_DEFINITIONS_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
enum
{
- LINE_MUST_BREAK = 0u, ///< Text must be broken into a new line.
- LINE_ALLOW_BREAK = 1u, ///< Is possible to break the text into a new line.
- LINE_NO_BREAK = 2u, ///< Text can't be broken into a new line.
- LINE_INSIDEACHAR = 3u, ///< A UTF-8/16 sequence is unfinished.
- LINE_INDETERMINATE = 4u, ///< End of input on a non-EOL char.
- LINE_HYPHENATION_BREAK = 5u ///< Text can be broken with adding hyphen.
+ LINE_MUST_BREAK = 0u, ///< Text must be broken into a new line.
+ LINE_ALLOW_BREAK = 1u, ///< Is possible to break the text into a new line.
+ LINE_NO_BREAK = 2u ///< Text can't be broken into a new line.
};
/**
#include <dali/devel-api/text-abstraction/script.h>
#include <dali/devel-api/text-abstraction/segmentation.h>
#include <dali/devel-api/text-abstraction/shaping.h>
-#include <dali/devel-api/text-abstraction/hyphenation.h>
#endif // DALI_TEXT_ABSTRACTION_H
# module: text, backend: common
-SET( adaptor_text_common_src_files
- ${adaptor_text_dir}/text-abstraction/bidirectional-support-impl.cpp
- ${adaptor_text_dir}/text-abstraction/cairo-renderer.cpp
- ${adaptor_text_dir}/text-abstraction/font-client-helper.cpp
- ${adaptor_text_dir}/text-abstraction/font-client-impl.cpp
- ${adaptor_text_dir}/text-abstraction/font-client-plugin-impl.cpp
- ${adaptor_text_dir}/text-abstraction/segmentation-impl.cpp
- ${adaptor_text_dir}/text-abstraction/shaping-impl.cpp
+SET( adaptor_text_common_src_files
+ ${adaptor_text_dir}/text-abstraction/bidirectional-support-impl.cpp
+ ${adaptor_text_dir}/text-abstraction/cairo-renderer.cpp
+ ${adaptor_text_dir}/text-abstraction/font-client-helper.cpp
+ ${adaptor_text_dir}/text-abstraction/font-client-impl.cpp
+ ${adaptor_text_dir}/text-abstraction/font-client-plugin-impl.cpp
+ ${adaptor_text_dir}/text-abstraction/segmentation-impl.cpp
+ ${adaptor_text_dir}/text-abstraction/shaping-impl.cpp
${adaptor_text_dir}/text-abstraction/text-renderer-impl.cpp
- ${adaptor_text_dir}/text-abstraction/hyphenation-impl.cpp
)
+++ /dev/null
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/text/text-abstraction/hyphenation-impl.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-
-#include <dali/devel-api/common/singleton-service.h>
-
-// EXTERNAL INCLUDES
-#ifdef HYPHEN_LIBRARY_AVAILABLE
-#include <hyphen.h>
-#else
-#define HyphenDict void
-#endif
-
-#ifndef HYPHEN_DIC
-#define HYPHEN_DIC "abc"
-#endif
-
-namespace
-{
-#if defined(DEBUG_ENABLED)
-Dali::Integration::Log::Filter* gLogFilter = Dali::Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_HYPHENATION");
-#endif
-
-} // namespace
-
-namespace Dali
-{
-namespace TextAbstraction
-{
-namespace Internal
-{
-const char* const DEFAULT_LANGUAGE = "en_US";
-const unsigned int DEFAULT_LANGUAGE_LENGTH = 5u;
-
-struct Hyphenation::HyphenDictionary
-{
- HyphenDictionary(std::string lang, HyphenDict* dict)
- {
- mLanguage = lang;
- mDictionary = dict;
- }
-
- ~HyphenDictionary()
- {
- }
-
- std::string mLanguage;
- HyphenDict* mDictionary;
-};
-
-struct Hyphenation::Plugin
-{
- Plugin()
- : mHyphenDictionary()
- {
- }
-
- ~Plugin()
- {
-#ifdef HYPHEN_LIBRARY_AVAILABLE
- for(auto&& it : mHyphenDictionary)
- {
- hnj_hyphen_free(it.mDictionary);
- }
-#endif
- }
-
- std::string GetPathForLanguage(const char* lang)
- {
- std::string path = HYPHEN_DIC;
- std::string filName = "/hyph_";
- filName.append(lang);
- filName.append(".dic");
- path.append(filName);
-
- return path; // must be ..../hyph_en_US.dic
- }
-
- HyphenDict* LoadDictionary(const char* language)
- {
-#ifdef HYPHEN_LIBRARY_AVAILABLE
- const char* lang = (language ? language : DEFAULT_LANGUAGE);
-
- for(auto&& it : mHyphenDictionary)
- {
- if(!it.mLanguage.compare(lang))
- {
- return it.mDictionary;
- }
- }
-
- std::string path = GetPathForLanguage(lang);
- HyphenDict* dict = hnj_hyphen_load(path.c_str());
- if(!dict)
- {
- DALI_LOG_ERROR("Couldn't load hyphen dictionary:%s\n", lang);
- }
- else
- {
- mHyphenDictionary.push_back(HyphenDictionary(lang, dict));
- }
-
- return dict;
-#else
- return nullptr;
-#endif
- }
-
- const char* GetDictionaryEncoding(const char* lang)
- {
-#ifdef HYPHEN_LIBRARY_AVAILABLE
- HyphenDict* dict = LoadDictionary(lang);
- if(!dict)
- {
- return nullptr;
- }
-
- return dict->cset;
-#else
- return "UTF_32";
-#endif
- }
-
- Vector<bool> GetWordHyphens(const char* word,
- Length wordLength,
- const char* lang)
- {
- Vector<bool> hyphensList;
-
-#ifdef HYPHEN_LIBRARY_AVAILABLE
- char* hyphens = nullptr;
- char** rep = nullptr;
- int* pos = nullptr;
- int* cut = nullptr;
- HyphenDict* dict;
-
- if((!word) || (wordLength < 1))
- {
- return hyphensList;
- }
-
- dict = LoadDictionary(lang);
- if(!dict)
- {
- return hyphensList;
- }
-
- hyphens = (char*)malloc(wordLength + 5);
-
- hnj_hyphen_hyphenate2(dict, (char*)(word), wordLength, hyphens, NULL, &rep, &pos, &cut);
-
- hyphensList.PushBack(false);
-
- for(Length i = 0; i < wordLength - 1; i++)
- {
- hyphensList.PushBack((bool)(hyphens[i + 1] & 1));
- }
-
- free(hyphens);
-#endif
-
- return hyphensList;
- }
-
- std::vector<HyphenDictionary> mHyphenDictionary;
-};
-
-Hyphenation::Hyphenation()
-: mPlugin(nullptr)
-{
-}
-
-Hyphenation::~Hyphenation()
-{
-}
-
-TextAbstraction::Hyphenation Hyphenation::Get()
-{
- TextAbstraction::Hyphenation hyphenationHandle;
-
- SingletonService service(SingletonService::Get());
- if(service)
- {
- // Check whether the singleton is already created
- Dali::BaseHandle handle = service.GetSingleton(typeid(TextAbstraction::Hyphenation));
- if(handle)
- {
- // If so, downcast the handle
- Hyphenation* impl = dynamic_cast<Internal::Hyphenation*>(handle.GetObjectPtr());
- hyphenationHandle = TextAbstraction::Hyphenation(impl);
- }
- else // create and register the object
- {
- hyphenationHandle = TextAbstraction::Hyphenation(new Hyphenation);
- service.Register(typeid(hyphenationHandle), hyphenationHandle);
- }
- }
-
- return hyphenationHandle;
-}
-
-const char* Hyphenation::GetDictionaryEncoding(const char* lang)
-{
- CreatePlugin();
-
- return mPlugin->GetDictionaryEncoding(lang);
-}
-
-Vector<bool> Hyphenation::GetWordHyphens(const char* word,
- Length wordLength,
- const char* lang)
-{
- CreatePlugin();
-
- return mPlugin->GetWordHyphens(word, wordLength, lang);
-}
-
-void Hyphenation::CreatePlugin()
-{
- if(!mPlugin)
- {
- mPlugin = std::make_unique<Plugin>();
- }
-}
-
-} // namespace Internal
-
-} // namespace TextAbstraction
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_TEXT_ABSTRACTION_HYPHENATION_IMPL_H
-#define DALI_INTERNAL_TEXT_ABSTRACTION_HYPHENATION_IMPL_H
-
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-object.h>
-
-// INTERNAL INCLUDES
-#include <dali/devel-api/text-abstraction/hyphenation.h>
-#include <dali/public-api/common/dali-vector.h>
-
-namespace Dali
-{
-namespace TextAbstraction
-{
-namespace Internal
-{
-/**
- * Implementation of the Hyphenation
- */
-class Hyphenation : public BaseObject
-{
-public:
- /**
- * Constructor
- */
- Hyphenation();
-
- /**
- * Destructor
- */
- ~Hyphenation();
-
- /**
- * @copydoc Dali::Hyphenation::Get()
- */
- static TextAbstraction::Hyphenation Get();
-
- /**
- * @copydoc Dali::Hyphenation::GetDictionaryEncoding()
- */
- const char* GetDictionaryEncoding(const char* lang);
-
- /**
- * @copydoc Dali::Hyphenation::GetWordHyphens()
- */
- Vector<bool> GetWordHyphens(const char* word,
- Length wordLength,
- const char* lang);
-
-private:
- /**
- * Helper for lazy initialization.
- */
- void CreatePlugin();
-
-private:
- // Undefined copy constructor.
- Hyphenation(const Hyphenation&);
-
- // Undefined assignment constructor.
- Hyphenation& operator=(const Hyphenation&);
-
- struct HyphenDictionary;
- struct Plugin;
- std::unique_ptr<Plugin> mPlugin;
-
-}; // class Hyphenation
-
-} // namespace Internal
-
-} // namespace TextAbstraction
-
-inline static TextAbstraction::Internal::Hyphenation& GetImplementation(TextAbstraction::Hyphenation& hyphenation)
-{
- DALI_ASSERT_ALWAYS(hyphenation && "hyphenation handle is empty");
- BaseObject& handle = hyphenation.GetBaseObject();
- return static_cast<TextAbstraction::Internal::Hyphenation&>(handle);
-}
-
-inline static const TextAbstraction::Internal::Hyphenation& GetImplementation(const TextAbstraction::Hyphenation& hyphenation)
-{
- DALI_ASSERT_ALWAYS(hyphenation && "hyphenation handle is empty");
- const BaseObject& handle = hyphenation.GetBaseObject();
- return static_cast<const TextAbstraction::Internal::Hyphenation&>(handle);
-}
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_TEXT_ABSTRACTION_HYPHENATION_IMPL_H
BuildRequires: pkgconfig(egl)
BuildRequires: libcurl-devel
BuildRequires: pkgconfig(harfbuzz)
-BuildRequires: hyphen-devel
BuildRequires: fribidi-devel
BuildRequires: pkgconfig(capi-system-info)