From: Jinho, Lee Date: Tue, 30 May 2017 09:20:26 +0000 (+0900) Subject: Revert "[Tizen] Text style to return properties(FONT_STYLE) as string" X-Git-Tag: accepted/tizen/unified/20170608.072242~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F84%2F131784%2F1;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Revert "[Tizen] Text style to return properties(FONT_STYLE) as string" This reverts commit 580a3a5de8489adb3ad6d0fcc2802c1a5b00a1c1. Change-Id: Ie104d6ca204c6c353122bc67035fd89f3d930221 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index 5cacd19..ff32ccf 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -1913,25 +1913,3 @@ int utcDaliTextEditorShadowPropertyStringP(void) END_TEST; } - -int utcDaliTextEditorFontStylePropertyStringP(void) -{ - ToolkitTestApplication application; - tet_infoline(" utcDaliTextEditorFontStylePropertyStringP Setting FontStyle propeties by string"); - - TextEditor editor = TextEditor::New(); - - std::string fontStyleSettings( "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" ); - - Stage::GetCurrent().Add( editor ); - - editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" ); - - Property::Value value = editor.GetProperty( TextEditor::Property::FONT_STYLE ); - std::string result; - value.Get(result); - - DALI_TEST_EQUALS( result, fontStyleSettings, TEST_LOCATION ); - - END_TEST; -} diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index 3014edb..43a7cf3 100644 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -316,8 +316,7 @@ struct Controller::Impl mIsAutoScrollEnabled( false ), mAutoScrollDirectionRTL( false ), mUnderlineSetByString( false ), - mShadowSetByString( false ), - mFontStyleSetByString( false ) + mShadowSetByString( false ) { mModel = Model::New(); @@ -726,7 +725,6 @@ public: bool mUnderlineSetByString:1; ///< Set when underline is set by string (legacy) instead of map bool mShadowSetByString:1; ///< Set when shadow is set by string (legacy) instead of map - bool mFontStyleSetByString:1; ///< Set when font style is set by string (legacy) instead of map }; } // namespace Text diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 4724744..7545481 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1438,16 +1438,6 @@ void Controller::ShadowSetByString( bool setByString ) mImpl->mShadowSetByString = setByString; } -bool Controller::IsFontStyleSetByString() -{ - return mImpl->mFontStyleSetByString; -} - -void Controller::FontStyleSetByString( bool setByString ) -{ - mImpl->mFontStyleSetByString = setByString; -} - // public : Queries & retrieves. Layout::Engine& Controller::GetLayoutEngine() diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index 7562394..b9cbb2c 100644 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -422,18 +422,6 @@ public: // Configure the text controller. */ void ShadowSetByString( bool setByString ); - /** - * @brief Query if font style settings were provided by string or map - * @return bool true if set by string - */ - bool IsFontStyleSetByString(); - - /** - * Set method font style setting were set by - * @param[in] bool, true if set by string - */ - void FontStyleSetByString( bool setByString ); - public: // Update. /** diff --git a/dali-toolkit/internal/text/text-font-style.cpp b/dali-toolkit/internal/text/text-font-style.cpp index 249157e..6a57337 100644 --- a/dali-toolkit/internal/text/text-font-style.cpp +++ b/dali-toolkit/internal/text/text-font-style.cpp @@ -114,13 +114,10 @@ void SetFontStyleProperty( ControllerPtr controller, const Property::Value& valu const std::string& fontStyleProperties = value.Get(); ParsePropertyString( fontStyleProperties, map ); - controller->FontStyleSetByString( true ); - } else { map = value.Get(); - controller->FontStyleSetByString( false ); } if( !map.Empty() ) @@ -246,7 +243,6 @@ void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, Fon if( controller ) { const bool isDefaultStyle = FontStyle::DEFAULT == type; - const bool isSetbyString = controller->IsFontStyleSetByString(); bool weightDefined = false; bool widthDefined = false; @@ -298,97 +294,46 @@ void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, Fon } } - if( !isSetbyString ) - { - Property::Map map; - - if( weightDefined ) - { - if( TextAbstraction::FontWeight::NONE != weight ) - { - const std::string weightStr( GetEnumerationName( weight, - FONT_WEIGHT_STRING_TABLE, - FONT_WEIGHT_STRING_TABLE_COUNT ) ); - - map.Insert( WEIGHT_KEY, weightStr ); - } - } - - if( widthDefined ) - { - if( TextAbstraction::FontWidth::NONE != width ) - { - const std::string widthStr( GetEnumerationName( width, - FONT_WIDTH_STRING_TABLE, - FONT_WIDTH_STRING_TABLE_COUNT ) ); - - map.Insert( WIDTH_KEY, widthStr ); - } - } + Property::Map map; - if( slantDefined ) + if( weightDefined ) + { + if( TextAbstraction::FontWeight::NONE != weight ) { - if( TextAbstraction::FontSlant::NONE != slant ) - { - const std::string slantStr( GetEnumerationName( slant, - FONT_SLANT_STRING_TABLE, - FONT_SLANT_STRING_TABLE_COUNT ) ); + const std::string weightStr( GetEnumerationName( weight, + FONT_WEIGHT_STRING_TABLE, + FONT_WEIGHT_STRING_TABLE_COUNT ) ); - map.Insert( SLANT_KEY, slantStr ); - } + map.Insert( WEIGHT_KEY, weightStr ); } + } - value = map; - } // SetbyMAP - else + if( widthDefined ) { - std::string fontStyleProperties = "{"; - - if( weightDefined ) + if( TextAbstraction::FontWidth::NONE != width ) { - if( TextAbstraction::FontWeight::NONE != weight ) - { - const std::string weightStr( GetEnumerationName( weight, - FONT_WEIGHT_STRING_TABLE, - FONT_WEIGHT_STRING_TABLE_COUNT ) ); + const std::string widthStr( GetEnumerationName( width, + FONT_WIDTH_STRING_TABLE, + FONT_WIDTH_STRING_TABLE_COUNT ) ); - fontStyleProperties += "\"weight\":\"" + weightStr + "\","; - } - } - - if( widthDefined ) - { - if( TextAbstraction::FontWidth::NONE != width ) - { - const std::string widthStr( GetEnumerationName( width, - FONT_WIDTH_STRING_TABLE, - FONT_WIDTH_STRING_TABLE_COUNT ) ); - fontStyleProperties += "\"width\":\"" + widthStr + "\","; - } + map.Insert( WIDTH_KEY, widthStr ); } + } - if( slantDefined ) + if( slantDefined ) + { + if( TextAbstraction::FontSlant::NONE != slant ) { - if( TextAbstraction::FontSlant::NONE != slant ) - { - const std::string slantStr( GetEnumerationName( slant, - FONT_SLANT_STRING_TABLE, - FONT_SLANT_STRING_TABLE_COUNT ) ); - - fontStyleProperties += "\"slant\":\"" + slantStr + "\""; - } - } + const std::string slantStr( GetEnumerationName( slant, + FONT_SLANT_STRING_TABLE, + FONT_SLANT_STRING_TABLE_COUNT ) ); - // If last character is comma, it will be removed. - if((*fontStyleProperties.rbegin()) == ',' ) - { - fontStyleProperties = fontStyleProperties.substr( 0, fontStyleProperties.size()-1 ); + map.Insert( SLANT_KEY, slantStr ); } - fontStyleProperties += "}"; + } - value = fontStyleProperties; - } // SetbyString - }// controller + value = map; + } } FontWeight StringToWeight( const char* const weightStr )