1 #ifndef __DALI_FONT_PARAMETERS_H__
2 #define __DALI_FONT_PARAMETERS_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-handle.h>
23 #include <dali/public-api/text/text.h>
29 * @brief Font size in points.
31 * This reduces ambiguity when using methods which accept size in pixels or points.
33 struct DALI_IMPORT_API PointSize
36 * @brief Create size in points.
38 * @param[in] value The value in points.
40 explicit PointSize(float value);
43 * @brief Float cast operator.
45 operator float() const;
48 * @brief Equality operator.
50 * @param pointSize The point size to be compared.
51 * @return \e true if \e pointSize is equal to the point size stored in this object.
53 bool operator==( PointSize pointSize );
56 * @brief Inequality operator.
58 * @param pointSize The point size to be compared.
59 * @return \e true if \e pointSize is not equal to the point size stored in this object.
61 bool operator!=( PointSize pointSize );
63 float value; ///< The value in points
67 * @brief Font size in pixels.
69 * This reduces ambiguity when using methods which accept size in pixels or points.
71 struct DALI_IMPORT_API PixelSize
74 * @brief Create size in pixels.
76 * @param[in] value The value in pixels.
78 explicit PixelSize(unsigned int value);
81 * @brief Cast operator
83 operator unsigned int() const;
85 unsigned int value; ///< The value in pixels
89 * @brief Font size in Caps height
91 struct DALI_IMPORT_API CapsHeight
94 * @brief Size in CapsHeight
96 explicit CapsHeight( unsigned int value);
99 * @brief Cast operator
101 operator unsigned int() const;
103 unsigned int value; ///< The value in pixels
107 * @brief Encapsulates all font parameters.
109 struct DALI_IMPORT_API FontParameters
112 * @brief Default constructor.
114 * Default system font family name, default system font style and default system size
115 * will be used to build the font.
120 * @brief Constructor.
122 * Creates font parameters with the given family's name, style and size in points from the font requested.
123 * @param[in] familyName The family's name of the font requested.
124 * @param[in] style The style of the font requested.
125 * @param[in] size The size of the font requested in points.
127 FontParameters( const std::string& familyName, const std::string& style, PointSize size );
130 * @brief Constructor.
132 * Creates font parameters with the given family's name, style and size in pixels from the font requested.
133 * @param[in] familyName The family's name of the font requested.
134 * @param[in] style The style of the font requested.
135 * @param[in] size The size of the font requested in pixels.
137 FontParameters( const std::string& familyName, const std::string& style, PixelSize size );
140 * @brief Constructor.
142 * Creates font parameters with the given family's name, style and the caps-height size in pixels from the font requested.
143 * @param[in] familyName The family's name of the font requested.
144 * @param[in] style The style of the font requested.
145 * @param[in] size The caps-height of the font requested in pixels.
147 FontParameters( const std::string& familyName, const std::string& style, CapsHeight size );
152 * Destroys the internal implementation.
157 * @brief Copy constructor.
159 * Reset the internal implementation with new given values.
160 * @param[in] parameters The new font parameters.
162 FontParameters( const FontParameters& parameters );
165 * @brief Assignment operator.
167 * @param[in] parameters The new font parameters.
168 * @return A reference to this
170 FontParameters& operator=( const FontParameters& parameters );
173 * @brief Retrieves the name of the font's family.
175 * @return The name of the font's family.
177 const std::string& GetFamilyName() const;
180 * @brief Retrieves the style of the font.
182 * @return The style of the font.
184 const std::string& GetStyle() const;
187 * @brief Retrieves the size of the font.
189 * @return The size of the font in Points.
191 PointSize GetSize() const;
195 Impl* mImpl; ///< Internal implementation. Not intended for application developers.
199 DALI_IMPORT_API extern FontParameters DEFAULT_FONT_PARAMETERS; ///< Used to choose the platform's font parameters
203 #endif // __DALI_FONT_PARAMETERS_H__