2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/public-api/common/stage.h>
24 #include <dali/public-api/images/frame-buffer-image.h>
25 #include <dali/public-api/render-tasks/render-task.h>
26 #include <dali/public-api/render-tasks/render-task-list.h>
27 #include <dali/devel-api/rendering/renderer.h>
28 #include <dali/devel-api/rendering/geometry.h>
29 #include <dali/devel-api/text-abstraction/font-client.h>
32 #include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
33 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
34 #include <dali-toolkit/internal/text/text-view.h>
37 using namespace Dali::Toolkit;
38 using namespace Dali::Toolkit::Text;
42 #if defined(DEBUG_ENABLED)
43 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
46 const float ZERO( 0.0f );
47 const float HALF( 0.5f );
48 const float ONE( 1.0f );
49 const float TWO( 2.0f );
50 const uint32_t DEFAULT_ATLAS_WIDTH = 512u;
51 const uint32_t DEFAULT_ATLAS_HEIGHT = 512u;
53 struct AtlasRenderer::Impl : public ConnectionTracker
64 : mColor( Color::BLACK ),
71 AtlasManager::Mesh2D mMesh;
72 FrameBufferImage mBuffer;
81 mUnderlinePosition( 0.0f ),
82 mUnderlineThickness( 0.0f ),
90 float mUnderlinePosition;
91 float mUnderlineThickness;
92 uint32_t mMeshRecordIndex;
99 mNeededBlockWidth( 0 ),
100 mNeededBlockHeight( 0 )
105 uint32_t mNeededBlockWidth;
106 uint32_t mNeededBlockHeight;
118 Text::GlyphIndex mIndex;
121 struct TextCacheEntry
131 Text::GlyphIndex mIndex;
138 mGlyphManager = AtlasGlyphManager::Get();
139 mFontClient = TextAbstraction::FontClient::Get();
141 mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
142 mQuadVertexFormat[ "aTexCoord" ] = Property::VECTOR2;
143 mQuadIndexFormat[ "indices" ] = Property::INTEGER;
146 void AddGlyphs( Text::ViewInterface& view,
147 const std::vector<Vector2>& positions,
148 const Vector<GlyphInfo>& glyphs,
151 AtlasManager::AtlasSlot slot;
152 std::vector< MeshRecord > meshContainer;
153 Vector< Extent > extents;
154 TextCacheEntry textCacheEntry;
157 const Vector2& actorSize( view.GetControlSize() );
158 Vector2 halfActorSize( actorSize * 0.5f );
159 const Vector4& textColor( view.GetTextColor() );
160 const Vector2& shadowOffset( view.GetShadowOffset() );
161 const Vector4& shadowColor( view.GetShadowColor() );
162 bool underlineEnabled( view.IsUnderlineEnabled() );
163 const Vector4& underlineColor( view.GetUnderlineColor() );
164 float underlineHeight( view.GetUnderlineHeight() );
166 float currentUnderlinePosition = ZERO;
167 float currentUnderlineThickness = underlineHeight;
168 uint32_t currentBlockSize = 0;
169 FontId lastFontId = 0;
170 Style style = STYLE_NORMAL;
172 if ( fabsf( shadowOffset.x ) > Math::MACHINE_EPSILON_1 || fabsf( shadowOffset.y ) > Math::MACHINE_EPSILON_1 )
174 style = STYLE_DROP_SHADOW;
177 CalculateBlocksSize( glyphs );
179 // Avoid emptying mTextCache (& removing references) until after incremented references for the new text
180 Vector< TextCacheEntry > newTextCache;
181 const GlyphInfo* const glyphsBuffer = glyphs.Begin();
183 for( uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i )
185 const GlyphInfo& glyph = *( glyphsBuffer + i );
187 // No operation for white space
188 if ( glyph.width && glyph.height )
190 // Are we still using the same fontId as previous
191 if ( glyph.fontId != lastFontId )
193 // We need to fetch fresh font underline metrics
194 FontMetrics fontMetrics;
195 mFontClient.GetFontMetrics( glyph.fontId, fontMetrics );
196 currentUnderlinePosition = ceil( fabsf( fontMetrics.underlinePosition ) );
197 const float descender = ceil( fabsf( fontMetrics.descender ) );
199 if ( underlineHeight == ZERO )
201 currentUnderlineThickness = fontMetrics.underlineThickness;
203 // Ensure underline will be at least a pixel high
204 if ( currentUnderlineThickness < ONE )
206 currentUnderlineThickness = ONE;
210 currentUnderlineThickness = ceil( currentUnderlineThickness );
214 // Clamp the underline position at the font descender and check for ( as EFL describes it ) a broken font
215 if ( currentUnderlinePosition > descender )
217 currentUnderlinePosition = descender;
219 if ( ZERO == currentUnderlinePosition )
221 // Move offset down by one ( EFL behavior )
222 currentUnderlinePosition = ONE;
226 if ( !mGlyphManager.Cached( glyph.fontId, glyph.index, slot ) )
228 // Select correct size for new atlas if needed....?
229 if ( lastFontId != glyph.fontId )
231 for ( uint32_t j = 0; j < mBlockSizes.size(); ++j )
233 if ( mBlockSizes[ j ].mFontId == glyph.fontId )
235 currentBlockSize = j;
236 mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH,
237 DEFAULT_ATLAS_HEIGHT,
238 mBlockSizes[ j ].mNeededBlockWidth,
239 mBlockSizes[ j ].mNeededBlockHeight );
244 // Create a new image for the glyph
245 BufferImage bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
248 // Ensure that the next image will fit into the current block size
249 bool setSize = false;
250 if ( bitmap.GetWidth() > mBlockSizes[ currentBlockSize ].mNeededBlockWidth )
253 mBlockSizes[ currentBlockSize ].mNeededBlockWidth = bitmap.GetWidth();
255 if ( bitmap.GetHeight() > mBlockSizes[ currentBlockSize ].mNeededBlockHeight )
258 mBlockSizes[ currentBlockSize ].mNeededBlockHeight = bitmap.GetHeight();
263 mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH,
264 DEFAULT_ATLAS_HEIGHT,
265 mBlockSizes[ currentBlockSize ].mNeededBlockWidth,
266 mBlockSizes[ currentBlockSize ].mNeededBlockHeight );
269 // Locate a new slot for our glyph
270 mGlyphManager.Add( glyph, bitmap, slot );
275 // We have 2+ copies of the same glyph
276 mGlyphManager.AdjustReferenceCount( glyph.fontId, glyph.index, 1/*increment*/ );
279 // Move the origin (0,0) of the mesh to the center of the actor
280 Vector2 position = positions[ i ] - halfActorSize;
282 // Generate mesh data for this quad, plugging in our supplied position
283 AtlasManager::Mesh2D newMesh;
284 mGlyphManager.GenerateMeshData( slot.mImageId, position, newMesh );
285 textCacheEntry.mFontId = glyph.fontId;
286 textCacheEntry.mImageId = slot.mImageId;
287 textCacheEntry.mIndex = glyph.index;
288 newTextCache.PushBack( textCacheEntry );
290 // Find an existing mesh data object to attach to ( or create a new one, if we can't find one using the same atlas)
291 StitchTextMesh( meshContainer,
295 position.y + glyph.yBearing,
296 currentUnderlinePosition,
297 currentUnderlineThickness,
299 lastFontId = glyph.fontId;
303 // Now remove references for the old text
305 mTextCache.Swap( newTextCache );
307 if ( underlineEnabled )
309 // Check to see if any of the text needs an underline
310 GenerateUnderlines( meshContainer, extents, underlineColor, textColor );
313 // For each MeshData object, create a mesh actor and add to the renderable actor
314 if ( meshContainer.size() )
316 for ( std::vector< MeshRecord >::iterator mIt = meshContainer.begin(); mIt != meshContainer.end(); ++mIt )
318 Actor actor = CreateMeshActor( *mIt, actorSize );
320 // Create an effect if necessary
321 if ( style == STYLE_DROP_SHADOW )
323 actor.Add( GenerateShadow( *mIt, actorSize, shadowOffset, shadowColor ) );
336 #if defined(DEBUG_ENABLED)
337 Toolkit::AtlasGlyphManager::Metrics metrics = mGlyphManager.GetMetrics();
338 DALI_LOG_INFO( gLogFilter, Debug::General, "TextAtlasRenderer::GlyphManager::GlyphCount: %i, AtlasCount: %i, TextureMemoryUse: %iK\n",
340 metrics.mAtlasMetrics.mAtlasCount,
341 metrics.mAtlasMetrics.mTextureMemoryUsed / 1024 );
343 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "%s\n", metrics.mVerboseGlyphCounts.c_str() );
345 for ( uint32_t i = 0; i < metrics.mAtlasMetrics.mAtlasCount; ++i )
347 DALI_LOG_INFO( gLogFilter, Debug::Verbose, " Atlas [%i] %sPixels: %s Size: %ix%i, BlockSize: %ix%i, BlocksUsed: %i/%i\n",
348 i + 1, i > 8 ? "" : " ",
349 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mPixelFormat == Pixel::L8 ? "L8 " : "BGRA",
350 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mWidth,
351 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mHeight,
352 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mBlockWidth,
353 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mBlockHeight,
354 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mBlocksUsed,
355 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mTotalBlocks );
362 for ( Vector< TextCacheEntry >::Iterator oldTextIter = mTextCache.Begin(); oldTextIter != mTextCache.End(); ++oldTextIter )
364 mGlyphManager.AdjustReferenceCount( oldTextIter->mFontId, oldTextIter->mIndex, -1/*decrement*/ );
366 mTextCache.Resize( 0 );
369 Actor CreateMeshActor( const MeshRecord& meshRecord, const Vector2& actorSize )
371 PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, meshRecord.mMesh.mVertices.Size() );
372 PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
373 quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ) );
374 quadIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
376 Geometry quadGeometry = Geometry::New();
377 quadGeometry.AddVertexBuffer( quadVertices );
378 quadGeometry.SetIndexBuffer( quadIndices );
380 Material material = mGlyphManager.GetMaterial( meshRecord.mAtlasId );
381 Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
382 renderer.SetDepthIndex( CONTENT_DEPTH_INDEX + mDepth );
383 Actor actor = Actor::New();
384 #if defined(DEBUG_ENABLED)
385 actor.SetName( "Text renderable actor" );
387 actor.AddRenderer( renderer );
388 actor.SetParentOrigin( ParentOrigin::CENTER ); // Keep all of the origins aligned
389 actor.SetSize( actorSize );
390 actor.SetColor( meshRecord.mColor );
394 void StitchTextMesh( std::vector< MeshRecord >& meshContainer,
395 AtlasManager::Mesh2D& newMesh,
396 Vector< Extent >& extents,
397 const Vector4& color,
399 float underlinePosition,
400 float underlineThickness,
401 AtlasManager::AtlasSlot& slot )
405 float left = newMesh.mVertices[ 0 ].mPosition.x;
406 float right = newMesh.mVertices[ 1 ].mPosition.x;
408 // Check to see if there's a mesh data object that references the same atlas ?
410 for ( std::vector< MeshRecord >::iterator mIt = meshContainer.begin(),
411 mEndIt = meshContainer.end();
415 if ( slot.mAtlasId == mIt->mAtlasId && color == mIt->mColor )
417 // Stitch the mesh to the existing mesh and adjust any extents
418 mGlyphManager.StitchMesh( mIt->mMesh, newMesh );
419 AdjustExtents( extents,
426 underlineThickness );
431 // No mesh data object currently exists that references this atlas, so create a new one
432 MeshRecord meshRecord;
433 meshRecord.mAtlasId = slot.mAtlasId;
434 meshRecord.mMesh = newMesh;
435 meshRecord.mColor = color;
436 meshContainer.push_back( meshRecord );
438 // Adjust extents for this new meshrecord
439 AdjustExtents( extents,
441 meshContainer.size() - 1u,
446 underlineThickness );
451 void AdjustExtents( Vector< Extent >& extents,
452 std::vector< MeshRecord>& meshRecords,
457 float underlinePosition,
458 float underlineThickness )
460 bool foundExtent = false;
461 for ( Vector< Extent >::Iterator eIt = extents.Begin(),
462 eEndIt = extents.End();
466 if ( Equals( baseLine, eIt->mBaseLine ) )
469 if ( left < eIt->mLeft )
473 if ( right > eIt->mRight )
478 if ( underlinePosition > eIt->mUnderlinePosition )
480 eIt->mUnderlinePosition = underlinePosition;
482 if ( underlineThickness > eIt->mUnderlineThickness )
484 eIt->mUnderlineThickness = underlineThickness;
492 extent.mRight = right;
493 extent.mBaseLine = baseLine;
494 extent.mUnderlinePosition = underlinePosition;
495 extent.mUnderlineThickness = underlineThickness;
496 extent.mMeshRecordIndex = index;
497 extents.PushBack( extent );
501 void CalculateBlocksSize( const Vector<GlyphInfo>& glyphs )
503 MaxBlockSize maxBlockSize;
504 for ( uint32_t i = 0; i < glyphs.Size(); ++i )
506 FontId fontId = glyphs[ i ].fontId;
507 bool foundFont = false;
508 for ( uint32_t j = 0; j < mBlockSizes.size(); ++j )
510 if ( mBlockSizes[ j ].mFontId == fontId )
517 FontMetrics fontMetrics;
518 mFontClient.GetFontMetrics( fontId, fontMetrics );
519 maxBlockSize.mNeededBlockWidth = static_cast< uint32_t >( fontMetrics.height );
520 maxBlockSize.mNeededBlockHeight = static_cast< uint32_t >( fontMetrics.height );
521 maxBlockSize.mFontId = fontId;
522 mBlockSizes.push_back( maxBlockSize );
527 void GenerateUnderlines( std::vector< MeshRecord >& meshRecords,
528 Vector< Extent >& extents,
529 const Vector4& underlineColor,
530 const Vector4& textColor )
532 AtlasManager::Mesh2D newMesh;
533 unsigned short faceIndex = 0;
534 for ( Vector< Extent >::ConstIterator eIt = extents.Begin(),
535 eEndIt = extents.End();
539 AtlasManager::Vertex2D vert;
540 uint32_t index = eIt->mMeshRecordIndex;
541 Vector2 uv = mGlyphManager.GetAtlasSize( meshRecords[ index ].mAtlasId );
543 // Make sure we don't hit texture edge for single pixel texture ( filled pixel is in top left of every atlas )
544 float u = HALF / uv.x;
545 float v = HALF / uv.y;
546 float thickness = eIt->mUnderlineThickness;
547 float baseLine = eIt->mBaseLine + eIt->mUnderlinePosition - ( thickness * HALF );
548 float tlx = eIt->mLeft;
549 float brx = eIt->mRight;
551 vert.mPosition.x = tlx;
552 vert.mPosition.y = baseLine;
553 vert.mTexCoords.x = ZERO;
554 vert.mTexCoords.y = ZERO;
555 newMesh.mVertices.PushBack( vert );
557 vert.mPosition.x = brx;
558 vert.mPosition.y = baseLine;
559 vert.mTexCoords.x = u;
560 newMesh.mVertices.PushBack( vert );
562 vert.mPosition.x = tlx;
563 vert.mPosition.y = baseLine + thickness;
564 vert.mTexCoords.x = ZERO;
565 vert.mTexCoords.y = v;
566 newMesh.mVertices.PushBack( vert );
568 vert.mPosition.x = brx;
569 vert.mPosition.y = baseLine + thickness;
570 vert.mTexCoords.x = u;
571 newMesh.mVertices.PushBack( vert );
573 // Six indices in counter clockwise winding
574 newMesh.mIndices.PushBack( faceIndex + 1u );
575 newMesh.mIndices.PushBack( faceIndex );
576 newMesh.mIndices.PushBack( faceIndex + 2u );
577 newMesh.mIndices.PushBack( faceIndex + 2u );
578 newMesh.mIndices.PushBack( faceIndex + 3u );
579 newMesh.mIndices.PushBack( faceIndex + 1u );
582 if ( underlineColor == textColor )
584 mGlyphManager.StitchMesh( meshRecords[ index ].mMesh, newMesh );
589 record.mMesh = newMesh;
590 record.mAtlasId = meshRecords[ index ].mAtlasId;
591 record.mColor = underlineColor;
592 meshRecords.push_back( record );
597 Actor GenerateShadow( MeshRecord& meshRecord,
598 const Vector2& actorSize,
599 const Vector2& shadowOffset,
600 const Vector4& shadowColor )
602 // Scan vertex buffer to determine width and height of effect buffer needed
603 const Vector< AtlasManager::Vertex2D >& verts = meshRecord.mMesh.mVertices;
604 float tlx = verts[ 0 ].mPosition.x;
605 float tly = verts[ 0 ].mPosition.y;
609 for ( uint32_t i = 0; i < verts.Size(); ++i )
611 if ( verts[ i ].mPosition.x < tlx )
613 tlx = verts[ i ].mPosition.x;
615 if ( verts[ i ].mPosition.y < tly )
617 tly = verts[ i ].mPosition.y;
619 if ( verts[ i ].mPosition.x > brx )
621 brx = verts[ i ].mPosition.x;
623 if ( verts[ i ].mPosition.y > bry )
625 bry = verts[ i ].mPosition.y;
629 float width = brx - tlx;
630 float height = bry - tly;
631 float divWidth = TWO / width;
632 float divHeight = TWO / height;
634 // Create a buffer to render to
635 meshRecord.mBuffer = FrameBufferImage::New( width, height );
637 // We will render a quad into this buffer
638 unsigned int indices[ 6 ] = { 1, 0, 2, 2, 3, 1 };
639 PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, 4u );
640 PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, sizeof(indices)/sizeof(indices[0]) );
642 AtlasManager::Vertex2D vertices[ 4 ] = {
643 { Vector2( tlx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ZERO, ZERO ) },
644 { Vector2( brx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ONE, ZERO ) },
645 { Vector2( tlx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ZERO, ONE ) },
646 { Vector2( brx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ONE, ONE ) } };
648 quadVertices.SetData( vertices );
649 quadIndices.SetData( indices );
651 Geometry quadGeometry = Geometry::New();
652 quadGeometry.AddVertexBuffer( quadVertices );
653 quadGeometry.SetIndexBuffer( quadIndices );
655 Sampler sampler = Sampler::New( meshRecord.mBuffer, "sTexture" );
656 Material material = Material::New( mGlyphManager.GetEffectBufferShader() );
657 material.AddSampler( sampler );
659 Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
661 // Ensure shadow is behind the text...
662 renderer.SetDepthIndex( CONTENT_DEPTH_INDEX + mDepth - 1 );
663 Actor actor = Actor::New();
664 actor.AddRenderer( renderer );
665 actor.SetParentOrigin( ParentOrigin::CENTER ); // Keep all of the origins aligned
666 actor.SetSize( actorSize );
668 // Create a sub actor to render the source with normalized vertex positions
669 Vector< AtlasManager::Vertex2D > normVertexList;
670 for ( uint32_t i = 0; i < verts.Size(); ++i )
672 AtlasManager::Vertex2D vertex = verts[ i ];
673 vertex.mPosition.x = ( ( vertex.mPosition.x - tlx ) * divWidth ) - ONE;
674 vertex.mPosition.y = ( ( vertex.mPosition.y - tly ) * divHeight ) - ONE;
675 normVertexList.PushBack( vertex );
678 PropertyBuffer normVertices = PropertyBuffer::New( mQuadVertexFormat, normVertexList.Size() );
679 PropertyBuffer normIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
680 normVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &normVertexList[ 0 ] ) );
681 normIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
683 Geometry normGeometry = Geometry::New();
684 normGeometry.AddVertexBuffer( normVertices );
685 normGeometry.SetIndexBuffer( normIndices );
687 Material normMaterial = Material::New( mGlyphManager.GetGlyphShadowShader() );
688 Sampler normSampler = mGlyphManager.GetSampler( meshRecord.mAtlasId );
689 normMaterial.AddSampler( normSampler );
690 Dali::Renderer normRenderer = Dali::Renderer::New( normGeometry, normMaterial );
691 Actor subActor = Actor::New();
692 subActor.AddRenderer( normRenderer );
693 subActor.SetParentOrigin( ParentOrigin::CENTER ); // Keep all of the origins aligned
694 subActor.SetSize( actorSize );
695 subActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
696 subActor.SetColor( shadowColor );
698 // Create a render task to render the effect
699 RenderTask task = Stage::GetCurrent().GetRenderTaskList().CreateTask();
700 task.SetTargetFrameBuffer( meshRecord.mBuffer );
701 task.SetSourceActor( subActor );
702 task.SetClearEnabled( true );
703 task.SetClearColor( Vector4::ZERO );
704 task.SetExclusive( true );
705 task.SetRefreshRate( RenderTask::REFRESH_ONCE );
706 task.FinishedSignal().Connect( this, &AtlasRenderer::Impl::RenderComplete );
707 actor.Add( subActor );
712 void RenderComplete( RenderTask& renderTask )
714 // Disconnect and remove this single shot render task
715 renderTask.FinishedSignal().Disconnect( this, &AtlasRenderer::Impl::RenderComplete );
716 Stage::GetCurrent().GetRenderTaskList().RemoveTask( renderTask );
718 // Get the actor used for render to buffer and remove it from the parent
719 Actor renderActor = renderTask.GetSourceActor();
722 Actor parent = renderActor.GetParent();
725 parent.Remove( renderActor );
730 Actor mActor; ///< The actor parent which renders the text
731 AtlasGlyphManager mGlyphManager; ///< Glyph Manager to handle upload and caching
732 TextAbstraction::FontClient mFontClient; ///> The font client used to supply glyph information
733 std::vector< MaxBlockSize > mBlockSizes; ///> Maximum size needed to contain a glyph in a block within a new atlas
734 std::vector< uint32_t > mFace; ///> Face indices for a quad
735 Vector< TextCacheEntry > mTextCache;
736 Property::Map mQuadVertexFormat;
737 Property::Map mQuadIndexFormat;
741 Text::RendererPtr AtlasRenderer::New()
743 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Text::AtlasRenderer::New()\n" );
745 return Text::RendererPtr( new AtlasRenderer() );
748 Actor AtlasRenderer::Render( Text::ViewInterface& view, int depth )
750 UnparentAndReset( mImpl->mActor );
752 Length numberOfGlyphs = view.GetNumberOfGlyphs();
754 if( numberOfGlyphs > 0u )
756 Vector<GlyphInfo> glyphs;
757 glyphs.Resize( numberOfGlyphs );
759 std::vector<Vector2> positions;
760 positions.resize( numberOfGlyphs );
762 numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
766 glyphs.Resize( numberOfGlyphs );
767 positions.resize( numberOfGlyphs );
769 mImpl->AddGlyphs( view,
775 return mImpl->mActor;
778 AtlasRenderer::AtlasRenderer()
784 AtlasRenderer::~AtlasRenderer()