Tizen 2.1 base
[framework/osp/uifw.git] / src / graphics / FGrp_FontFt2.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /*
19  * @file        FGrp_FontFt2.h
20  * @brief       This is the header file for FGrp_FontFt2 class.
21  *
22  */
23
24 #ifndef _FGRP_INTERNAL_FONT_FT2_H_
25 #define _FGRP_INTERNAL_FONT_FT2_H_
26
27 #include "FGrp_IFont.h"
28
29
30 namespace Tizen { namespace Graphics
31 {
32
33 class _FontCache;
34
35 class _FontFt2
36         : public _IFont
37 {
38 public:
39         _FontFt2();
40         virtual ~_FontFt2();
41
42         virtual bool SetAttrib(const Attrib& fontAttrib);
43         virtual bool GetAttrib(Attrib& fontAttrib) const;
44
45         virtual bool GetKerning(unsigned long character1, unsigned long character2, long& xVector, long& yVector) const;
46
47         virtual bool LoadGlyph(unsigned long character, Glyph** ppFontGlyphData);
48         virtual bool UnloadGlyph(Glyph** ppFontGlyphData);
49         virtual unsigned long CheckGlyph(unsigned long character);
50
51         virtual bool GetFontProperty(Property& property) const;
52
53         virtual bool GetGlyphList(const _Util::String& text, Tizen::Base::Collection::IListT<_IFont::Glyph *>& out, bool isRtl, int script) const;
54
55         virtual Tizen::Base::Collection::HashMapT<Tizen::Base::String, _IFont::SharedFontResource>* GetFallbackMap(void);
56
57 protected:
58         virtual bool Create(const void* pBuffer, long bufSize, long face = 0);
59         virtual bool Create(const char* pFilePath, long face = 0);
60         virtual bool CreateStatic(const void* pBuffer, long bufSize, long face = 0);
61         virtual bool Reload(const void* pBuffer, long bufSize, long face = 0);
62         virtual bool Reload(const char* filePath, long face = 0);
63         virtual void Destroy(void);
64         virtual bool FindCache(unsigned long character, int size, int style, Glyph** pOut);
65         virtual bool AddCache(unsigned long character, int size, int style, Glyph* pGlyph);
66         virtual bool CleanCache(void);
67
68 private:
69         _FontFt2(const _FontFt2& font);
70         _FontFt2& operator =(const _FontFt2& rhs);
71
72         // cleaning up
73         void __CleanUp();
74
75         // return internal index for wide character
76         unsigned long __GetCharIndex(unsigned long character) const;
77
78         // convert the glyph of FreeType2 to _IFont::Glyph information
79         bool __ConvertPrivateToImage(void* pData1, _IFont::Glyph** ppFontGlyphData);
80
81         // set translate matrix
82         bool __SetTransMatrix(void* pMatrix);
83
84 private:
85         bool __isValid;
86         bool __isLoadGlyph;
87         _IFont::Attrib __fontAttrib;
88         void* __pFontEngine;
89         void* __pFontFace;
90         void* __pFontBuffer;
91         bool __isStaticBuffer;
92
93         //_FontCache fontCache;
94         std::auto_ptr<_FontCache> __fontCache;
95         // fallback font resources
96         Tizen::Base::Collection::HashMapT<Tizen::Base::String, _IFont::SharedFontResource> __fallbackFontMap;
97
98 }; // _FontFt2
99
100 }} // Tizen::Graphics
101
102 #endif // _FGRP_INTERNAL_FONT_FT2_H_