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