$(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect.cpp \
$(public_api_base_src_dir)/controls/table-view/table-view.cpp \
$(public_api_base_src_dir)/controls/text-controls/text-label.cpp \
+ $(public_api_base_src_dir)/text/bidirectional-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)/controls/text-controls/text-label.h
public_api_base_text_header_files = \
+ $(public_api_base_src_dir)/text/bidirectional-support.h \
$(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/font-run.h \
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_LINE_INFO_RUN_H__
+#define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_LINE_INFO_RUN_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/character-run.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief BidirectionalLineInfoRun
+ */
+struct BidirectionalLineInfoRun
+{
+ CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
+ CharacterIndex* visualToLogicalMap; ///< Pointer to the visual to logical map table.
+ CharacterIndex* logicalToVisualMap; ///< Pointer to the logical to visual map table.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_LINE_INFO_RUN_H__
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_PARAGRAPH_INFO_RUN_H__
+#define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_PARAGRAPH_INFO_RUN_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/character-run.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief BidirectionalParagraphInfoRun
+ *
+ * In terms of the bidirectional algorithm, a 'paragraph' is understood as a run of characters between Paragraph Separators or appropriate Newline Functions.
+ * A 'paragraph' may also be determined by higher-level protocols like a mark-up tag.
+ */
+struct BidirectionalParagraphInfoRun
+{
+ CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
+ BidiInfoIndex bidirectionalInfoIndex; ///< Index to the table with the bidirectional info per paragraph.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_PARAGRAPH_INFO_RUN_H__
--- /dev/null
+/*
+ * 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/bidirectional-support.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+void SetBidirectionalInfo( LogicalModel& model )
+{
+}
+
+void ReorderLines( LogicalModel& logicalModel,
+ const VisualModel& visualModel )
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__
+#define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_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>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class LogicalModel;
+class VisualModel;
+
+/**
+ * Sets the bidirectional info into the logical model.
+ *
+ * Any bidirectional info previously set is removed.
+ *
+ * @pre The @p model needs to have a text set.
+ * @pre The @p model needs to have the line break info set.
+ *
+ * @param[in,out] model The text's logical model.
+ */
+void SetBidirectionalInfo( LogicalModel& model );
+
+/**
+ * Sets the visual to logical and logical to visual map tables.
+ *
+ * Any map tables previously set are removed.
+ *
+ * @pre The @p logicalModel needs to have a text set.
+ * @pre The @p logicalModel needs to have the line break info set.
+ * @pre The @p visualModel needs to have the laid-out lines info set.
+ *
+ * @param[in,out] logicalModel The text's logical model.
+ * @param[in] visualModel The text's visual model.
+ */
+void ReorderLines( LogicalModel& logicalModel,
+ const VisualModel& visualModel );
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__
return 0;
}
+void LogicalModel::SetBidirectionalInfo( const BidirectionalParagraphInfoRun* const bidirectionalInfo,
+ Length numberOfRuns )
+{
+}
+
+Length LogicalModel::GetNumberOfBidirectionalInfoRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+ return 0u;
+}
+
+void LogicalModel::GetCharacterDirections( CharacterDirection* directions,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+}
+
+CharacterDirection LogicalModel::GetCharacterDirection( CharacterIndex characterIndex ) const
+{
+ return false;
+}
+
+void LogicalModel::SetVisualToLogicalMap( const BidirectionalLineInfoRun* const bidirectionalInfo,
+ Length numberOfRuns )
+{
+}
+
+CharacterIndex LogicalModel::GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const
+{
+ return 0u;
+}
+
+CharacterIndex LogicalModel::GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const
+{
+ return 0u;
+}
+
+void LogicalModel::GetLogicalToVisualMap( CharacterIndex* logicalToVisualMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+}
+
+void LogicalModel::GetVisualToLogicalMap( CharacterIndex* visualToLogicalMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const
+{
+}
+
LogicalModel::~LogicalModel()
{
delete mImpl;
namespace Text
{
+struct BidirectionalLineInfoRun;
+struct BidirectionalParagraphInfoRun;
struct FontRun;
class LogicalModel;
typedef IntrusivePtr<LogicalModel> LogicalModelPtr;
*/
WordBreakInfo GetWordBreakInfo( CharacterIndex characterIndex ) const;
+ // Bidirectional support interface.
+
+ /**
+ * Sets the bidirectional info runs.
+ *
+ * Replaces any bidirectional info previously set.
+ *
+ * Each bidirectional info run stores bidirectional info for a whole 'paragraph' of text which contains right to left scripts.
+
+ * In terms of the bidirectional algorithm, a 'paragraph' is understood as a run of characters between Paragraph Separators or appropriate Newline Functions.
+ * A 'paragraph' may also be determined by higher-level protocols like a mark-up tag.
+ *
+ * @param[in] bidirectionalInfo Pointer to a buffer with all the bidirectional info runs.
+ * @param[in] numberOfRuns The number of bidirectional info runs.
+ */
+ void SetBidirectionalInfo( const BidirectionalParagraphInfoRun* const bidirectionalInfo,
+ Length numberOfRuns );
+
+ /**
+ * Retrieves the number of bidirectional info runs for the given range of characters.
+ *
+ * It may be zero if there is no right to left scripts.
+ *
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ *
+ * @return The number of bidirectional info runs.
+ */
+ Length GetNumberOfBidirectionalInfoRuns( CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the direction of the characters.
+ *
+ * It sets @c true for right to left characters and @c false for left to right.
+ * For neutral characters it check's the next and previous character's directions:
+ * - If they are equals set that direction. If they are not, sets the paragraph's direction.
+ * - If there is no next, sets the paragraph's direction.
+ *
+ * See SetBidirectionalInfo() to get an explanation of the 'paragraph' meaning in the bidirectional algorithm.
+ *
+ * @param[out] directions Whether the characters are right to left or left to right.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetCharacterDirections( CharacterDirection* directions,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the direction of a characters.
+ *
+ * See GetCharacterDirections().
+ *
+ * @param[in] characterIndex Index to a character.
+ *
+ * @return The character's direction.
+ */
+ CharacterDirection GetCharacterDirection( CharacterIndex characterIndex ) const;
+
+ // Visual <--> Logical conversion tables.
+
+ /**
+ * Sets the visual to logical and the logical to visual map tables.
+ *
+ * Replaces any map tables previously set.
+ *
+ * @param[in] bidirectionalInfo Pointer to a buffer with all the bidirectional info runs.
+ * @param[in] numberOfRuns The number of bidirectional info runs.
+ */
+ void SetVisualToLogicalMap( const BidirectionalLineInfoRun* const bidirectionalInfo,
+ Length numberOfRuns );
+
+ /**
+ * Retrieves the visual character index for the given logical character index.
+ *
+ * @param[in] logicalCharacterIndex The logical character index.
+ *
+ * @return The visual character index.
+ */
+ CharacterIndex GetVisualCharacterIndex( CharacterIndex logicalCharacterIndex ) const;
+
+ /**
+ * Retrieves the logical character index for the given visual character index.
+ *
+ * @param[in] visualCharacterIndex The visual character index.
+ *
+ * @return The logical character index.
+ */
+ CharacterIndex GetLogicalCharacterIndex( CharacterIndex visualCharacterIndex ) const;
+
+ /**
+ * Retrieves the whole or part of the logical to visual conversion map.
+ *
+ * The size of the buffer needs to be big enough to copy the @p numberOfCharacters.
+ *
+ * @param[out] logicalToVisualMap Pointer to a buffer where the conversion map is copied.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetLogicalToVisualMap( CharacterIndex* logicalToVisualMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
+
+ /**
+ * Retrieves the whole or part of the visual to logical conversion map.
+ *
+ * The size of the buffer needs to be big enough to copy the @p numberOfCharacters.
+ *
+ * @param[out] visualToLogicalMap Pointer to a buffer where the conversion map is copied.
+ * @param[in] characterIndex Index to the first character.
+ * @param[in] numberOfCharacters The number of characters.
+ */
+ void GetVisualToLogicalMap( CharacterIndex* visualToLogicalMap,
+ CharacterIndex characterIndex,
+ Length numberOfCharacters ) const;
protected:
/**
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 TextAbstraction::LineBreakInfo LineBreakInfo; ///< Line break info (must break, allow break, no break). Possible values are: @e LINE_MUST_BREAK, @e LINE_ALLOW_BREAK and @e LINE_NO_BREAK (in the TextAbstraction namespace).
+typedef TextAbstraction::WordBreakInfo WordBreakInfo; ///< Word break info (break, no break). Possible values are: @e WORD_BREAK and @e 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
+typedef bool CharacterDirection; ///< The character's direction: @e false is left to right, @e true is right to left.
} // namespace Text