From: Jinho, Lee Date: Fri, 22 Sep 2017 05:10:03 +0000 (+0900) Subject: Fixed a problem where text size exceeds maximum texture size. X-Git-Tag: dali_1.2.62~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=182df666bc90e1a752537bdf933941aceef37304 Fixed a problem where text size exceeds maximum texture size. - Adjusts the length of the text to the maximum texture size. - Dropped text will be shown as ellipsis. Change-Id: Ie342327fcb8cb1ba0827b3943101ce2b141ac17d --- diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 13cf696..148462a 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include // INTERNAL INCLUDES @@ -919,8 +920,24 @@ void TextLabel::SetUpAutoScrolling() Vector2 textureSize = textNaturalSize + Vector2(wrapGap, 0.0f); // Add the gap as a part of the texture // Create a texture of the text for scrolling + Size verifiedSize = textureSize; + const int maxTextureSize = Dali::GetMaxTextureSize(); + + //if the texture size width exceed maxTextureSize, modify the visual model size and enabled the ellipsis + if( verifiedSize.width > maxTextureSize ) + { + verifiedSize.width = maxTextureSize; + if( textNaturalSize.width > maxTextureSize ) + { + mController->SetTextElideEnabled( true ); + } + GetHeightForWidth( maxTextureSize ); + wrapGap = std::max( maxTextureSize - textNaturalSize.width, 0.0f ); + } + Text::TypesetterPtr typesetter = Text::Typesetter::New( mController->GetTextModel() ); - PixelData data = typesetter->Render( textureSize, Text::Typesetter::RENDER_TEXT_AND_STYLES, true, Pixel::RGBA8888 ); // ignore the horizontal alignment + + PixelData data = typesetter->Render( verifiedSize, Text::Typesetter::RENDER_TEXT_AND_STYLES, true, Pixel::RGBA8888 ); // ignore the horizontal alignment Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, data.GetPixelFormat(), data.GetWidth(), @@ -938,7 +955,7 @@ void TextLabel::SetUpAutoScrolling() // Set parameters for scrolling Renderer renderer = static_cast( GetImplementation( mVisual ) ).GetRenderer(); - mTextScroller->SetParameters( Self(), renderer, textureSet, controlSize, textureSize, wrapGap, direction, mController->GetHorizontalAlignment(), mController->GetVerticalAlignment() ); + mTextScroller->SetParameters( Self(), renderer, textureSet, controlSize, verifiedSize, wrapGap, direction, mController->GetHorizontalAlignment(), mController->GetVerticalAlignment() ); } void TextLabel::ScrollingFinished() diff --git a/dali-toolkit/public-api/controls/text-controls/text-label.h b/dali-toolkit/public-api/controls/text-controls/text-label.h index 6536746..ec6613c 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-label.h +++ b/dali-toolkit/public-api/controls/text-controls/text-label.h @@ -240,6 +240,7 @@ public: * @details Name "autoScrollGap", type Property::INT. * @SINCE_1_1.35 * @note Default in style sheet but can be overridden to prevent same text being shown at start and end. + * @note Displayed gap size is not guaranteed if the text length plus gap exceeds the maximum texture size (i.e. GL_MAX_TEXTURE_SIZE). */ AUTO_SCROLL_GAP,