[dali_1.0.2] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / internal / event / text / text-format.h
1 #ifndef __DALI_INTERNAL_TEXT_FORMAT_H__
2 #define __DALI_INTERNAL_TEXT_FORMAT_H__
3
4 /*
5  * Copyright (c) 2014 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 // INTERNAL INCLUDES
22 #include <dali/public-api/math/radian.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 /**
31  *
32  * Text formatting controls how the vertex data
33  * for a string of text is created.
34  * E.g. if italics is turned on, the vertices are modified
35  * to created slanted characters.
36  * If underline is true, a thin line is added to underline the
37  * text (as a quad)
38  */
39 struct TextFormat
40 {
41
42   /**
43    * Constructor
44    */
45   TextFormat();
46
47   /**
48    * Constructor
49    * @param[in] underline whether to underline the text
50    * @param[in] italics whether italics is enabled
51    * @param[in] italicsAngle italics angle
52    * @param[in] pointSize the point size
53    */
54   TextFormat( bool underline,
55               bool italics,
56               Dali::Radian italicsAngle,
57               float pointSize,
58               float underlineThickness,
59               float underlinePosition );
60
61   /**
62    * Copy constructor.
63    * @param[in] rhs object to copy
64    */
65   TextFormat( const TextFormat& rhs);
66
67   /**
68    * Assignment operator
69    * @param[in] rhs object to assign from
70    * @return this
71    */
72   TextFormat& operator=( const TextFormat& rhs );
73
74
75   /**
76    * Destructor
77    */
78   ~TextFormat();
79
80   /**
81    * Whether underline is enabled
82    * @return true if underline is enabled
83    */
84   bool IsUnderLined() const;
85
86   /**
87    * whether italics are enabled
88    * @return true if italics enabled
89    */
90   bool IsItalic() const;
91
92   /**
93    * Get the italics angle
94    * @return italics angle
95    */
96   Dali::Radian GetItalicsAngle() const;
97
98   /**
99    * Get point size
100    * @return font point size
101    */
102   float GetPointSize() const;
103
104   /**
105    * Get the character used for underlining.
106    * @return under line character
107    */
108   unsigned int GetUnderLineCharacter() const;
109
110   /**
111    * @return The underline's thickness.
112    */
113   float GetUnderlineThickness() const;
114
115   /**
116    * @return The underline's position.
117    */
118   float GetUnderlinePosition() const;
119
120 private:
121
122   bool mUnderline:1;              ///< whether to underline the text
123   bool mItalics:1;                ///< whether to apply italics
124   Dali::Radian mItalicsAngle;     ///< italics angle if applied
125   float mPointSize;               ///< Point size. Used to scale the vertices by this amount.
126   float mUnderlineThickness;      ///< The underline's thickness.
127   float mUnderlinePosition;       ///< The underline's position.
128 };
129
130
131 } // namespace Internal
132
133 } // namespace Dali
134
135 #endif // __DALI_INTERNAL_TEXT_FORMAT_H__