X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-font-style.h;h=c85ec5856d8be42f944c6c871c6dec3c009ef58a;hp=b87a8c915ab72c7406b6cd46b639df214ec826bb;hb=9ddd5fea6278d06b8874988498c7c4c6508750ba;hpb=0e5a634c6f20855c76a6e2f63049db37fcbad965 diff --git a/dali-toolkit/internal/text/text-font-style.h b/dali-toolkit/internal/text/text-font-style.h index b87a8c9..c85ec58 100644 --- a/dali-toolkit/internal/text/text-font-style.h +++ b/dali-toolkit/internal/text/text-font-style.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H__ -#define __DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H__ +#ifndef DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H +#define DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,88 +23,93 @@ // INTERNAL INCLUDES #include -#include namespace Dali { - namespace Toolkit { - namespace Text { - const Scripting::StringEnum FONT_WEIGHT_STRING_TABLE[] = -{ - { "thin", TextAbstraction::FontWeight::THIN }, - { "ultraLight", TextAbstraction::FontWeight::ULTRA_LIGHT }, - { "extraLight", TextAbstraction::FontWeight::EXTRA_LIGHT }, - { "light", TextAbstraction::FontWeight::LIGHT }, - { "demiLight", TextAbstraction::FontWeight::DEMI_LIGHT }, - { "semiLight", TextAbstraction::FontWeight::SEMI_LIGHT }, - { "book", TextAbstraction::FontWeight::BOOK }, - { "normal", TextAbstraction::FontWeight::NORMAL }, - { "regular", TextAbstraction::FontWeight::REGULAR }, - { "medium", TextAbstraction::FontWeight::MEDIUM }, - { "demiBold", TextAbstraction::FontWeight::DEMI_BOLD }, - { "semiBold", TextAbstraction::FontWeight::SEMI_BOLD }, - { "bold", TextAbstraction::FontWeight::BOLD }, - { "ultraBold", TextAbstraction::FontWeight::ULTRA_BOLD }, - { "extraBold", TextAbstraction::FontWeight::EXTRA_BOLD }, - { "black", TextAbstraction::FontWeight::BLACK }, - { "heavy", TextAbstraction::FontWeight::HEAVY }, - { "extraBlack", TextAbstraction::FontWeight::EXTRA_BLACK } -}; -const unsigned int FONT_WEIGHT_STRING_TABLE_COUNT = sizeof( FONT_WEIGHT_STRING_TABLE ) / sizeof( FONT_WEIGHT_STRING_TABLE[0] ); + { + {"thin", TextAbstraction::FontWeight::THIN}, + {"ultraLight", TextAbstraction::FontWeight::ULTRA_LIGHT}, + {"extraLight", TextAbstraction::FontWeight::EXTRA_LIGHT}, + {"light", TextAbstraction::FontWeight::LIGHT}, + {"demiLight", TextAbstraction::FontWeight::DEMI_LIGHT}, + {"semiLight", TextAbstraction::FontWeight::SEMI_LIGHT}, + {"book", TextAbstraction::FontWeight::BOOK}, + {"normal", TextAbstraction::FontWeight::NORMAL}, + {"regular", TextAbstraction::FontWeight::REGULAR}, + {"medium", TextAbstraction::FontWeight::MEDIUM}, + {"demiBold", TextAbstraction::FontWeight::DEMI_BOLD}, + {"semiBold", TextAbstraction::FontWeight::SEMI_BOLD}, + {"bold", TextAbstraction::FontWeight::BOLD}, + {"ultraBold", TextAbstraction::FontWeight::ULTRA_BOLD}, + {"extraBold", TextAbstraction::FontWeight::EXTRA_BOLD}, + {"black", TextAbstraction::FontWeight::BLACK}, + {"heavy", TextAbstraction::FontWeight::HEAVY}, + {"extraBlack", TextAbstraction::FontWeight::EXTRA_BLACK}}; +const unsigned int FONT_WEIGHT_STRING_TABLE_COUNT = sizeof(FONT_WEIGHT_STRING_TABLE) / sizeof(FONT_WEIGHT_STRING_TABLE[0]); const Scripting::StringEnum FONT_WIDTH_STRING_TABLE[] = -{ - { "ultraCondensed", TextAbstraction::FontWidth::ULTRA_CONDENSED }, - { "extraCondensed", TextAbstraction::FontWidth::EXTRA_CONDENSED }, - { "condensed", TextAbstraction::FontWidth::CONDENSED }, - { "semiCondensed", TextAbstraction::FontWidth::SEMI_CONDENSED }, - { "normal", TextAbstraction::FontWidth::NORMAL }, - { "semiExpanded", TextAbstraction::FontWidth::SEMI_EXPANDED }, - { "expanded", TextAbstraction::FontWidth::EXPANDED }, - { "extraExpanded", TextAbstraction::FontWidth::EXTRA_EXPANDED }, - { "ultraExpanded", TextAbstraction::FontWidth::ULTRA_EXPANDED }, + { + {"ultraCondensed", TextAbstraction::FontWidth::ULTRA_CONDENSED}, + {"extraCondensed", TextAbstraction::FontWidth::EXTRA_CONDENSED}, + {"condensed", TextAbstraction::FontWidth::CONDENSED}, + {"semiCondensed", TextAbstraction::FontWidth::SEMI_CONDENSED}, + {"normal", TextAbstraction::FontWidth::NORMAL}, + {"semiExpanded", TextAbstraction::FontWidth::SEMI_EXPANDED}, + {"expanded", TextAbstraction::FontWidth::EXPANDED}, + {"extraExpanded", TextAbstraction::FontWidth::EXTRA_EXPANDED}, + {"ultraExpanded", TextAbstraction::FontWidth::ULTRA_EXPANDED}, }; -const unsigned int FONT_WIDTH_STRING_TABLE_COUNT = sizeof( FONT_WIDTH_STRING_TABLE ) / sizeof( FONT_WIDTH_STRING_TABLE[0] ); +const unsigned int FONT_WIDTH_STRING_TABLE_COUNT = sizeof(FONT_WIDTH_STRING_TABLE) / sizeof(FONT_WIDTH_STRING_TABLE[0]); const Scripting::StringEnum FONT_SLANT_STRING_TABLE[] = -{ - { "normal", TextAbstraction::FontSlant::NORMAL }, - { "roman", TextAbstraction::FontSlant::ROMAN }, - { "italic", TextAbstraction::FontSlant::ITALIC }, - { "oblique", TextAbstraction::FontSlant::OBLIQUE } -}; -const unsigned int FONT_SLANT_STRING_TABLE_COUNT = sizeof( FONT_SLANT_STRING_TABLE ) / sizeof( FONT_SLANT_STRING_TABLE[0] ); + { + {"normal", TextAbstraction::FontSlant::NORMAL}, + {"roman", TextAbstraction::FontSlant::ROMAN}, + {"italic", TextAbstraction::FontSlant::ITALIC}, + {"oblique", TextAbstraction::FontSlant::OBLIQUE}}; +const unsigned int FONT_SLANT_STRING_TABLE_COUNT = sizeof(FONT_SLANT_STRING_TABLE) / sizeof(FONT_SLANT_STRING_TABLE[0]); namespace FontStyle { - enum Type - { - DEFAULT, ///< The default font's style. - INPUT ///< The input font's style. - }; +enum Type +{ + DEFAULT, ///< The default font's style. + INPUT, ///< The input font's style. + PLACEHOLDER ///< The placeholder text font's style. }; +}; + +/** + * @brief Sets the font family property. + * + * @param[in] controller The text's controller. + * @param[in] value The value of the font's family. + */ +void SetFontFamilyProperty(ControllerPtr controller, const Property::Value& value); /** * @brief Sets the font's style property. * * @param[in] controller The text's controller. * @param[in] value The value of the font's style. + * @param[in] type Whether the property is for the default font's style, the input font's style or the placeholder font's style. * */ -void SetFontStyleProperty( ControllerPtr controller, const Property::Value& value, FontStyle::Type type ); +void SetFontStyleProperty(ControllerPtr controller, const Property::Value& value, FontStyle::Type type); /** * @brief Retrieves the font's style property. * * @param[in] controller The text's controller. * @param[out] value The value of the font's style. + * @param[in] type Whether the property is for the default font's style, the input font's style or the placeholder font's style. */ -void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, FontStyle::Type type ); +void GetFontStyleProperty(ControllerPtr controller, Property::Value& value, FontStyle::Type type); /** * @brief Converts a weight string into @e FontWeight. @@ -113,7 +118,7 @@ void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, Fon * * @return The @e FontWeight value corresponding to the string. */ -FontWeight StringToWeight( const char* const weightStr ); +FontWeight StringToWeight(const char* const weightStr); /** * @brief Converts a width string into @e FontWidth. @@ -122,7 +127,7 @@ FontWeight StringToWeight( const char* const weightStr ); * * @return The @e FontWidth value corresponding to the string. */ -FontWidth StringToWidth( const char* const widthStr ); +FontWidth StringToWidth(const char* const widthStr); /** * @brief Converts a slant string into @e FontSlant. @@ -131,11 +136,11 @@ FontWidth StringToWidth( const char* const widthStr ); * * @return The @e FontSlant value corresponding to the string. */ -FontSlant StringToSlant( const char* const slantStr ); +FontSlant StringToSlant(const char* const slantStr); } // namespace Text } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H__ +#endif // DALI_TOOLKIT_INTERNAL_TEXT_FONT_STYLE_H