1 #ifndef __DALI_TOOLKIT_TEXT_INPUT_STYLE_H__
2 #define __DALI_TOOLKIT_TEXT_INPUT_STYLE_H__
5 * Copyright (c) 2016 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/common/constants.h>
25 #include <dali-toolkit/internal/text/text-definitions.h>
37 * The input text's style.
45 INPUT_FONT_FAMILY = 0x0002,
46 INPUT_POINT_SIZE = 0x0004,
47 INPUT_FONT_WEIGHT = 0x0008,
48 INPUT_FONT_WIDTH = 0x0010,
49 INPUT_FONT_SLANT = 0x0020,
50 INPUT_LINE_SPACING = 0x0040,
51 INPUT_UNDERLINE = 0x0080,
52 INPUT_SHADOW = 0x0100,
53 INPUT_EMBOSS = 0x0200,
54 INPUT_OUTLINE = 0x0400
58 : textColor( Color::BLACK ),
60 weight( TextAbstraction::FontWeight::NORMAL ),
61 width( TextAbstraction::FontWidth::NORMAL ),
62 slant( TextAbstraction::FontSlant::NORMAL ),
65 underlineProperties(),
69 isDefaultColor( true ),
70 isFamilyDefined( false ),
71 isWeightDefined( false ),
72 isWidthDefined( false ),
73 isSlantDefined( false ),
74 isSizeDefined( false ),
75 isLineSpacingDefined( false ),
76 isUnderlineDefined( false ),
77 isShadowDefined( false ),
78 isEmbossDefined( false ),
79 isOutlineDefined( false )
88 * Does not copy the font-style, underline, shadow, emboss and outline property strings.
90 void Copy( const InputStyle& inputStyle )
92 isDefaultColor = inputStyle.isDefaultColor;
93 textColor = inputStyle.textColor;
95 isFamilyDefined = inputStyle.isFamilyDefined;
96 familyName = inputStyle.familyName;
98 isWeightDefined = inputStyle.isWeightDefined;
99 weight = inputStyle.weight;
101 isWidthDefined = inputStyle.isWidthDefined;
102 width = inputStyle.width;
104 isSlantDefined = inputStyle.isSlantDefined;
105 slant = inputStyle.slant;
107 isSizeDefined = inputStyle.isSizeDefined;
108 size = inputStyle.size;
110 isLineSpacingDefined = inputStyle.isLineSpacingDefined;
111 lineSpacing = inputStyle.lineSpacing;
113 isUnderlineDefined = inputStyle.isUnderlineDefined;
114 underlineProperties = inputStyle.underlineProperties;
116 isShadowDefined = inputStyle.isShadowDefined;
117 shadowProperties = inputStyle.shadowProperties;
119 isEmbossDefined = inputStyle.isEmbossDefined;
120 embossProperties = inputStyle.embossProperties;
122 isOutlineDefined = inputStyle.isOutlineDefined;
123 outlineProperties = inputStyle.outlineProperties;
129 * Does not compare the font-style, underline, shadow, emboss and outline property strings.
131 bool Equal( const InputStyle& inputStyle ) const
133 if( ( isDefaultColor != inputStyle.isDefaultColor ) ||
134 ( isFamilyDefined != inputStyle.isFamilyDefined ) ||
135 ( isWeightDefined != inputStyle.isWeightDefined ) ||
136 ( isWidthDefined != inputStyle.isWidthDefined ) ||
137 ( isSlantDefined != inputStyle.isSlantDefined ) ||
138 ( isSizeDefined != inputStyle.isSizeDefined ) ||
139 ( isLineSpacingDefined != inputStyle.isLineSpacingDefined ) ||
140 ( isUnderlineDefined != inputStyle.isUnderlineDefined ) ||
141 ( isShadowDefined != inputStyle.isShadowDefined ) ||
142 ( isEmbossDefined != inputStyle.isEmbossDefined ) ||
143 ( isOutlineDefined != inputStyle.isOutlineDefined ) ||
144 ( textColor != inputStyle.textColor ) ||
145 ( familyName != inputStyle.familyName ) ||
146 ( weight != inputStyle.weight ) ||
147 ( width != inputStyle.width ) ||
148 ( slant != inputStyle.slant ) ||
149 ( size != inputStyle.size ) ||
150 ( lineSpacing != inputStyle.lineSpacing ) ||
151 ( underlineProperties != inputStyle.underlineProperties ) ||
152 ( shadowProperties != inputStyle.shadowProperties ) ||
153 ( embossProperties != inputStyle.embossProperties ) ||
154 ( outlineProperties != inputStyle.outlineProperties ) )
162 Mask GetInputStyleChangeMask( const InputStyle& inputStyle ) const
166 if( textColor != inputStyle.textColor )
168 mask = static_cast<Mask>( mask | INPUT_COLOR );
170 if( familyName != inputStyle.familyName )
172 mask = static_cast<Mask>( mask | INPUT_FONT_FAMILY );
174 if( weight != inputStyle.weight )
176 mask = static_cast<Mask>( mask | INPUT_FONT_WEIGHT );
178 if( width != inputStyle.width )
180 mask = static_cast<Mask>( mask | INPUT_FONT_WIDTH );
182 if( slant != inputStyle.slant )
184 mask = static_cast<Mask>( mask | INPUT_FONT_SLANT );
186 if( size != inputStyle.size )
188 mask = static_cast<Mask>( mask | INPUT_POINT_SIZE );
190 if( lineSpacing != inputStyle.lineSpacing )
192 mask = static_cast<Mask>( mask | INPUT_LINE_SPACING );
194 if( underlineProperties != inputStyle.underlineProperties )
196 mask = static_cast<Mask>( mask | INPUT_UNDERLINE );
198 if( shadowProperties != inputStyle.shadowProperties )
200 mask = static_cast<Mask>( mask | INPUT_SHADOW );
202 if( embossProperties != inputStyle.embossProperties )
204 mask = static_cast<Mask>( mask | INPUT_EMBOSS );
206 if( outlineProperties != inputStyle.outlineProperties )
208 mask = static_cast<Mask>( mask | INPUT_OUTLINE );
214 Vector4 textColor; ///< The text's color.
215 std::string familyName; ///< The font's family name.
216 FontWeight weight; ///< The font's weight.
217 FontWidth width; ///< The font's width.
218 FontSlant slant; ///< The font's slant.
219 float size; ///< The font's size.
221 float lineSpacing; ///< The line's spacing.
223 std::string underlineProperties; ///< The underline properties string.
224 std::string shadowProperties; ///< The shadow properties string.
225 std::string embossProperties; ///< The emboss properties string.
226 std::string outlineProperties; ///< The outline properties string.
228 bool isDefaultColor : 1; ///< Whether the text's color is the default.
229 bool isFamilyDefined : 1; ///< Whether the font's family is defined.
230 bool isWeightDefined : 1; ///< Whether the font's weight is defined.
231 bool isWidthDefined : 1; ///< Whether the font's width is defined.
232 bool isSlantDefined : 1; ///< Whether the font's slant is defined.
233 bool isSizeDefined : 1; ///< Whether the font's size is defined.
235 bool isLineSpacingDefined : 1; ///< Whether the line spacing is defined.
236 bool isUnderlineDefined : 1; ///< Whether the underline parameters are defined.
237 bool isShadowDefined : 1; ///< Whether the shadow parameters are defined.
238 bool isEmbossDefined : 1; ///< Whether the emboss parameters are defined.
239 bool isOutlineDefined : 1; ///< Whether the outline parameters are defined.
244 } // namespace Toolkit
248 #endif // __DALI_TOOLKIT_TEXT_INPUT_STYLE_H__