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/dali.h>
23 #include <dali/devel-api/object/property-buffer.h>
24 #include <dali/devel-api/rendering/geometry.h>
25 #include <dali/devel-api/rendering/renderer.h>
26 #include <dali/devel-api/rendering/sampler.h>
27 #include <dali/devel-api/rendering/shader.h>
28 #include <dali/devel-api/text-abstraction/font-client.h>
29 #include <dali/integration-api/debug.h>
31 #include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
32 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
35 using namespace Dali::Toolkit;
36 using namespace Dali::Toolkit::Text;
40 #if defined(DEBUG_ENABLED)
41 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_RENDERING");
44 const float ZERO( 0.0f );
45 const float HALF( 0.5f );
46 const float ONE( 1.0f );
47 const float TWO( 2.0f );
48 const uint32_t DEFAULT_ATLAS_WIDTH = 512u;
49 const uint32_t DEFAULT_ATLAS_HEIGHT = 512u;
51 struct AtlasRenderer::Impl : public ConnectionTracker
64 AtlasManager::Mesh2D mMesh;
65 FrameBufferImage mBuffer;
74 float mUnderlinePosition;
75 float mUnderlineThickness;
76 uint32_t mMeshRecordIndex;
82 uint32_t mNeededBlockWidth;
83 uint32_t mNeededBlockHeight;
89 Text::GlyphIndex mIndex;
95 Text::GlyphIndex mIndex;
102 mGlyphManager = AtlasGlyphManager::Get();
103 mFontClient = TextAbstraction::FontClient::Get();
105 mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
106 mQuadVertexFormat[ "aTexCoord" ] = Property::VECTOR2;
107 mQuadIndexFormat[ "indices" ] = Property::INTEGER;
110 void AddGlyphs( const std::vector<Vector2>& positions,
111 const Vector<GlyphInfo>& glyphs,
112 const Vector4& textColor,
113 const Vector2& shadowOffset,
114 const Vector4& shadowColor,
115 bool underlineEnabled,
116 const Vector4& underlineColor,
117 float underlineHeight,
120 AtlasManager::AtlasSlot slot;
121 std::vector< MeshRecord > meshContainer;
122 Vector< Extent > extents;
123 TextCacheEntry textCacheEntry;
126 float currentUnderlinePosition = ZERO;
127 float currentUnderlineThickness = underlineHeight;
128 uint32_t currentBlockSize = 0;
129 FontId lastFontId = 0;
130 Style style = STYLE_NORMAL;
132 if ( fabsf( shadowOffset.x ) > Math::MACHINE_EPSILON_1 || fabsf( shadowOffset.y ) > Math::MACHINE_EPSILON_1 )
134 style = STYLE_DROP_SHADOW;
137 if ( mTextCache.Size() )
139 // Update the glyph cache with any changes to current text
140 RemoveText( glyphs );
143 CalculateBlocksSize( glyphs );
145 for( uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i )
147 const GlyphInfo& glyph = glyphs[ i ];
149 // No operation for white space
150 if ( glyph.width && glyph.height )
152 // Are we still using the same fontId as previous
153 if ( glyph.fontId != lastFontId )
155 // We need to fetch fresh font underline metrics
156 FontMetrics fontMetrics;
157 mFontClient.GetFontMetrics( glyph.fontId, fontMetrics );
158 currentUnderlinePosition = ceil( fabsf( fontMetrics.underlinePosition ) );
159 float descender = ceil( fabsf( fontMetrics.descender ) );
161 if ( underlineHeight == ZERO )
163 currentUnderlineThickness = fontMetrics.underlineThickness;
165 // Ensure underline will be at least a pixel high
166 if ( currentUnderlineThickness < ONE )
168 currentUnderlineThickness = ONE;
172 currentUnderlineThickness = ceil( currentUnderlineThickness );
176 // Clamp the underline position at the font descender and check for ( as EFL describes it ) a broken font
177 if ( currentUnderlinePosition > descender )
179 currentUnderlinePosition = descender;
181 if ( ZERO == currentUnderlinePosition )
183 // Move offset down by one ( EFL behavior )
184 currentUnderlinePosition = ONE;
188 const Vector2& position = positions[ i ];
189 AtlasManager::Mesh2D newMesh;
191 if ( !mGlyphManager.Cached( glyph.fontId, glyph.index, slot ) )
193 // Select correct size for new atlas if needed....?
194 if ( lastFontId != glyph.fontId )
196 for ( uint32_t j = 0; j < mBlockSizes.size(); ++j )
198 if ( mBlockSizes[ j ].mFontId == glyph.fontId )
200 currentBlockSize = j;
201 mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH,
202 DEFAULT_ATLAS_HEIGHT,
203 mBlockSizes[ j ].mNeededBlockWidth,
204 mBlockSizes[ j ].mNeededBlockHeight );
209 // Create a new image for the glyph
210 BufferImage bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
213 // Ensure that the next image will fit into the current block size
214 bool setSize = false;
215 if ( bitmap.GetWidth() > mBlockSizes[ currentBlockSize ].mNeededBlockWidth )
218 mBlockSizes[ currentBlockSize ].mNeededBlockWidth = bitmap.GetWidth();
220 if ( bitmap.GetHeight() > mBlockSizes[ currentBlockSize ].mNeededBlockHeight )
223 mBlockSizes[ currentBlockSize ].mNeededBlockHeight = bitmap.GetHeight();
228 mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH,
229 DEFAULT_ATLAS_HEIGHT,
230 mBlockSizes[ currentBlockSize ].mNeededBlockWidth,
231 mBlockSizes[ currentBlockSize ].mNeededBlockHeight );
234 // Locate a new slot for our glyph
235 mGlyphManager.Add( glyph, bitmap, slot );
239 // Generate mesh data for this quad, plugging in our supplied position
240 mGlyphManager.GenerateMeshData( slot.mImageId, position, newMesh );
241 textCacheEntry.mFontId = glyph.fontId;
242 textCacheEntry.mImageId = slot.mImageId;
243 textCacheEntry.mIndex = glyph.index;
244 mTextCache.PushBack( textCacheEntry );
246 // Find an existing mesh data object to attach to ( or create a new one, if we can't find one using the same atlas)
247 StitchTextMesh( meshContainer,
251 position.y + glyph.yBearing,
252 currentUnderlinePosition,
253 currentUnderlineThickness,
255 lastFontId = glyph.fontId;
259 if ( underlineEnabled )
261 // Check to see if any of the text needs an underline
262 GenerateUnderlines( meshContainer, extents, underlineColor, textColor );
265 // For each MeshData object, create a mesh actor and add to the renderable actor
266 if ( meshContainer.size() )
268 for ( std::vector< MeshRecord >::iterator mIt = meshContainer.begin(); mIt != meshContainer.end(); ++mIt )
270 Actor actor = CreateMeshActor( *mIt );
272 // Create an effect if necessary
273 if ( style == STYLE_DROP_SHADOW )
275 actor.Add( GenerateShadow( *mIt, shadowOffset, shadowColor ) );
280 actor.SetParentOrigin( ParentOrigin::CENTER ); // Keep all of the origins aligned
289 #if defined(DEBUG_ENABLED)
290 Toolkit::AtlasGlyphManager::Metrics metrics = mGlyphManager.GetMetrics();
291 DALI_LOG_INFO( gLogFilter, Debug::General, "TextAtlasRenderer::GlyphManager::GlyphCount: %i, AtlasCount: %i, TextureMemoryUse: %iK\n",
293 metrics.mAtlasMetrics.mAtlasCount,
294 metrics.mAtlasMetrics.mTextureMemoryUsed / 1024 );
295 for ( uint32_t i = 0; i < metrics.mAtlasMetrics.mAtlasCount; ++i )
297 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Atlas [%i] %sPixels: %s Size: %ix%i, BlockSize: %ix%i, BlocksUsed: %i/%i\n",
298 i + 1, i > 8 ? "" : " ",
299 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mPixelFormat == Pixel::L8 ? "L8 " : "BGRA",
300 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mWidth,
301 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mHeight,
302 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mBlockWidth,
303 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mBlockHeight,
304 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mBlocksUsed,
305 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mTotalBlocks );
310 Actor CreateMeshActor( const MeshRecord& meshRecord )
312 PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, meshRecord.mMesh.mVertices.Size() );
313 PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
314 quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ) );
315 quadIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
317 Geometry quadGeometry = Geometry::New();
318 quadGeometry.AddVertexBuffer( quadVertices );
319 quadGeometry.SetIndexBuffer( quadIndices );
321 Material material = mGlyphManager.GetMaterial( meshRecord.mAtlasId );
322 Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
323 renderer.SetDepthIndex( CONTENT_DEPTH_INDEX + mDepth );
324 Actor actor = Actor::New();
325 #if defined(DEBUG_ENABLED)
326 actor.SetName( "Text renderable actor" );
328 actor.AddRenderer( renderer );
329 actor.SetSize( 1.0f, 1.0f );
330 actor.SetColor( meshRecord.mColor );
332 if ( meshRecord.mIsUnderline )
334 actor.SetColorMode( USE_OWN_COLOR );
338 actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
343 void StitchTextMesh( std::vector< MeshRecord >& meshContainer,
344 AtlasManager::Mesh2D& newMesh,
345 Vector< Extent >& extents,
346 const Vector4& color,
348 float underlinePosition,
349 float underlineThickness,
350 AtlasManager::AtlasSlot& slot )
354 float left = newMesh.mVertices[ 0 ].mPosition.x;
355 float right = newMesh.mVertices[ 1 ].mPosition.x;
357 // Check to see if there's a mesh data object that references the same atlas ?
359 for ( std::vector< MeshRecord >::iterator mIt = meshContainer.begin(); mIt != meshContainer.end(); ++mIt, ++index )
361 if ( slot.mAtlasId == mIt->mAtlasId && color == mIt->mColor )
363 // Stitch the mesh to the existing mesh and adjust any extents
364 mGlyphManager.StitchMesh( mIt->mMesh, newMesh );
365 AdjustExtents( extents,
372 underlineThickness );
377 // No mesh data object currently exists that references this atlas, so create a new one
378 MeshRecord meshRecord;
379 meshRecord.mAtlasId = slot.mAtlasId;
380 meshRecord.mMesh = newMesh;
381 meshRecord.mColor = color;
382 meshRecord.mIsUnderline = false;
383 meshContainer.push_back( meshRecord );
385 // Adjust extents for this new meshrecord
386 AdjustExtents( extents,
388 meshContainer.size() - 1u,
393 underlineThickness );
398 void AdjustExtents( Vector< Extent >& extents,
399 std::vector< MeshRecord>& meshRecords,
404 float underlinePosition,
405 float underlineThickness )
407 bool foundExtent = false;
408 for ( Vector< Extent >::Iterator eIt = extents.Begin(); eIt != extents.End(); ++eIt )
410 if ( Equals( baseLine, eIt->mBaseLine ) )
413 if ( left < eIt->mLeft )
417 if ( right > eIt->mRight )
422 if ( underlinePosition > eIt->mUnderlinePosition )
424 eIt->mUnderlinePosition = underlinePosition;
426 if ( underlineThickness > eIt->mUnderlineThickness )
428 eIt->mUnderlineThickness = underlineThickness;
436 extent.mRight = right;
437 extent.mBaseLine = baseLine;
438 extent.mUnderlinePosition = underlinePosition;
439 extent.mUnderlineThickness = underlineThickness;
440 extent.mMeshRecordIndex = index;
441 extents.PushBack( extent );
445 void RemoveText( const Vector<GlyphInfo>& glyphs )
447 Vector< CheckEntry > checked;
448 CheckEntry checkEntry;
450 for ( Vector< TextCacheEntry >::Iterator tCit = mTextCache.Begin(); tCit != mTextCache.End(); ++tCit )
452 uint32_t index = tCit->mIndex;
453 uint32_t fontId = tCit->mFontId;
455 // Check that this character has not already been checked...
456 bool wasChecked = false;
457 for ( Vector< CheckEntry >::Iterator cEit = checked.Begin(); cEit != checked.End(); ++cEit )
459 if ( fontId == cEit->mFontId && index == cEit->mIndex )
468 int32_t newCount = 0;
469 int32_t oldCount = 0;
471 // How many times does this character occur in the old text ?
472 for ( Vector< TextCacheEntry >::Iterator oTcit = mTextCache.Begin(); oTcit != mTextCache.End(); ++oTcit )
474 if ( fontId == oTcit->mFontId && index == oTcit->mIndex )
480 // And how many times in the new ?
481 for ( Vector< GlyphInfo >::Iterator cGit = glyphs.Begin(); cGit != glyphs.End(); ++cGit )
483 if ( fontId == cGit->fontId && index == cGit->index )
488 mGlyphManager.AdjustReferenceCount( fontId, tCit->mImageId, newCount - oldCount );
489 checkEntry.mIndex = index;
490 checkEntry.mFontId = fontId;
491 checked.PushBack( checkEntry );
494 mTextCache.Resize( 0 );
497 void CalculateBlocksSize( const Vector<GlyphInfo>& glyphs )
499 MaxBlockSize maxBlockSize;
500 for ( uint32_t i = 0; i < glyphs.Size(); ++i )
502 FontId fontId = glyphs[ i ].fontId;
503 bool foundFont = false;
504 for ( uint32_t j = 0; j < mBlockSizes.size(); ++j )
506 if ( mBlockSizes[ j ].mFontId == fontId )
513 FontMetrics fontMetrics;
514 mFontClient.GetFontMetrics( fontId, fontMetrics );
515 maxBlockSize.mNeededBlockWidth = static_cast< uint32_t >( fontMetrics.height );
516 maxBlockSize.mNeededBlockHeight = static_cast< uint32_t >( fontMetrics.height );
517 maxBlockSize.mFontId = fontId;
518 mBlockSizes.push_back( maxBlockSize );
523 void GenerateUnderlines( std::vector< MeshRecord>& meshRecords,
524 Vector< Extent >& extents,
525 const Vector4& underlineColor,
526 const Vector4& textColor )
528 AtlasManager::Mesh2D newMesh;
529 unsigned short faceIndex = 0;
530 for ( Vector< Extent >::ConstIterator eIt = extents.Begin(); eIt != extents.End(); ++eIt )
532 AtlasManager::Vertex2D vert;
533 uint32_t index = eIt->mMeshRecordIndex;
534 Vector2 uv = mGlyphManager.GetAtlasSize( meshRecords[ index ].mAtlasId );
536 // Make sure we don't hit texture edge for single pixel texture ( filled pixel is in top left of every atlas )
537 float u = HALF / uv.x;
538 float v = HALF / uv.y;
539 float thickness = eIt->mUnderlineThickness;
540 float baseLine = eIt->mBaseLine + eIt->mUnderlinePosition - ( thickness * HALF );
541 float tlx = eIt->mLeft;
542 float brx = eIt->mRight;
544 vert.mPosition.x = tlx;
545 vert.mPosition.y = baseLine;
546 vert.mTexCoords.x = ZERO;
547 vert.mTexCoords.y = ZERO;
548 newMesh.mVertices.PushBack( vert );
550 vert.mPosition.x = brx;
551 vert.mPosition.y = baseLine;
552 vert.mTexCoords.x = u;
553 newMesh.mVertices.PushBack( vert );
555 vert.mPosition.x = tlx;
556 vert.mPosition.y = baseLine + thickness;
557 vert.mTexCoords.x = ZERO;
558 vert.mTexCoords.y = v;
559 newMesh.mVertices.PushBack( vert );
561 vert.mPosition.x = brx;
562 vert.mPosition.y = baseLine + thickness;
563 vert.mTexCoords.x = u;
564 newMesh.mVertices.PushBack( vert );
566 // Six indices in counter clockwise winding
567 newMesh.mIndices.PushBack( faceIndex + 1u );
568 newMesh.mIndices.PushBack( faceIndex );
569 newMesh.mIndices.PushBack( faceIndex + 2u );
570 newMesh.mIndices.PushBack( faceIndex + 2u );
571 newMesh.mIndices.PushBack( faceIndex + 3u );
572 newMesh.mIndices.PushBack( faceIndex + 1u );
575 if ( underlineColor == textColor )
577 mGlyphManager.StitchMesh( meshRecords[ index ].mMesh, newMesh );
582 record.mMesh = newMesh;
583 record.mAtlasId = meshRecords[ index ].mAtlasId;
584 record.mColor = underlineColor;
585 record.mIsUnderline = true;
586 meshRecords.push_back( record );
591 Actor GenerateShadow( MeshRecord& meshRecord,
592 const Vector2& shadowOffset,
593 const Vector4& shadowColor )
595 // Scan vertex buffer to determine width and height of effect buffer needed
596 const Vector< AtlasManager::Vertex2D >& verts = meshRecord.mMesh.mVertices;
597 float tlx = verts[ 0 ].mPosition.x;
598 float tly = verts[ 0 ].mPosition.y;
602 for ( uint32_t i = 0; i < verts.Size(); ++i )
604 if ( verts[ i ].mPosition.x < tlx )
606 tlx = verts[ i ].mPosition.x;
608 if ( verts[ i ].mPosition.y < tly )
610 tly = verts[ i ].mPosition.y;
612 if ( verts[ i ].mPosition.x > brx )
614 brx = verts[ i ].mPosition.x;
616 if ( verts[ i ].mPosition.y > bry )
618 bry = verts[ i ].mPosition.y;
622 float width = brx - tlx;
623 float height = bry - tly;
624 float divWidth = TWO / width;
625 float divHeight = TWO / height;
627 // Create a buffer to render to
628 meshRecord.mBuffer = FrameBufferImage::New( width, height );
630 // We will render a quad into this buffer
631 unsigned int indices[ 6 ] = { 1, 0, 2, 2, 3, 1 };
632 PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, 4u );
633 PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, sizeof(indices)/sizeof(indices[0]) );
635 AtlasManager::Vertex2D vertices[ 4 ] = {
636 { Vector2( tlx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ZERO, ZERO ) },
637 { Vector2( brx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ONE, ZERO ) },
638 { Vector2( tlx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ZERO, ONE ) },
639 { Vector2( brx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ONE, ONE ) } };
641 quadVertices.SetData( vertices );
642 quadIndices.SetData( indices );
644 Geometry quadGeometry = Geometry::New();
645 quadGeometry.AddVertexBuffer( quadVertices );
646 quadGeometry.SetIndexBuffer( quadIndices );
648 Sampler sampler = Sampler::New( meshRecord.mBuffer, "sTexture" );
649 Material material = Material::New( mGlyphManager.GetEffectBufferShader() );
650 material.AddSampler( sampler );
652 Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, material );
654 // Ensure shadow is behind the text...
655 renderer.SetDepthIndex( CONTENT_DEPTH_INDEX + mDepth - 1 );
656 Actor actor = Actor::New();
657 actor.AddRenderer( renderer );
658 actor.SetSize( 1.0f, 1.0f );
660 // Create a sub actor to render the source with normalized vertex positions
661 Vector< AtlasManager::Vertex2D > normVertexList;
662 for ( uint32_t i = 0; i < verts.Size(); ++i )
664 AtlasManager::Vertex2D vertex = verts[ i ];
665 vertex.mPosition.x = ( ( vertex.mPosition.x - tlx ) * divWidth ) - ONE;
666 vertex.mPosition.y = ( ( vertex.mPosition.y - tly ) * divHeight ) - ONE;
667 normVertexList.PushBack( vertex );
670 PropertyBuffer normVertices = PropertyBuffer::New( mQuadVertexFormat, normVertexList.Size() );
671 PropertyBuffer normIndices = PropertyBuffer::New( mQuadIndexFormat, meshRecord.mMesh.mIndices.Size() );
672 normVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &normVertexList[ 0 ] ) );
673 normIndices.SetData( const_cast< unsigned int* >( &meshRecord.mMesh.mIndices[ 0 ] ) );
675 Geometry normGeometry = Geometry::New();
676 normGeometry.AddVertexBuffer( normVertices );
677 normGeometry.SetIndexBuffer( normIndices );
679 Material normMaterial = Material::New( mGlyphManager.GetGlyphShadowShader() );
680 Sampler normSampler = mGlyphManager.GetSampler( meshRecord.mAtlasId );
681 normMaterial.AddSampler( normSampler );
682 Dali::Renderer normRenderer = Dali::Renderer::New( normGeometry, normMaterial );
683 Actor subActor = Actor::New();
684 subActor.AddRenderer( normRenderer );
685 subActor.SetSize( 1.0f, 1.0f );
686 subActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
687 subActor.SetColor( shadowColor );
689 // Create a render task to render the effect
690 RenderTask task = Stage::GetCurrent().GetRenderTaskList().CreateTask();
691 task.SetTargetFrameBuffer( meshRecord.mBuffer );
692 task.SetSourceActor( subActor );
693 task.SetClearEnabled( true );
694 task.SetClearColor( Vector4::ZERO );
695 task.SetExclusive( true );
696 task.SetRefreshRate( RenderTask::REFRESH_ONCE );
697 task.FinishedSignal().Connect( this, &AtlasRenderer::Impl::RenderComplete );
698 actor.Add( subActor );
703 void RenderComplete( RenderTask& renderTask )
705 // Disconnect and remove this single shot render task
706 renderTask.FinishedSignal().Disconnect( this, &AtlasRenderer::Impl::RenderComplete );
707 Stage::GetCurrent().GetRenderTaskList().RemoveTask( renderTask );
709 // Get the actor used for render to buffer and remove it from the parent
710 Actor renderActor = renderTask.GetSourceActor();
713 Actor parent = renderActor.GetParent();
716 parent.Remove( renderActor );
721 Actor mActor; ///< The actor parent which renders the text
722 AtlasGlyphManager mGlyphManager; ///< Glyph Manager to handle upload and caching
723 TextAbstraction::FontClient mFontClient; ///> The font client used to supply glyph information
724 std::vector< MaxBlockSize > mBlockSizes; ///> Maximum size needed to contain a glyph in a block within a new atlas
725 std::vector< uint32_t > mFace; ///> Face indices for a quad
726 Vector< TextCacheEntry > mTextCache;
727 Property::Map mQuadVertexFormat;
728 Property::Map mQuadIndexFormat;
732 Text::RendererPtr AtlasRenderer::New()
734 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Text::AtlasRenderer::New()\n" );
736 return Text::RendererPtr( new AtlasRenderer() );
739 Actor AtlasRenderer::Render( Text::ViewInterface& view, int depth )
741 UnparentAndReset( mImpl->mActor );
743 Length numberOfGlyphs = view.GetNumberOfGlyphs();
745 if( numberOfGlyphs > 0u )
747 Vector<GlyphInfo> glyphs;
748 glyphs.Resize( numberOfGlyphs );
750 std::vector<Vector2> positions;
751 positions.resize( numberOfGlyphs );
753 numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
757 glyphs.Resize( numberOfGlyphs );
758 positions.resize( numberOfGlyphs );
760 mImpl->AddGlyphs( positions,
763 view.GetShadowOffset(),
764 view.GetShadowColor(),
765 view.IsUnderlineEnabled(),
766 view.GetUnderlineColor(),
767 view.GetUnderlineHeight(),
771 return mImpl->mActor;
774 AtlasRenderer::AtlasRenderer()
780 AtlasRenderer::~AtlasRenderer()
782 Vector< GlyphInfo > emptyGlyphs;
783 mImpl->RemoveText( emptyGlyphs );