Multi-language support interface added. 60/34760/5
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 2 Feb 2015 12:25:20 +0000 (12:25 +0000)
committerVictor Cebollada <v.cebollada@samsung.com>
Fri, 6 Feb 2015 14:32:52 +0000 (14:32 +0000)
Change-Id: I25501a88737fe1bfbc221266a27c6ae43a0774c3
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
base/dali-toolkit/public-api/file.list
base/dali-toolkit/public-api/text/multi-language-support.cpp [new file with mode: 0644]
base/dali-toolkit/public-api/text/multi-language-support.h [new file with mode: 0644]
base/dali-toolkit/public-api/text/script.cpp [new file with mode: 0644]
base/dali-toolkit/public-api/text/script.h [new file with mode: 0644]
base/dali-toolkit/public-api/text/text-definitions.h

index 93780bc..bcb0e2f 100755 (executable)
@@ -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 (file)
index 0000000..a017d12
--- /dev/null
@@ -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 <dali-toolkit/public-api/text/multi-language-support.h>
+
+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 (file)
index 0000000..a1e4c99
--- /dev/null
@@ -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 <dali-toolkit/public-api/text/text-definitions.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+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 (file)
index 0000000..a001f94
--- /dev/null
@@ -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 <dali-toolkit/public-api/text/script.h>
+
+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 (file)
index 0000000..7236778
--- /dev/null
@@ -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 <dali-toolkit/public-api/text/text-definitions.h>
+
+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__
index d129c08..47bfd9c 100644 (file)
@@ -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