1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_FONT_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/devel-api/scripting/scripting.h>
25 #include <dali-toolkit/internal/text/text-controller.h>
26 #include <dali-toolkit/internal/text/text-definitions.h>
37 const Scripting::StringEnum FONT_WEIGHT_STRING_TABLE[] =
39 { "thin", TextAbstraction::FontWeight::THIN },
40 { "ultraLight", TextAbstraction::FontWeight::ULTRA_LIGHT },
41 { "extraLight", TextAbstraction::FontWeight::EXTRA_LIGHT },
42 { "light", TextAbstraction::FontWeight::LIGHT },
43 { "demiLight", TextAbstraction::FontWeight::DEMI_LIGHT },
44 { "semiLight", TextAbstraction::FontWeight::SEMI_LIGHT },
45 { "book", TextAbstraction::FontWeight::BOOK },
46 { "normal", TextAbstraction::FontWeight::NORMAL },
47 { "regular", TextAbstraction::FontWeight::REGULAR },
48 { "medium", TextAbstraction::FontWeight::MEDIUM },
49 { "demiBold", TextAbstraction::FontWeight::DEMI_BOLD },
50 { "semiBold", TextAbstraction::FontWeight::SEMI_BOLD },
51 { "bold", TextAbstraction::FontWeight::BOLD },
52 { "ultraBold", TextAbstraction::FontWeight::ULTRA_BOLD },
53 { "extraBold", TextAbstraction::FontWeight::EXTRA_BOLD },
54 { "black", TextAbstraction::FontWeight::BLACK },
55 { "heavy", TextAbstraction::FontWeight::HEAVY },
56 { "extraBlack", TextAbstraction::FontWeight::EXTRA_BLACK }
58 const unsigned int FONT_WEIGHT_STRING_TABLE_COUNT = sizeof( FONT_WEIGHT_STRING_TABLE ) / sizeof( FONT_WEIGHT_STRING_TABLE[0] );
60 const Scripting::StringEnum FONT_WIDTH_STRING_TABLE[] =
62 { "ultraCondensed", TextAbstraction::FontWidth::ULTRA_CONDENSED },
63 { "extraCondensed", TextAbstraction::FontWidth::EXTRA_CONDENSED },
64 { "condensed", TextAbstraction::FontWidth::CONDENSED },
65 { "semiCondensed", TextAbstraction::FontWidth::SEMI_CONDENSED },
66 { "normal", TextAbstraction::FontWidth::NORMAL },
67 { "semiExpanded", TextAbstraction::FontWidth::SEMI_EXPANDED },
68 { "expanded", TextAbstraction::FontWidth::EXPANDED },
69 { "extraExpanded", TextAbstraction::FontWidth::EXTRA_EXPANDED },
70 { "ultraExpanded", TextAbstraction::FontWidth::ULTRA_EXPANDED },
72 const unsigned int FONT_WIDTH_STRING_TABLE_COUNT = sizeof( FONT_WIDTH_STRING_TABLE ) / sizeof( FONT_WIDTH_STRING_TABLE[0] );
74 const Scripting::StringEnum FONT_SLANT_STRING_TABLE[] =
76 { "normal", TextAbstraction::FontSlant::NORMAL },
77 { "roman", TextAbstraction::FontSlant::ROMAN },
78 { "italic", TextAbstraction::FontSlant::ITALIC },
79 { "oblique", TextAbstraction::FontSlant::OBLIQUE }
81 const unsigned int FONT_SLANT_STRING_TABLE_COUNT = sizeof( FONT_SLANT_STRING_TABLE ) / sizeof( FONT_SLANT_STRING_TABLE[0] );
87 DEFAULT, ///< The default font's style.
88 INPUT ///< The input font's style.
93 * @brief Sets the font's style property.
95 * @param[in] controller The text's controller.
96 * @param[in] value The value of the font's style.
99 void SetFontStyleProperty( ControllerPtr controller, const Property::Value& value, FontStyle::Type type );
102 * @brief Retrieves the font's style property.
104 * @param[in] controller The text's controller.
105 * @param[out] value The value of the font's style.
107 void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, FontStyle::Type type );
110 * @brief Converts a weight string into @e FontWeight.
112 * @param[in] weightStr The weight string. Must end with '\0'.
114 * @return The @e FontWeight value corresponding to the string.
116 FontWeight StringToWeight( const char* const weightStr );
119 * @brief Converts a width string into @e FontWidth.
121 * @param[in] widthStr The width string. Must end with '\0'.
123 * @return The @e FontWidth value corresponding to the string.
125 FontWidth StringToWidth( const char* const widthStr );
128 * @brief Converts a slant string into @e FontSlant.
130 * @param[in] slantStr The slant string. Must end with '\0'.
132 * @return The @e FontSlant value corresponding to the string.
134 FontSlant StringToSlant( const char* const slantStr );
137 } // namespace Toolkit
141 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H__