Text segmentation interface added. 56/34756/6
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 2 Feb 2015 12:10:34 +0000 (12:10 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Thu, 12 Feb 2015 11:23:15 +0000 (11:23 +0000)
Change-Id: I4053be3ea15a685278f28929d273ccc6a45e54ee
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
base/dali-toolkit/public-api/file.list
base/dali-toolkit/public-api/text/logical-model.cpp
base/dali-toolkit/public-api/text/logical-model.h
base/dali-toolkit/public-api/text/segmentation.cpp [new file with mode: 0644]
base/dali-toolkit/public-api/text/segmentation.h [new file with mode: 0644]
base/dali-toolkit/public-api/text/text-definitions.h
optional/dali-toolkit/dali-toolkit.h

index b2c438d..0c43428 100755 (executable)
@@ -41,6 +41,7 @@ public_api_base_src_files = \
   $(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/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/segmentation.cpp \
   $(public_api_base_src_dir)/text/text-controller.cpp \
   $(public_api_base_src_dir)/text/text-view.cpp \
   $(public_api_base_src_dir)/text/text-view-interface.cpp \
   $(public_api_base_src_dir)/text/text-controller.cpp \
   $(public_api_base_src_dir)/text/text-view.cpp \
   $(public_api_base_src_dir)/text/text-view-interface.cpp \
@@ -123,9 +124,13 @@ public_api_base_text_controls_header_files = \
   $(public_api_base_src_dir)/controls/text-controls/text-label.h
 
 public_api_base_text_header_files = \
   $(public_api_base_src_dir)/controls/text-controls/text-label.h
 
 public_api_base_text_header_files = \
+  $(public_api_base_src_dir)/text/character-run.h \
   $(public_api_base_src_dir)/text/character-set-conversion.h \
   $(public_api_base_src_dir)/text/character-set-conversion.h \
+  $(public_api_base_src_dir)/text/font-run.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/logical-model.h \
   $(public_api_base_src_dir)/text/multi-language-support.h \
+  $(public_api_base_src_dir)/text/script.h \
+  $(public_api_base_src_dir)/text/segmentation.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-view.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-view.h \
index 4547f99..6d7694a 100644 (file)
@@ -233,6 +233,38 @@ FontId LogicalModel::GetFont( CharacterIndex characterIndex ) const
   return 0u;
 }
 
   return 0u;
 }
 
