Revert "[Tizen] Support custom fonts registration"
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / text-abstraction / bidirectional-support.h
1 #ifndef __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__
2 #define __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/object/base-handle.h>
26
27 // INTERNAL INCLUDES
28 #include <dali/public-api/dali-adaptor-common.h>
29
30 namespace Dali
31 {
32
33 namespace TextAbstraction
34 {
35
36 namespace Internal DALI_INTERNAL
37 {
38
39 class BidirectionalSupport;
40
41 } // Internal
42
43 /**
44  * BidirectionalSupport API
45  *
46  */
47 class DALI_ADAPTOR_API BidirectionalSupport : public BaseHandle
48 {
49
50 public:
51
52   /**
53    * @brief Create an uninitialized TextAbstraction handle.
54    *
55    */
56   BidirectionalSupport();
57
58   /**
59    * @brief Destructor
60    *
61    * This is non-virtual since derived Handle types must not contain data or virtual methods.
62    */
63   ~BidirectionalSupport();
64
65   /**
66    * @brief This constructor is used by BidirectionalSupport::Get().
67    *
68    * @param[in] implementation a pointer to the internal bidirectional support object.
69    */
70   explicit DALI_INTERNAL BidirectionalSupport( Internal::BidirectionalSupport* implementation );
71
72   /**
73    * @brief Retrieve a handle to the BidirectionalSupport instance.
74    *
75    * @return A handle to the BidirectionalSupport
76    */
77   static BidirectionalSupport Get();
78
79   /**
80    * @brief Creates bidirectional data for the whole paragraph.
81    *
82    * @param[in] paragraph Pointer to the first character of the paragraph coded in UTF32.
83    * @param[in] numberOfCharacters The number of characters of the paragraph.
84    *
85    * @return An index of an object inside a table storing the bidirectional data.
86    */
87   BidiInfoIndex CreateInfo( const Character* const paragraph,
88                             Length numberOfCharacters );
89
90   /**
91    * @brief Destroys the bidirectional data.
92    *
93    * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
94    */
95   void DestroyInfo( BidiInfoIndex bidiInfoIndex );
96
97   /**
98    * @brief Reorders a line of a paragraph.
99    *
100    * @pre visualToLogicalMap must have enough space allocated for @p numberOfCharacters.
101    *
102    * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
103    * @param[in] firstCharacterIndex The first character of the line within the whole paragraph.
104    * @param[in] numberOfCharacters The number of characters of the line.
105    * @param[out] visualToLogicalMap The visual to logical conversion map.
106    */
107   void Reorder( BidiInfoIndex bidiInfoIndex,
108                 CharacterIndex firstCharacterIndex,
109                 Length numberOfCharacters,
110                 CharacterIndex* visualToLogicalMap );
111
112   /**
113    * @brief Replaces any character which could be mirrored.
114    *
115    * @param[in,out] text The text.
116    * @param[in] directions The direction of each paragraph.
117    * @param[in] numberOfCharacters The number of characters.
118    *
119    * @return @e true if a character has been replaced.
120    */
121   bool GetMirroredText( Character* text,
122                         CharacterDirection* directions,
123                         Length numberOfCharacters );
124
125   /**
126    * @brief Retrieves the paragrpah's direction.
127    *
128    * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
129    *
130    * @return @e true if the paragraph is right to left, otherwise @e false.
131    */
132   bool GetParagraphDirection( BidiInfoIndex bidiInfoIndex ) const;
133
134   /**
135    * @brief Retrieves the character's directions.
136    *
137    * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
138    * @param[out] directions The direction, @e false is left to right and @e true is right to left, of each character of the paragraph.
139    * @param[in] numberOfCharacters The number of characters.
140    */
141   void GetCharactersDirection( BidiInfoIndex bidiInfoIndex,
142                                CharacterDirection* directions,
143                                Length numberOfCharacters );
144 };
145
146 } // namespace TextAbstraction
147
148 } // namespace Dali
149
150 #endif // __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__