X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Ftext-view%2Ftext-view-processor-helper-functions.cpp;h=43a5f4e3722a67fc5f1bd3e29b9f7e776b6e8fca;hp=1855b6e0ed4da03196916063c2685a5411754cb2;hb=c11191b4322a0687606b3e7f05db0a31f85403cc;hpb=59fdf81f3cc2d004cca1b182dee09e42492d51c5 diff --git a/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp b/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp index 1855b6e..43a5f4e 100644 --- a/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp +++ b/base/dali-toolkit/internal/controls/text-view/text-view-processor-helper-functions.cpp @@ -58,20 +58,20 @@ TextSeparatorType GetTextSeparatorType( const Character& character ) return ( character.IsNewLine() ? ParagraphSeparator : ( character.IsWhiteSpace() ? WordSeparator : NoSeparator ) ); } -void ChooseFontFamilyName( MarkupProcessor::StyledText& text ) +void ChooseFontFamilyName( const Character& character, TextStyle& style ) { DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "-->TextViewProcessor::ChooseFontFamilyName\n" ); - DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, " input font name: [%s]\n", text.mStyle.GetFontName().c_str() ); + DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, " input font name: [%s]\n", style.GetFontName().c_str() ); bool userDefinedFontFamilyName = false; // First check if there is a font defined in the style and it supports the given text. - if( !text.mStyle.GetFontName().empty() ) + if( !style.GetFontName().empty() ) { - const FontParameters fontParams( text.mStyle.GetFontName(), text.mStyle.GetFontStyle() , text.mStyle.GetFontPointSize() ); + const FontParameters fontParams( style.GetFontName(), style.GetFontStyle() , style.GetFontPointSize() ); const Font font = Font::New( fontParams ); - if( !font.IsDefaultSystemFont() && font.AllGlyphsSupported( text.mText ) ) + if( !font.IsDefaultSystemFont() && font.AllGlyphsSupported( character ) ) { userDefinedFontFamilyName = true; } @@ -82,20 +82,20 @@ void ChooseFontFamilyName( MarkupProcessor::StyledText& text ) const Font defaultSystemFont = Font::New(); // At this point no font is set or doesn't support the given text. - if( !defaultSystemFont.AllGlyphsSupported( text.mText ) ) + if( !defaultSystemFont.AllGlyphsSupported( character ) ) { // If the default system font doesn't support the given text, // an appropiate font is selected. - text.mStyle.SetFontName( Font::GetFamilyForText( text.mText ) ); + style.SetFontName( Font::GetFamilyForText( character ) ); // @TODO Font::GetFamilyForText() should return font family and font style. } else { // All characters are supported with default font, so use it - text.mStyle.SetFontName( "" ); + style.SetFontName( "" ); } } - DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, " output font name: [%s]\n", text.mStyle.GetFontName().c_str() ); + DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, " output font name: [%s]\n", style.GetFontName().c_str() ); DALI_LOG_INFO( gTextViewProcessorLogFilter, Debug::General, "<--TextViewProcessor::ChooseFontFamilyName\n" ); } @@ -123,6 +123,7 @@ void GetIndicesFromGlobalCharacterIndex( const std::size_t index, ++paragraphIt, ++indices.mParagraphIndex ) { const ParagraphLayoutInfo& paragraphLayoutInfo( *paragraphIt ); + std::size_t currentCharactersTraversed = currentIndex; // stores how many characters have been traversed until this paragraph. if( currentIndex + paragraphLayoutInfo.mNumberOfCharacters > index ) { @@ -138,6 +139,7 @@ void GetIndicesFromGlobalCharacterIndex( const std::size_t index, { // The character is in this word indices.mCharacterIndex = index - currentIndex; + indices.mCharacterParagraphIndex = index - currentCharactersTraversed; found = true; } else