+ // Filter mode needs to be set to linear to produce better quality while scaling.
+ Sampler sampler = Sampler::New();
+ sampler.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR );
+
+ // Create RGBA texture if the text contains emojis or multiple text colors, otherwise L8 texture
+ Pixel::Format textPixelFormat = ( containsColorGlyph || hasMultipleTextColors ) ? Pixel::RGBA8888 : Pixel::L8;
+
+ // Check the text direction
+ Toolkit::DevelText::TextDirection::Type textDirection = mController->GetTextDirection();
+
+ // Create a texture for the text without any styles
+ PixelData data = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_NO_STYLES, false, textPixelFormat );
+
+ int verifiedWidth = data.GetWidth();
+ int verifiedHeight = data.GetHeight();
+
+ // Set information for creating textures.
+ TilingInfo info( verifiedWidth, maxTextureSize, textPixelFormat );
+
+ // Get the buffer of text.
+ Dali::DevelPixelData::PixelDataBuffer textPixelData = Dali::DevelPixelData::ReleasePixelDataBuffer( data );
+ info.textBuffer = textPixelData.buffer;
+
+ if( styleEnabled )
+ {
+ // Create RGBA texture for all the text styles (without the text itself)
+ PixelData styleData = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_NO_TEXT, false, Pixel::RGBA8888 );
+ Dali::DevelPixelData::PixelDataBuffer stylePixelData = Dali::DevelPixelData::ReleasePixelDataBuffer( styleData );
+ info.styleBuffer = stylePixelData.buffer;
+ }
+
+ if ( containsColorGlyph && !hasMultipleTextColors )
+ {
+ // Create a L8 texture as a mask to avoid color glyphs (e.g. emojis) to be affected by text color animation
+ PixelData maskData = mTypesetter->Render( size, textDirection, Text::Typesetter::RENDER_MASK, false, Pixel::L8 );
+ Dali::DevelPixelData::PixelDataBuffer maskPixelData = Dali::DevelPixelData::ReleasePixelDataBuffer( maskData );
+ info.maskBuffer = maskPixelData.buffer;
+ }
+
+ // Get the current offset for recalculate the offset when tiling.
+ Property::Map retMap;
+ mImpl->mTransform.GetPropertyMap( retMap );
+ Property::Value* offsetValue = retMap.Find( Dali::Toolkit::Visual::Transform::Property::OFFSET );
+ if( offsetValue )
+ {
+ offsetValue->Get( info.offSet );
+ }
+
+ // Create a textureset in the default renderer.
+ CreateTextureSet( info, mImpl->mRenderer, sampler, hasMultipleTextColors, containsColorGlyph, styleEnabled );
+
+ verifiedHeight -= maxTextureSize;