[dali_1.0.1] 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] leftToRight whether text is rendered left to right
51    * @param[in] italics whether italics is enabled
52    * @param[in] italicsAngle italics angle
53    * @param[in] pointSize the point size
54    */
55   TextFormat( bool underline,
56               bool leftToRight,
57               bool italics,
58               Dali::Radian italicsAngle,
59               float pointSize,
60               float underlineThickness,
61               float underlinePosition );
62
63   /**
64    * Copy constructor.
65    * @param[in] rhs object to copy
66    */
67   TextFormat( const TextFormat& rhs);
68
69   /**
70    * Assignment operator
71    * @param[in] rhs object to assign from
72    * @return this
73    */
74   TextFormat& operator=( const TextFormat& rhs );
75
76
77   /**
78    * Destructor
79    */
80   ~TextFormat();
81
82   /**
83    * Whether underline is enabled
84    * @return true if underline is enabled
85    */
86   bool IsUnderLined() const;
87
88   /**
89    * Whether left to right character layout is enabled
90    * @return true if left to right is true
91    */
92   bool IsLeftToRight() const;
93
94   /**
95    * whether italics are enabled
96    * @return true if italics enabled
97    */
98   bool IsItalic() const;
99
100   /**
101    * Get the italics angle
102    * @return italics angle
103    */
104   Dali::Radian GetItalicsAngle() const;
105
106   /**
107    * Get point size
108    * @return font point size
109    */
110   float GetPointSize() const;
111
112   /**
113    * Get the character used for underlining.
114    * @return under line character
115    */
116   unsigned int GetUnderLineCharacter() const;
117
118   /**
119    * @return The underline's thickness.
120    */
121   float GetUnderlineThickness() const;
122
123   /**
124    * @return The underline's position.
125    */
126   float GetUnderlinePosition() const;
127
128 private:
129
130   bool mUnderline:1;              ///< whether to underline the text
131   bool mLeftToRight:1;            ///< Whether text is displayed left to right
132   bool mItalics:1;                ///< whether to apply italics
133   Dali::Radian mItalicsAngle;     ///< italics angle if applied
134   float mPointSize;               ///< Point size. Used to scale the vertices by this amount.
135   float mUnderlineThickness;      ///< The underline's thickness.
136   float mUnderlinePosition;       ///< The underline's position.
137 };
138
139
140 } // namespace Internal
141
142 } // namespace Dali
143
144 #endif // __DALI_INTERNAL_TEXT_FORMAT_H__