+void LogicalModel::SetLineBreakInfo( const LineBreakInfo* const lineBreakInfo,
+                                     Length length )
+{
+}
+
+void LogicalModel::GetLineBreakInfo( LineBreakInfo* lineBreakInfo,
+                                     CharacterIndex characterIndex,
+                                     Length numberOfItems ) const
+{
+}
+
+LineBreakInfo LogicalModel::GetLineBreakInfo( CharacterIndex characterIndex ) const
+{
+  return 0;
+}
+
+void LogicalModel::SetWordBreakInfo( const WordBreakInfo* const wordBreakInfo,
+                                     Length length )
+{
+}
+
+void LogicalModel::GetWordBreakInfo( WordBreakInfo* wordBreakInfo,
+                                     CharacterIndex characterIndex,
+                                     Length numberOfItems ) const
+{
+}
+
+WordBreakInfo LogicalModel::GetWordBreakInfo( CharacterIndex characterIndex ) const
+{
+  return 0;
+}
+
 LogicalModel::~LogicalModel()
 {
   delete mImpl;
 LogicalModel::~LogicalModel()
 {
   delete mImpl;
index d8f6617..2d8a66a 100644 (file)
@@ -185,6 +185,98 @@ public:
    */
   FontId GetFont( CharacterIndex characterIndex ) const;
 
    */
   FontId GetFont( CharacterIndex characterIndex ) const;
 
+  // Break info interface.
+
+  /**
+   * Sets the line break info.
+   *
+   * See GetLineBreakInfo() to get how the line break info is encoded.
+   *
+   * Replaces any line break info previously set.
+   *
+   * @param[in] lineBreakInfo Pointer to a buffer with the line break info.
+   * @param[in] length The size of the buffer.
+   */
+  void SetLineBreakInfo( const LineBreakInfo* const lineBreakInfo,
+                         Length length );
+
+  /**
+   * Retrieves the line break info in the given buffer.
+   *
+   * The size of the @p lineBreakInfo buffer needs to be big enough to copy the @p numberOfItems.
+   *
+   * Possible values for LineBreakInfo are:
+   *
+   *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
+   *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
+   *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
+   *
+     @verbatim
+     i.e. Hello big\nworld produces:
+          2222212220 22220
+     @endverbatim
+   *
+   * @param[out] lineBreakInfo Pointer to a buffer where the line break info is copied.
+   * @param[in] characterIndex Index to the first line break info item.
+   * @param[in] numberOfItems The number of items to be copied.
+   */
+  void GetLineBreakInfo( LineBreakInfo* lineBreakInfo,
+                         CharacterIndex characterIndex,
+                         Length numberOfItems ) const;
+
+  /**
+   * Retrieves the line break info for the given item index.
+   *
+   * @param[in] characterIndex Index to the line break info item.
+   */
+  LineBreakInfo GetLineBreakInfo( CharacterIndex characterIndex ) const;
+
+  /**
+   * Sets the word break info.
+   *
+   * See GetWordBreakInfo() to get how the word break info is encoded.
+   *
+   * Replaces any word break info previously set.
+   *
+   * @param[in] wordBreakInfo Pointer to a buffer with the word break info.
+   * @param[in] length The size of the buffer.
+   */
+  void SetWordBreakInfo( const WordBreakInfo* const wordBreakInfo,
+                         Length length );
+
+  /**
+   * Retrieves the word break info in the given buffer.
+   *
+   * The size of the @p wordBreakInfo buffer needs to be big enough to copy the @p numberOfItems.
+   *
+   * The size of the buffer has to be big enough to store the whole word break info per character.
+   * Call GetNumberOfCharacters() to get the number of characters.
+   *
+   * Possible values for WordBreakInfo are:
+   *
+   * - 0 is a WORD_BREAK.    Text can be broken into a new word.
+   * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
+   *
+     @verbatim
+     i.e. Hello big\nworld produces:
+          1111001100 11110
+     @endverbatim
+   *
+   * @param[out] wordBreakInfo Pointer to a buffer where the word break info is copied.
+   * @param[in] characterIndex Index to the first word break info item.
+   * @param[in] numberOfItems The number of items to be copied.
+   */
+  void GetWordBreakInfo( WordBreakInfo* wordBreakInfo,
+                         CharacterIndex characterIndex,
+                         Length numberOfItems ) const;
+
+  /**
+   * Retrieves the word break info for the given item index.
+   *
+   * @param[in] characterIndex Index to the word break info item.
+   */
+  WordBreakInfo GetWordBreakInfo( CharacterIndex characterIndex ) const;
+
 protected:
 
   /**
 protected:
 
   /**
diff --git a/base/dali-toolkit/public-api/text/segmentation.cpp b/base/dali-toolkit/public-api/text/segmentation.cpp
new file mode 100644 (file)
index 0000000..88455d2
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/public-api/text/segmentation.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+void SetLineBreakInfo( LogicalModel& model )
+{
+}
+
+void SetWordBreakInfo( LogicalModel& model )
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/base/dali-toolkit/public-api/text/segmentation.h b/base/dali-toolkit/public-api/text/segmentation.h
new file mode 100644 (file)
index 0000000..85198c5
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef __DALI_TOOLKIT_TEXT_SEGMENTATION_H__
+#define __DALI_TOOLKIT_TEXT_SEGMENTATION_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
+{
+
+class LogicalModel;
+
+/**
+ * Sets line break info.
+ *
+ * Any line break 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 SetLineBreakInfo( LogicalModel& model );
+
+/**
+ * Sets word break info.
+ *
+ * Any word break 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 SetWordBreakInfo( LogicalModel& model );
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_SEGMENTATION_H__
index 47bfd9c..0ec2554 100644 (file)
@@ -41,6 +41,8 @@ typedef TextAbstraction::CharacterIndex  CharacterIndex;  ///< An index into an
 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 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 TextAbstraction::LineBreakInfo   LineBreakInfo;   ///< Line break info (must break, allow break, no break). Possible values are: LINE_MUST_BREAK, LINE_ALLOW_BREAK and LINE_NO_BREAK (in the TextAbstraction namespace).
+typedef TextAbstraction::WordBreakInfo   WordBreakInfo;   ///< Word break info (break, no break). Possible values are: WORD_BREAK and WORD_NO_BREAK (in the TextAbstraction namespace).
 
 typedef uint32_t GlyphIndex;     ///< An index into an array of glyphs
 
 
 typedef uint32_t GlyphIndex;     ///< An index into an array of glyphs
 
index fa4837a..09a9421 100644 (file)
 #include <dali-toolkit/public-api/shader-effects/ripple-effect.h>
 #include <dali-toolkit/public-api/shader-effects/ripple2d-effect.h>
 #include <dali-toolkit/public-api/shader-effects/swirl-effect.h>
 #include <dali-toolkit/public-api/shader-effects/ripple-effect.h>
 #include <dali-toolkit/public-api/shader-effects/ripple2d-effect.h>
 #include <dali-toolkit/public-api/shader-effects/swirl-effect.h>
+#include <dali-toolkit/public-api/text/character-run.h>
 #include <dali-toolkit/public-api/text/character-set-conversion.h>
 #include <dali-toolkit/public-api/text/character-set-conversion.h>
+#include <dali-toolkit/public-api/text/font-run.h>
 #include <dali-toolkit/public-api/text/logical-model.h>
 #include <dali-toolkit/public-api/text/logical-model.h>
+#include <dali-toolkit/public-api/text/segmentation.h>
+#include <dali-toolkit/public-api/text/multi-language-support.h>
+#include <dali-toolkit/public-api/text/script.h>
 #include <dali-toolkit/public-api/text/text-controller.h>
 #include <dali-toolkit/public-api/text/text-definitions.h>
 #include <dali-toolkit/public-api/text/text-view.h>
 #include <dali-toolkit/public-api/text/text-controller.h>
 #include <dali-toolkit/public-api/text/text-definitions.h>
 #include <dali-toolkit/public-api/text/text-view.h>