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.
19 * @file FGrp_FontImpl.h
20 * @brief This is the header file for the _FontImpl class.
22 * This header file contains the declarations of the %_FontImpl class.
26 #ifndef _FGRP_INTERNAL_FONT_IMPL_H_
27 #define _FGRP_INTERNAL_FONT_IMPL_H_
30 #include <FBaseObject.h>
31 #include <FBaseString.h>
33 namespace Tizen { namespace Base
39 namespace Tizen { namespace Base { namespace Collection
42 }}} // Tizen::Base::Collection
44 namespace Tizen { namespace Graphics
51 class _OSP_EXPORT_ _FontImpl
52 : public Tizen::Base::Object
56 virtual ~_FontImpl(void);
58 result Construct(int style, int size);
59 result Construct(const Tizen::Base::String& fontName, int style, int size, bool isPathEnabled = true);
60 result Construct(const Tizen::Base::ByteBuffer& fontData, int style, int size);
62 bool IsConstructed(void) const;
64 int GetMaxHeight(void) const;
65 int GetMaxWidth(void) const;
66 int GetAscender(void) const;
67 int GetDescender(void) const;
68 result GetLeftBear(wchar_t character, int& leftBear) const;
69 result GetRightBear(wchar_t character, int& rightBear) const;
70 result GetTextExtent(const Tizen::Base::String& text, int length, Dimension& dim) const;
71 bool IsBold(void) const;
72 bool IsItalic(void) const;
73 bool IsPlain(void) const;
74 bool IsStrikeOut(void) const;
75 bool IsUnderlined(void) const;
76 int GetSize(void) const;
77 void SetStrikeOut(bool strikeOut);
78 void SetUnderline(bool underline);
79 void SetCharSpace(int space);
80 int GetCharSpace(void) const;
81 Tizen::Base::String GetFaceName(void) const;
82 static Tizen::Base::Collection::IList* GetSystemFontListN(void);
83 static Tizen::Base::String GetFaceName(const Tizen::Base::String& filePath);
85 _FontImpl* CloneN(void);
86 static Font* CloneN(const Font& font);
89 * Gets the count and dimension of characters which can be get in the given width. @n
91 * @return An error code
92 * @param[in] width The width for calculating how many characters can be get in there
93 * The width must be greater than or equal to @c 0
94 * @param[in] text The string
95 * @param[in] startIndex The start index
96 * @param[in] length The length of @c text
97 * @param[in] outline The outline effect of @c text
98 * @param[out] count The count of characters
99 * @param[out] dim The width and height of the font of the @c text which get in given width
100 * @exception E_SUCCESS The method is successful.
101 * @exception E_INVALID_ARG The value of @c width is greater than or equal to @c 0.
102 * @exception E_OPERATION_FAILED This instance is in an invalid state.
103 * @exception E_SYSTEM The system error occurs.
105 result GetTextExtent(int width, const Tizen::Base::String& text, int startIndex, int length, bool outline, int& count, Dimension& dim) const;
108 * Gets the count and dimension of characters which can be get in the given width. @n
110 * @return An error code
111 * @param[in] width The width for calculating how many characters can be get in there
112 * The width must be greater than or equal to @c 0
113 * @param[in] text The string
114 * @param[in] startIndex The start index
115 * @param[in] length The length of @c text
116 * @param[in] outline The outline effect of @c text
117 * @param[in] delimiter The delimiter
118 * @param[out] count The count of characters
119 * @param[out] dim The width and height of the font of the @c text which get in given width
120 * @exception E_SUCCESS The method is successful.
121 * @exception E_INVALID_ARG The value of @c width is greater than or equal to @c 0.
122 * @exception E_OPERATION_FAILED This instance is in an invalid state.
123 * @exception E_SYSTEM The system error occurs.
125 result GetTextExtent(int width, const Tizen::Base::String& text, int startIndex, int length, bool outline, const Tizen::Base::String& delimiter, int& count, Dimension& dim) const;
128 * Sets the font size.
130 * @return An error code
131 * @param[in] size The font size in pixels @n
132 * The size must be greater than @c 0.
133 * @exception E_SUCCESS The method is successful.
134 * @exception E_INVALID_ARG A specified input parameter is invalid.
135 * @exception E_OPERATION_FAILED This instance is in an invalid state.
136 * @exception E_SYSTEM The system error occurs.
138 result SetSize(int size);
141 * Sets the font style.
143 * @return An error code
144 * @param[in] style The font style @n
145 * For more information, see Tizen::Graphics::FontStyle.
146 * @exception E_SUCCESS The method is successful.
147 * @exception E_INVALID_ARG A specified input parameter is invalid.
148 * @exception E_OPERATION_FAILED This instance is in an invalid state.
149 * @exception E_SYSTEM The system error occurs.
151 result SetStyle(int style);
154 * Gets the font style.
156 * @return the style of font
158 int GetStyle(void) const;
161 * Gets the leading of the current instance of Font.
163 * @return the leading of the current instance of Font, @n
164 * else @c -1 if the method fails
166 int GetLeading(void) const;
168 static _FontImpl* GetInstance(Font& font);
169 static const _FontImpl* GetInstance(const Font& font);
171 static bool UpdateDefaultFont(const Tizen::Base::String& key);
174 struct _FontCoordHolder* _pCoordHolder;
175 Tizen::Graphics::_Font* _pNativeFont;
178 _FontImpl(const _FontImpl& obj);
179 _FontImpl& operator =(const _FontImpl& rhs);
185 }} // Tizen::Graphics
187 #endif // _FGRP_INTERNAL_FONT_IMPL_H_