X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=base%2Fdali-toolkit%2Fpublic-api%2Fmarkup-processor%2Fmarkup-processor.cpp;h=83359fd7aec946907106607be759b397284203a2;hb=f8118428cb455fb2503d07568ad62c79b07dc004;hp=995253aa52b74d5953021e666f73655203675f53;hpb=e58fa784d19a558e35f458ecf6d262a2344beb4f;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp b/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp index 995253a..83359fd 100644 --- a/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp +++ b/base/dali-toolkit/public-api/markup-processor/markup-processor.cpp @@ -1,26 +1,23 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // HEADER INCLUDE #include -// INTERNAL INCLUDES -#include - - // EXTERNAL INCLUDES #include #include @@ -548,7 +545,18 @@ void GetStyledTextArray( const std::string& markupString, StyledTextArray& style if ( !scanForMarkup ) { - styledTextArray.push_back( StyledText( Text( markupString ), TextStyle() ) ); + const Text text( markupString ); + const std::size_t size = text.GetLength(); + + styledTextArray.resize( size, StyledText( Text(), TextStyle() ) ); + + std::size_t index = 0; + for( StyledTextArray::iterator it = styledTextArray.begin(), endIt = styledTextArray.end(); it != endIt; ++it, ++index ) + { + StyledText& styledText( *it ); + + styledText.mText.Append( text[index] ); + } return; } @@ -880,9 +888,9 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku { const StyledText& styledText( *it ); - bool isItalics = styledText.mStyle.GetItalics(); + bool isItalics = styledText.mStyle.IsItalicsEnabled(); bool isBold = defaultStyle.GetWeight() != styledText.mStyle.GetWeight(); - bool isUnderline = styledText.mStyle.GetUnderline(); + bool isUnderline = styledText.mStyle.IsUnderlineEnabled(); bool hasFontFace = defaultStyle.GetFontName() != styledText.mStyle.GetFontName(); bool hasFontStyle = defaultStyle.GetFontStyle() != styledText.mStyle.GetFontStyle(); bool hasFontSize = fabsf( defaultStyle.GetFontPointSize() - styledText.mStyle.GetFontPointSize() ) > GetRangedEpsilon( defaultStyle.GetFontPointSize(), styledText.mStyle.GetFontPointSize() ); @@ -949,7 +957,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // Write shadow. - if( styledText.mStyle.GetShadow() ) + if( styledText.mStyle.IsShadowEnabled() ) { markupString += LESS_THAN + XHTML_SHADOW_TAG; @@ -968,7 +976,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // Write glow. - if( styledText.mStyle.GetGlow() ) + if( styledText.mStyle.IsGlowEnabled() ) { markupString += LESS_THAN + XHTML_GLOW_TAG; @@ -986,7 +994,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // // Write outline. - if( styledText.mStyle.GetOutline() ) + if( styledText.mStyle.IsOutlineEnabled() ) { markupString += LESS_THAN + XHTML_OUTLINE_TAG; @@ -1015,19 +1023,19 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } // Write outline close tag. - if( styledText.mStyle.GetOutline() ) + if( styledText.mStyle.IsOutlineEnabled() ) { markupString += LESS_THAN + ( SLASH + XHTML_OUTLINE_TAG + GREATER_THAN ); // } // Write glow close tag. - if( styledText.mStyle.GetGlow() ) + if( styledText.mStyle.IsGlowEnabled() ) { markupString += LESS_THAN + ( SLASH + XHTML_GLOW_TAG + GREATER_THAN ); // } // Write shadow close tag. - if( styledText.mStyle.GetShadow() ) + if( styledText.mStyle.IsShadowEnabled() ) { markupString += LESS_THAN + ( SLASH + XHTML_SHADOW_TAG + GREATER_THAN ); // } @@ -1064,7 +1072,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku } } -void SetTextStyle( StyledTextArray& styledTextArray, const TextStyle& style, const TextStyle::Mask mask ) +void SetTextStyle( StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask ) { if( !styledTextArray.empty() ) { @@ -1073,7 +1081,7 @@ void SetTextStyle( StyledTextArray& styledTextArray, const TextStyle& style, con } } -void SetTextStyle( const Text& text, StyledTextArray& styledTextArray, const TextStyle& style, const TextStyle::Mask mask ) +void SetTextStyle( const Text& text, StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask ) { if( !text.IsEmpty() ) { @@ -1092,7 +1100,7 @@ void SetTextStyle( const Text& text, StyledTextArray& styledTextArray, const Tex } } -void SetTextStyleToRange( StyledTextArray& styledTextArray, const TextStyle& style, const TextStyle::Mask mask, const std::size_t begin, const std::size_t end ) +void SetTextStyleToRange( StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask, std::size_t begin, std::size_t end ) { const size_t size = styledTextArray.size(); DALI_ASSERT_ALWAYS( begin < size );