Make GlyphBufferData as another class
[platform/core/uifw/dali-adaptor.git] / dali / internal / text / text-abstraction / shaping-impl.h
1 #ifndef DALI_INTERNAL_TEXT_ABSTRACTION_SHAPING_IMPL_H
2 #define DALI_INTERNAL_TEXT_ABSTRACTION_SHAPING_IMPL_H
3
4 /*
5  * Copyright (c) 2021 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 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/text-abstraction/shaping.h>
26 #include <dali/public-api/common/dali-vector.h>
27
28 namespace Dali
29 {
30 namespace TextAbstraction
31 {
32 namespace Internal
33 {
34 /**
35  * Implementation of the Shaping
36  */
37 class Shaping : public BaseObject
38 {
39 public:
40   /**
41    * Constructor
42    */
43   Shaping();
44
45   /**
46    * Destructor
47    */
48   ~Shaping();
49
50   /**
51    * @copydoc Dali::Shaping::Get()
52    */
53   static TextAbstraction::Shaping Get();
54
55   /**
56    * @copydoc Dali::Shaping::Shape()
57    */
58   Length Shape(const Character* const text,
59                Length                 numberOfCharacters,
60                FontId                 fontId,
61                Script                 script);
62
63   /**
64    * @copydoc Dali::Shaping::GetGlyphs()
65    */
66   void GetGlyphs(GlyphInfo*      glyphInfo,
67                  CharacterIndex* glyphToCharacterMap);
68
69 private:
70   /**
71    * Helper for lazy initialization.
72    */
73   void CreatePlugin();
74
75 private:
76   // Undefined copy constructor.
77   Shaping(const Shaping&);
78
79   // Undefined assignment constructor.
80   Shaping& operator=(const Shaping&);
81
82   struct Plugin;
83   Plugin* mPlugin;
84
85 }; // class Shaping
86
87 } // namespace Internal
88
89 } // namespace TextAbstraction
90
91 inline static TextAbstraction::Internal::Shaping& GetImplementation(TextAbstraction::Shaping& shaping)
92 {
93   DALI_ASSERT_ALWAYS(shaping && "shaping handle is empty");
94   BaseObject& handle = shaping.GetBaseObject();
95   return static_cast<TextAbstraction::Internal::Shaping&>(handle);
96 }
97
98 inline static const TextAbstraction::Internal::Shaping& GetImplementation(const TextAbstraction::Shaping& shaping)
99 {
100   DALI_ASSERT_ALWAYS(shaping && "shaping handle is empty");
101   const BaseObject& handle = shaping.GetBaseObject();
102   return static_cast<const TextAbstraction::Internal::Shaping&>(handle);
103 }
104
105 } // namespace Dali
106
107 #endif // DALI_INTERNAL_TEXT_ABSTRACTION_SHAPING_IMPL_H