From fb517db6156d5dc6e35e548bfcbd65621c1cd546 Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Mon, 2 Feb 2015 12:25:20 +0000 Subject: [PATCH] Multi-language support interface added. Change-Id: I25501a88737fe1bfbc221266a27c6ae43a0774c3 Signed-off-by: Victor Cebollada --- base/dali-toolkit/public-api/file.list | 2 + .../public-api/text/multi-language-support.cpp | 59 +++++++++++ .../public-api/text/multi-language-support.h | 109 +++++++++++++++++++++ base/dali-toolkit/public-api/text/script.cpp | 39 ++++++++ base/dali-toolkit/public-api/text/script.h | 48 +++++++++ .../public-api/text/text-definitions.h | 1 + 6 files changed, 258 insertions(+) create mode 100644 base/dali-toolkit/public-api/text/multi-language-support.cpp create mode 100644 base/dali-toolkit/public-api/text/multi-language-support.h create mode 100644 base/dali-toolkit/public-api/text/script.cpp create mode 100644 base/dali-toolkit/public-api/text/script.h diff --git a/base/dali-toolkit/public-api/file.list b/base/dali-toolkit/public-api/file.list index 93780bc..bcb0e2f 100755 --- a/base/dali-toolkit/public-api/file.list +++ b/base/dali-toolkit/public-api/file.list @@ -42,6 +42,7 @@ public_api_base_src_files = \ $(public_api_base_src_dir)/controls/text-controls/text-label.cpp \ $(public_api_base_src_dir)/text/character-set-conversion.cpp \ $(public_api_base_src_dir)/text/logical-model.cpp \ + $(public_api_base_src_dir)/text/multi-language-support.cpp \ $(public_api_base_src_dir)/text/text-controller.cpp \ $(public_api_base_src_dir)/text/text-renderer.cpp \ $(public_api_base_src_dir)/text/text-view.cpp \ @@ -126,6 +127,7 @@ public_api_base_text_controls_header_files = \ public_api_base_text_header_files = \ $(public_api_base_src_dir)/text/character-set-conversion.h \ $(public_api_base_src_dir)/text/logical-model.h \ + $(public_api_base_src_dir)/text/multi-language-support.h \ $(public_api_base_src_dir)/text/text-controller.h \ $(public_api_base_src_dir)/text/text-definitions.h \ $(public_api_base_src_dir)/text/text-renderer.h \ diff --git a/base/dali-toolkit/public-api/text/multi-language-support.cpp b/base/dali-toolkit/public-api/text/multi-language-support.cpp new file mode 100644 index 0000000..a017d12 --- /dev/null +++ b/base/dali-toolkit/public-api/text/multi-language-support.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2015 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. + * + */ + +// FILE HEADER +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +MultilanguageSupport::MultilanguageSupport() +{ +} + +MultilanguageSupport::~MultilanguageSupport() +{ +} + +MultilanguageSupport::MultilanguageSupport( Internal::MultilanguageSupport* implementation ) +{ +} + +MultilanguageSupport MultilanguageSupport::Get() +{ + return MultilanguageSupport(); +} + +void MultilanguageSupport::SetScripts( LogicalModel& model ) +{ +} + +void MultilanguageSupport::ValidateFonts( LogicalModel& model ) +{ +} + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali diff --git a/base/dali-toolkit/public-api/text/multi-language-support.h b/base/dali-toolkit/public-api/text/multi-language-support.h new file mode 100644 index 0000000..a1e4c99 --- /dev/null +++ b/base/dali-toolkit/public-api/text/multi-language-support.h @@ -0,0 +1,109 @@ +#ifndef __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H__ +#define __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H__ + +/* + * Copyright (c) 2015 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 + +// EXTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +namespace Internal DALI_INTERNAL +{ + +class MultilanguageSupport; + +} // Internal + +class LogicalModel; + +/** + * @brief Sets the character's scripts to the model and validates the fonts set by the user or assigns default ones. + */ +class MultilanguageSupport : public BaseHandle +{ +public: + + /** + * @brief Create an uninitialized MultilanguageSupport handle. + */ + MultilanguageSupport(); + + /** + * @brief Destructor + * + * This is non-virtual since derived Handle types must not contain data or virtual methods. + */ + ~MultilanguageSupport(); + + /** + * @brief This constructor is used by MultilanguageSupport::Get(). + * + * @param[in] implementation A pointer to the internal multilanguage support object. + */ + explicit DALI_INTERNAL MultilanguageSupport( Internal::MultilanguageSupport* implementation ); + + /** + * @brief Retrieve a handle to the MultilanguageSupport instance. + * + * @return A handle to the MultilanguageSupport. + */ + static MultilanguageSupport Get(); + + /** + * @brief Sets the scripts of the whole text. + * + * Any script info previously set is removed. + * + * @pre The @p model needs to have a text set. + * + * @param[in,out] model The text's logical model. + */ + void SetScripts( LogicalModel& model ); + + /** + * @brief Validates the character's font of the whole text. + * + * It may update fonts set by the mark-up processor. + * It sets default fonts based on the script to those characters without a font set. + * + * @pre The @p model needs to have a text set. + * @pre The @p model needs to have the scripts set. + * + * @param[in,out] model The text's logical model. + */ + void ValidateFonts( LogicalModel& model ); +}; + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TEXT_MULTI_LANGUAGE_SUPPORT_H__ diff --git a/base/dali-toolkit/public-api/text/script.cpp b/base/dali-toolkit/public-api/text/script.cpp new file mode 100644 index 0000000..a001f94 --- /dev/null +++ b/base/dali-toolkit/public-api/text/script.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2015 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. + * + */ + +// FILE HEADER +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +Script GetCharacterScript( Character character ) +{ + return TextAbstraction::UNKNOWN; +} + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali diff --git a/base/dali-toolkit/public-api/text/script.h b/base/dali-toolkit/public-api/text/script.h new file mode 100644 index 0000000..7236778 --- /dev/null +++ b/base/dali-toolkit/public-api/text/script.h @@ -0,0 +1,48 @@ +#ifndef __DALI_TOOLKIT_TEXT_SCRIPT_H__ +#define __DALI_TOOLKIT_TEXT_SCRIPT_H__ + +/* + * Copyright (c) 2015 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 + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Text +{ + +/** + * @brief Retrieves a character's script. + * + * @param[in] character The character. + * + * @return The chraracter's script. + */ +Script GetCharacterScript( Character character ); + +} // namespace Text + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TEXT_SCRIPT_H__ diff --git a/base/dali-toolkit/public-api/text/text-definitions.h b/base/dali-toolkit/public-api/text/text-definitions.h index d129c08..47bfd9c 100644 --- a/base/dali-toolkit/public-api/text/text-definitions.h +++ b/base/dali-toolkit/public-api/text/text-definitions.h @@ -40,6 +40,7 @@ typedef TextAbstraction::GlyphInfo GlyphInfo; ///< The information d typedef TextAbstraction::CharacterIndex CharacterIndex; ///< An index into an array of characters typedef TextAbstraction::Length Length; ///< The length of an array typedef TextAbstraction::BidiInfoIndex BidiInfoIndex; ///< Index to the bidirectional info for a paragraph. +typedef TextAbstraction::Script Script; ///< The character's script. typedef uint32_t GlyphIndex; ///< An index into an array of glyphs -- 2.7.4