2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
20 * @brief This is the header file for _IFont class.
24 #ifndef _FGRP_INTERNAL_IFONT_H_
25 #define _FGRP_INTERNAL_IFONT_H_
30 #include <FBaseColHashMapT.h>
32 #include "util/FGrp_UtilType.h"
35 namespace Tizen { namespace Graphics
38 class _FontRsrcManager;
43 //! Enumerated definition of the font style.
46 STYLE_NONE = 0, //!< Basic style.
47 STYLE_ITALIC = 1, //!< Italic style.
48 STYLE_BOLD = 2, //!< Bold style.
49 STYLE_UNDERLINE = 4, //!< Underline style.
50 STYLE_BACKSLANT = 8 //!< Reverse italic style.
53 //! Enumerated definition of the font quality.
56 QUALITY_MONO = 0, //!< Glyph of 1-bit form.
57 QUALITY_LOW = 1, //!< Low quality of 8-bit form.
58 QUALITY_MEDIUM = 2, //!< Medium quality of 8-bit form.
59 QUALITY_HIGH = 3 //!< High quality of 8-bit form.
62 //! Enumerated definition of the font capabilities.
65 CAPS_SCALABLE = 0x0001, //!< Support of the scalable font.
66 CAPS_ANGLE = 0x0002, //!< Support of the angle.
67 CAPS_X_EXPANSION = 0x0004, //!< Support of the expansion of the font.
68 CAPS_BOLDWEIGHT = 0x0008, //!< Support of the bold weight of the font.
69 CAPS_QUALITY_MONO = 0x0010, //!< Support of the white & black font.
70 CAPS_QUALITY_LOW = 0x0020, //!< Support of the low quality in the gray map font.
71 CAPS_QUALITY_MEDIUM = 0x0040, //!< Support of the medium quality in the gray map font.
72 CAPS_QUALITY_HIGH = 0x0080 //!< Support of the high quality in the gray map font.
78 long size; //!< Size of the font. (26.6 fixed point unit)
79 unsigned int style; //!< Style of the font. (_IFont::Style)
80 int quality; //!< Quality of the font. (_IFont::Quality)
81 float angle; //!< Angle of the font.
82 long xExpansion; //!< Expansion of the font.
83 long boldWeight; //!< Bold weight of the font
86 //! GlyphBitmap structure
89 long width; //!< Horizontal size of an image buffer.
90 long height; //!< Vertical size of an image buffer.
91 long bytesPerLine; //!< The number of bytes to represent one horizontal line in buffer.
92 unsigned long depth; //!< The number of bits to compose one pixel.
93 unsigned char* pBitmap; //!< Start address of an image buffer.
99 unsigned long id; //!< Internal identifier of the font.
100 long xOffset; //!< Starting point of displaying the font.
101 long yOffset; //!< Starting point of displaying the font.
102 long xAdvance; //!< Distance to move for displaying the next font.
103 long yAdvance; //!< Distance to move for displaying the next font.
105 GlyphBitmap image; //!< Image information of a glyph.
106 void* ptrAux; //!< Internal data for each target.
109 //! Property structure
112 int fontCaps; //!< Flag for the font capability. (_IFont::Capability)
113 int styleCaps; //!< Flag for the font style capability. (_IFont::Style)
114 unsigned long minSize; //!< Minimal size of the supportable font.
115 unsigned long maxSize; //!< Maximal size of the supportable font.
117 const char* pEngineName; //!< Name of the font engine.
118 const char* pFamilyName; //!< Name of the font family.
119 const char* pStyleName; //!< Name of the font style.
120 long maxWidth; //!< Maximal width of this font data.
121 long maxHeight; //!< Maximal height of this font data.
122 long baseLine; //!< BaseLine of this font data.
123 long ascender; //!< Ascender of this font data.
124 long descender; //!< Descender of this font data.
125 long leading; //!< Leading of this font data.
128 virtual ~_IFont(void) {}
130 typedef std::tr1::shared_ptr<_IFont> SharedFontResource;
132 //! Changes the attribute using fontAttrib.
133 virtual bool SetAttrib(const Attrib& fontAttrib) = 0;
134 //! Gets current attribute and store it in fontAttrib.
135 virtual bool GetAttrib(Attrib& fontAttrib) const = 0;
137 //! Gets the value of the interval correctness between two characters.
138 virtual bool GetKerning(unsigned long ch1, unsigned long ch2, long& xVector, long& yVector) const = 0;
140 //! Loads the font glyph data for displaying font.
141 virtual bool LoadGlyph(unsigned long character, Glyph** pFontGlyphData) = 0;
142 //! Releases the resource of the font glyph data that is not needed any more.
143 virtual bool UnloadGlyph(Glyph** pFontGlyphData) = 0;
144 //! Check if specified glyph is included.
145 virtual unsigned long CheckGlyph(unsigned long character) = 0;
147 //! Gets the support range and the property for this font engine.
148 virtual bool GetFontProperty(Property& property) const = 0;
151 virtual bool GetGlyphList(const _Util::String& text, Tizen::Base::Collection::IListT<Glyph *>& out, bool isRtl, int script) const = 0;
153 //! Gets the font fallback map.
154 virtual Tizen::Base::Collection::HashMapT<Tizen::Base::String, SharedFontResource>* GetFallbackMap(void) = 0;
157 //! Initializes a font instance with the font data on the memory buffer.
158 virtual bool Create(const void* pBuffer, long bufSize, long face = 0) = 0;
159 //! Initializes a font instance with the font file.
160 virtual bool Create(const char* pFilePath, long face = 0) = 0;
161 //! Initializes a font instance with the font data on the static memory buffer.
162 virtual bool CreateStatic(const void* pBuffer, long bufSize, long face = 0) = 0;
163 //! Reloads a font instance with the font data on the memory buffer.
164 virtual bool Reload(const void* pBuffer, long bufSize, long face = 0) = 0;
165 //! Reloads a font instance with the font file
166 virtual bool Reload(const char* filePath, long face = 0) = 0;
167 //! Destroys the instance.
168 virtual void Destroy(void) = 0;
169 //! Finds glyph in the cache
170 virtual bool FindCache(unsigned long character, int size, int style, Glyph** pOut) = 0;
171 //! Adds glyph in the cache
172 virtual bool AddCache(unsigned long character, int size, int style, Glyph* pGlyph) = 0;
174 virtual bool CleanCache(void) = 0;
177 friend class _FontRsrcManager;
182 std::auto_ptr<_IFont> first;
183 //std::auto_ptr<_FontCache> second;
186 }} // Tizen::Graphics
188 #endif // _FGRP_INTERNAL_IFONT_H_