TextActor - New constructor with a parameter object replaces previous constructors.
[platform/core/uifw/dali-core.git] / dali / internal / event / text / text-format.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/text/text-format.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/text/special-characters.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 TextFormat::TextFormat()
31 : mUnderline(false),
32   mItalics(false),
33   mItalicsAngle(0.0f),
34   mPointSize(0.0f),
35   mUnderlineThickness( 0.f ),
36   mUnderlinePosition( 0.f )
37 {}
38
39 TextFormat::TextFormat( bool underline,
40                         bool italics,
41                         Dali::Radian italicsAngle,
42                         float pointSize,
43                         float underlineThickness,
44                         float underlinePosition )
45 : mUnderline( underline ),
46   mItalics( italics ),
47   mItalicsAngle( italicsAngle ),
48   mPointSize( pointSize ),
49   mUnderlineThickness( underlineThickness ),
50   mUnderlinePosition( underlinePosition )
51 {
52 }
53
54 TextFormat::TextFormat( const TextFormat& rhs )
55 : mUnderline( rhs.mUnderline ),
56   mItalics( rhs.mItalics ),
57   mItalicsAngle( rhs.mItalicsAngle ),
58   mPointSize( rhs.mPointSize ),
59   mUnderlineThickness( rhs.mUnderlineThickness ),
60   mUnderlinePosition( rhs.mUnderlinePosition )
61 {
62 }
63
64 TextFormat& TextFormat::operator=( const TextFormat& rhs )
65 {
66   mUnderline = rhs.mUnderline;
67   mItalics = rhs.mItalics;
68   mItalicsAngle = rhs.mItalicsAngle;
69   mPointSize = rhs.mPointSize;
70   mUnderlineThickness = rhs.mUnderlineThickness;
71   mUnderlinePosition = rhs.mUnderlinePosition;
72
73   return *this;
74 }
75
76 TextFormat::~TextFormat()
77 {
78 }
79
80 bool TextFormat::IsUnderLined() const
81 {
82   return mUnderline;
83 }
84
85 bool TextFormat::IsItalic() const
86 {
87   return mItalics;
88 }
89
90 Dali::Radian  TextFormat::GetItalicsAngle() const
91 {
92   return mItalicsAngle;
93 }
94
95 float TextFormat::GetPointSize() const
96 {
97   return mPointSize;
98 }
99
100 unsigned int TextFormat::GetUnderLineCharacter() const
101 {
102   return SpecialCharacters::UNDERLINE_CHARACTER;
103 }
104
105 float TextFormat::GetUnderlineThickness() const
106 {
107   return mUnderlineThickness;
108 }
109
110 float TextFormat::GetUnderlinePosition() const
111 {
112   return mUnderlinePosition;
113 }
114
115 } // namespace Internal
116
117 } // namespace Dali