2 * Copyright (c) 2016 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/public-api/rendering/geometry.h>
23 #include <dali/public-api/rendering/renderer.h>
24 #include <dali/public-api/images/frame-buffer-image.h>
25 #include <dali/devel-api/text-abstraction/font-client.h>
26 #include <dali/integration-api/debug.h>
29 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
30 #include <dali-toolkit/internal/text/glyph-run.h>
31 #include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
32 #include <dali-toolkit/internal/text/rendering/atlas/atlas-mesh-factory.h>
33 #include <dali-toolkit/internal/text/text-view.h>
36 using namespace Dali::Toolkit;
37 using namespace Dali::Toolkit::Text;
41 #if defined(DEBUG_ENABLED)
42 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_RENDERING");
45 const float ZERO( 0.0f );
46 const float HALF( 0.5f );
47 const float ONE( 1.0f );
48 const uint32_t DEFAULT_ATLAS_WIDTH = 512u;
49 const uint32_t DEFAULT_ATLAS_HEIGHT = 512u;
52 struct AtlasRenderer::Impl
68 AtlasManager::Mesh2D mMesh;
69 FrameBufferImage mBuffer;
73 * brief Struct used to generate the underline mesh.
74 * There is one Extent per line of text.
82 mUnderlinePosition( 0.0f ),
83 mUnderlineThickness( 0.0f ),
84 mMeshRecordIndex( 0u )
91 float mUnderlinePosition;
92 float mUnderlineThickness;
93 uint32_t mMeshRecordIndex;
100 mNeededBlockWidth( 0 ),
101 mNeededBlockHeight( 0 )
106 uint32_t mNeededBlockWidth;
107 uint32_t mNeededBlockHeight;
119 Text::GlyphIndex mIndex;
122 struct TextCacheEntry
132 Text::GlyphIndex mIndex;
139 mGlyphManager = AtlasGlyphManager::Get();
140 mFontClient = TextAbstraction::FontClient::Get();
142 mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
143 mQuadVertexFormat[ "aTexCoord" ] = Property::VECTOR2;
144 mQuadVertexFormat[ "aColor" ] = Property::VECTOR4;
147 bool IsGlyphUnderlined( GlyphIndex index,
148 const Vector<GlyphRun>& underlineRuns )
150 for( Vector<GlyphRun>::ConstIterator it = underlineRuns.Begin(),
151 endIt = underlineRuns.End();
155 const GlyphRun& run = *it;
157 if( ( run.glyphIndex <= index ) && ( index < run.glyphIndex + run.numberOfGlyphs ) )
166 void AddGlyphs( Text::ViewInterface& view,
167 const Vector<Vector2>& positions,
168 const Vector<GlyphInfo>& glyphs,
169 const Vector4& defaultColor,
170 const Vector4* const colorsBuffer,
171 const ColorIndex* const colorIndicesBuffer,
173 float minLineOffset )
175 AtlasManager::AtlasSlot slot;
176 std::vector< MeshRecord > meshContainer;
177 Vector< Extent > extents;
178 TextCacheEntry textCacheEntry;
181 const Vector2& textSize( view.GetLayoutSize() );
182 const Vector2 halfTextSize( textSize * 0.5f );
183 const Vector2& shadowOffset( view.GetShadowOffset() );
184 const Vector4& shadowColor( view.GetShadowColor() );
185 const bool underlineEnabled( view.IsUnderlineEnabled() );
186 const Vector4& underlineColor( view.GetUnderlineColor() );
187 const float underlineHeight( view.GetUnderlineHeight() );
189 const bool useDefaultColor = ( NULL == colorsBuffer );
191 // Get the underline runs.
192 const Length numberOfUnderlineRuns = view.GetNumberOfUnderlineRuns();
193 Vector<GlyphRun> underlineRuns;
194 underlineRuns.Resize( numberOfUnderlineRuns );
195 view.GetUnderlineRuns( underlineRuns.Begin(),
197 numberOfUnderlineRuns );
199 bool thereAreUnderlinedGlyphs = false;
201 float currentUnderlinePosition = ZERO;
202 float currentUnderlineThickness = underlineHeight;
203 uint32_t currentBlockSize = 0;
204 FontId lastFontId = 0;
205 FontId lastUnderlinedFontId = 0;
206 Style style = STYLE_NORMAL;
208 if ( fabsf( shadowOffset.x ) > Math::MACHINE_EPSILON_1 || fabsf( shadowOffset.y ) > Math::MACHINE_EPSILON_1 )
210 style = STYLE_DROP_SHADOW;
213 CalculateBlocksSize( glyphs );
215 // Avoid emptying mTextCache (& removing references) until after incremented references for the new text
216 Vector< TextCacheEntry > newTextCache;
217 const GlyphInfo* const glyphsBuffer = glyphs.Begin();
218 const Vector2* const positionsBuffer = positions.Begin();
219 const Vector2 lineOffsetPosition( minLineOffset, 0.f );
221 for( uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i )
223 const GlyphInfo& glyph = *( glyphsBuffer + i );
224 const bool underlineGlyph = underlineEnabled || IsGlyphUnderlined( i, underlineRuns );
225 thereAreUnderlinedGlyphs = thereAreUnderlinedGlyphs || underlineGlyph;
227 // No operation for white space
228 if( glyph.width && glyph.height )
230 // Are we still using the same fontId as previous
231 if( underlineGlyph && ( glyph.fontId != lastUnderlinedFontId ) )
233 // We need to fetch fresh font underline metrics
234 FontMetrics fontMetrics;
235 mFontClient.GetFontMetrics( glyph.fontId, fontMetrics );
236 currentUnderlinePosition = ceil( fabsf( fontMetrics.underlinePosition ) );
237 const float descender = ceil( fabsf( fontMetrics.descender ) );
239 if( fabsf( underlineHeight ) < Math::MACHINE_EPSILON_1000 )
241 currentUnderlineThickness = fontMetrics.underlineThickness;
243 // Ensure underline will be at least a pixel high
244 if ( currentUnderlineThickness < ONE )
246 currentUnderlineThickness = ONE;
250 currentUnderlineThickness = ceil( currentUnderlineThickness );
254 // Clamp the underline position at the font descender and check for ( as EFL describes it ) a broken font
255 if( currentUnderlinePosition > descender )
257 currentUnderlinePosition = descender;
260 if( fabsf( currentUnderlinePosition ) < Math::MACHINE_EPSILON_1000 )
262 // Move offset down by one ( EFL behavior )
263 currentUnderlinePosition = ONE;
266 lastUnderlinedFontId = glyph.fontId;
269 if( !mGlyphManager.IsCached( glyph.fontId, glyph.index, slot ) )
271 // Select correct size for new atlas if needed....?
272 if( lastFontId != glyph.fontId )
275 for( std::vector<MaxBlockSize>::const_iterator it = mBlockSizes.begin(),
276 endIt = mBlockSizes.end();
280 const MaxBlockSize& blockSize = *it;
281 if( blockSize.mFontId == glyph.fontId )
283 currentBlockSize = index;
284 mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH,
285 DEFAULT_ATLAS_HEIGHT,
286 blockSize.mNeededBlockWidth,
287 blockSize.mNeededBlockHeight );
292 // Create a new image for the glyph
293 PixelData bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
296 MaxBlockSize& blockSize = mBlockSizes[currentBlockSize];
298 // Ensure that the next image will fit into the current block size
299 bool setSize = false;
300 if( bitmap.GetWidth() > blockSize.mNeededBlockWidth )
303 blockSize.mNeededBlockWidth = bitmap.GetWidth();
305 if( bitmap.GetHeight() > blockSize.mNeededBlockHeight )
308 blockSize.mNeededBlockHeight = bitmap.GetHeight();
313 mGlyphManager.SetNewAtlasSize( DEFAULT_ATLAS_WIDTH,
314 DEFAULT_ATLAS_HEIGHT,
315 blockSize.mNeededBlockWidth,
316 blockSize.mNeededBlockHeight );
319 // Locate a new slot for our glyph
320 mGlyphManager.Add( glyph, bitmap, slot );
325 // We have 2+ copies of the same glyph
326 mGlyphManager.AdjustReferenceCount( glyph.fontId, glyph.index, 1/*increment*/ );
329 // Move the origin (0,0) of the mesh to the center of the actor
330 const Vector2 position = *( positionsBuffer + i ) - halfTextSize - lineOffsetPosition;
332 // Generate mesh data for this quad, plugging in our supplied position
333 AtlasManager::Mesh2D newMesh;
334 mGlyphManager.GenerateMeshData( slot.mImageId, position, newMesh );
335 textCacheEntry.mFontId = glyph.fontId;
336 textCacheEntry.mImageId = slot.mImageId;
337 textCacheEntry.mIndex = glyph.index;
338 newTextCache.PushBack( textCacheEntry );
340 AtlasManager::Vertex2D* verticesBuffer = newMesh.mVertices.Begin();
342 // Adjust the vertices if the fixed-size font should be down-scaled
343 if( glyph.scaleFactor > 0 )
345 for( unsigned int index = 0u, size = newMesh.mVertices.Count();
349 AtlasManager::Vertex2D& vertex = *( verticesBuffer + index );
351 // Set the position of the vertex.
352 vertex.mPosition.x = position.x + ( ( vertex.mPosition.x - position.x ) * glyph.scaleFactor );
353 vertex.mPosition.y = position.y + ( ( vertex.mPosition.y - position.y ) * glyph.scaleFactor );
357 // Get the color of the character.
358 const ColorIndex colorIndex = useDefaultColor ? 0u : *( colorIndicesBuffer + i );
359 const Vector4& color = ( useDefaultColor || ( 0u == colorIndex ) ) ? defaultColor : *( colorsBuffer + colorIndex - 1u );
361 for( unsigned int index = 0u, size = newMesh.mVertices.Count();
365 AtlasManager::Vertex2D& vertex = *( verticesBuffer + index );
367 // Set the color of the vertex.
368 vertex.mColor = color;
371 // Find an existing mesh data object to attach to ( or create a new one, if we can't find one using the same atlas)
372 StitchTextMesh( meshContainer,
375 position.y + glyph.yBearing,
377 currentUnderlinePosition,
378 currentUnderlineThickness,
380 lastFontId = glyph.fontId;
384 // Now remove references for the old text
386 mTextCache.Swap( newTextCache );
388 if( thereAreUnderlinedGlyphs )
390 // Check to see if any of the text needs an underline
391 GenerateUnderlines( meshContainer, extents, underlineColor );
394 // For each MeshData object, create a mesh actor and add to the renderable actor
395 if( !meshContainer.empty() )
399 // Create a container actor to act as a common parent for text and shadow, to avoid color inheritence issues.
400 mActor = Actor::New();
401 mActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
402 mActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
403 mActor.SetSize( textSize );
406 for( std::vector< MeshRecord >::iterator it = meshContainer.begin(),
407 endIt = meshContainer.end();
410 MeshRecord& meshRecord = *it;
412 Actor actor = CreateMeshActor( meshRecord, textSize );
414 // Whether the actor has renderers.
415 const bool hasRenderer = actor.GetRendererCount() > 0u;
417 // Create an effect if necessary
419 ( style == STYLE_DROP_SHADOW ) )
421 // Change the color of the vertices.
422 for( Vector<AtlasManager::Vertex2D>::Iterator vIt = meshRecord.mMesh.mVertices.Begin(),
423 vEndIt = meshRecord.mMesh.mVertices.End();
427 AtlasManager::Vertex2D& vertex = *vIt;
429 vertex.mColor = shadowColor;
432 Actor shadowActor = CreateMeshActor( meshRecord, textSize );
433 #if defined(DEBUG_ENABLED)
434 shadowActor.SetName( "Text Shadow renderable actor" );
436 // Offset shadow in x and y
437 shadowActor.RegisterProperty("uOffset", shadowOffset );
438 Dali::Renderer renderer( shadowActor.GetRendererAt( 0 ) );
439 int depthIndex = renderer.GetProperty<int>(Dali::Renderer::Property::DEPTH_INDEX);
440 renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, depthIndex - 1 );
441 mActor.Add( shadowActor );
450 #if defined(DEBUG_ENABLED)
451 Toolkit::AtlasGlyphManager::Metrics metrics = mGlyphManager.GetMetrics();
452 DALI_LOG_INFO( gLogFilter, Debug::General, "TextAtlasRenderer::GlyphManager::GlyphCount: %i, AtlasCount: %i, TextureMemoryUse: %iK\n",
454 metrics.mAtlasMetrics.mAtlasCount,
455 metrics.mAtlasMetrics.mTextureMemoryUsed / 1024 );
457 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "%s\n", metrics.mVerboseGlyphCounts.c_str() );
459 for( uint32_t i = 0; i < metrics.mAtlasMetrics.mAtlasCount; ++i )
461 DALI_LOG_INFO( gLogFilter, Debug::Verbose, " Atlas [%i] %sPixels: %s Size: %ix%i, BlockSize: %ix%i, BlocksUsed: %i/%i\n",
462 i + 1, i > 8 ? "" : " ",
463 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mPixelFormat == Pixel::L8 ? "L8 " : "BGRA",
464 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mWidth,
465 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mHeight,
466 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mBlockWidth,
467 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mSize.mBlockHeight,
468 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mBlocksUsed,
469 metrics.mAtlasMetrics.mAtlasMetrics[ i ].mTotalBlocks );
476 for( Vector< TextCacheEntry >::Iterator oldTextIter = mTextCache.Begin(); oldTextIter != mTextCache.End(); ++oldTextIter )
478 mGlyphManager.AdjustReferenceCount( oldTextIter->mFontId, oldTextIter->mIndex, -1/*decrement*/ );
480 mTextCache.Resize( 0 );
483 Actor CreateMeshActor( const MeshRecord& meshRecord, const Vector2& actorSize )
485 PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat );
486 quadVertices.SetData( const_cast< AtlasManager::Vertex2D* >( &meshRecord.mMesh.mVertices[ 0 ] ), meshRecord.mMesh.mVertices.Size() );
488 Geometry quadGeometry = Geometry::New();
489 quadGeometry.AddVertexBuffer( quadVertices );
490 quadGeometry.SetIndexBuffer( &meshRecord.mMesh.mIndices[0], meshRecord.mMesh.mIndices.Size() );
492 TextureSet textureSet( mGlyphManager.GetTextures( meshRecord.mAtlasId ) );
493 Shader shader( mGlyphManager.GetShader( meshRecord.mAtlasId ) );
494 Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, shader );
495 renderer.SetTextures( textureSet );
496 renderer.SetProperty( Dali::Renderer::Property::BLEND_MODE, BlendMode::ON );
497 renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT + mDepth );
498 Actor actor = Actor::New();
499 #if defined(DEBUG_ENABLED)
500 actor.SetName( "Text renderable actor" );
502 actor.AddRenderer( renderer );
504 // Keep all of the origins aligned
505 actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
506 actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
507 actor.SetSize( actorSize );
508 actor.RegisterProperty("uOffset", Vector2::ZERO );
512 void StitchTextMesh( std::vector< MeshRecord >& meshContainer,
513 AtlasManager::Mesh2D& newMesh,
514 Vector< Extent >& extents,
517 float underlinePosition,
518 float underlineThickness,
519 AtlasManager::AtlasSlot& slot )
523 float left = newMesh.mVertices[ 0 ].mPosition.x;
524 float right = newMesh.mVertices[ 1 ].mPosition.x;
526 // Check to see if there's a mesh data object that references the same atlas ?
528 for ( std::vector< MeshRecord >::iterator mIt = meshContainer.begin(),
529 mEndIt = meshContainer.end();
533 if( slot.mAtlasId == mIt->mAtlasId )
535 // Append the mesh to the existing mesh and adjust any extents
536 Toolkit::Internal::AtlasMeshFactory::AppendMesh( mIt->mMesh, newMesh );
540 AdjustExtents( extents,
547 underlineThickness );
554 // No mesh data object currently exists that references this atlas, so create a new one
555 MeshRecord meshRecord;
556 meshRecord.mAtlasId = slot.mAtlasId;
557 meshRecord.mMesh = newMesh;
558 meshContainer.push_back( meshRecord );
562 // Adjust extents for this new meshrecord
563 AdjustExtents( extents,
565 meshContainer.size() - 1u,
570 underlineThickness );
575 void AdjustExtents( Vector< Extent >& extents,
576 std::vector< MeshRecord>& meshRecords,
581 float underlinePosition,
582 float underlineThickness )
584 bool foundExtent = false;
585 for ( Vector< Extent >::Iterator eIt = extents.Begin(),
586 eEndIt = extents.End();
590 if ( Equals( baseLine, eIt->mBaseLine ) )
593 if ( left < eIt->mLeft )
597 if ( right > eIt->mRight )
602 if ( underlinePosition > eIt->mUnderlinePosition )
604 eIt->mUnderlinePosition = underlinePosition;
606 if ( underlineThickness > eIt->mUnderlineThickness )
608 eIt->mUnderlineThickness = underlineThickness;
616 extent.mRight = right;
617 extent.mBaseLine = baseLine;
618 extent.mUnderlinePosition = underlinePosition;
619 extent.mUnderlineThickness = underlineThickness;
620 extent.mMeshRecordIndex = index;
621 extents.PushBack( extent );
625 void CalculateBlocksSize( const Vector<GlyphInfo>& glyphs )
627 for( Vector<GlyphInfo>::ConstIterator glyphIt = glyphs.Begin(),
628 glyphEndIt = glyphs.End();
629 glyphIt != glyphEndIt;
632 const FontId fontId = (*glyphIt).fontId;
633 bool foundFont = false;
635 for( std::vector< MaxBlockSize >::const_iterator blockIt = mBlockSizes.begin(),
636 blockEndIt = mBlockSizes.end();
637 blockIt != blockEndIt;
640 if( (*blockIt).mFontId == fontId )
649 FontMetrics fontMetrics;
650 mFontClient.GetFontMetrics( fontId, fontMetrics );
652 MaxBlockSize maxBlockSize;
653 maxBlockSize.mNeededBlockWidth = static_cast< uint32_t >( fontMetrics.height );
654 maxBlockSize.mNeededBlockHeight = maxBlockSize.mNeededBlockWidth;
655 maxBlockSize.mFontId = fontId;
657 mBlockSizes.push_back( maxBlockSize );
662 void GenerateUnderlines( std::vector< MeshRecord >& meshRecords,
663 Vector< Extent >& extents,
664 const Vector4& underlineColor )
666 AtlasManager::Mesh2D newMesh;
667 unsigned short faceIndex = 0;
668 for ( Vector< Extent >::ConstIterator eIt = extents.Begin(),
669 eEndIt = extents.End();
673 AtlasManager::Vertex2D vert;
674 uint32_t index = eIt->mMeshRecordIndex;
675 Vector2 uv = mGlyphManager.GetAtlasSize( meshRecords[ index ].mAtlasId );
677 // Make sure we don't hit texture edge for single pixel texture ( filled pixel is in top left of every atlas )
678 float u = HALF / uv.x;
679 float v = HALF / uv.y;
680 float thickness = eIt->mUnderlineThickness;
681 float baseLine = eIt->mBaseLine + eIt->mUnderlinePosition - ( thickness * HALF );
682 float tlx = eIt->mLeft;
683 float brx = eIt->mRight;
685 vert.mPosition.x = tlx;
686 vert.mPosition.y = baseLine;
687 vert.mTexCoords.x = ZERO;
688 vert.mTexCoords.y = ZERO;
689 vert.mColor = underlineColor;
690 newMesh.mVertices.PushBack( vert );
692 vert.mPosition.x = brx;
693 vert.mPosition.y = baseLine;
694 vert.mTexCoords.x = u;
695 vert.mColor = underlineColor;
696 newMesh.mVertices.PushBack( vert );
698 vert.mPosition.x = tlx;
699 vert.mPosition.y = baseLine + thickness;
700 vert.mTexCoords.x = ZERO;
701 vert.mTexCoords.y = v;
702 vert.mColor = underlineColor;
703 newMesh.mVertices.PushBack( vert );
705 vert.mPosition.x = brx;
706 vert.mPosition.y = baseLine + thickness;
707 vert.mTexCoords.x = u;
708 vert.mColor = underlineColor;
709 newMesh.mVertices.PushBack( vert );
711 // Six indices in counter clockwise winding
712 newMesh.mIndices.PushBack( faceIndex + 1u );
713 newMesh.mIndices.PushBack( faceIndex );
714 newMesh.mIndices.PushBack( faceIndex + 2u );
715 newMesh.mIndices.PushBack( faceIndex + 2u );
716 newMesh.mIndices.PushBack( faceIndex + 3u );
717 newMesh.mIndices.PushBack( faceIndex + 1u );
720 Toolkit::Internal::AtlasMeshFactory::AppendMesh( meshRecords[ index ].mMesh, newMesh );
724 Actor mActor; ///< The actor parent which renders the text
725 AtlasGlyphManager mGlyphManager; ///< Glyph Manager to handle upload and caching
726 TextAbstraction::FontClient mFontClient; ///> The font client used to supply glyph information
727 std::vector< MaxBlockSize > mBlockSizes; ///> Maximum size needed to contain a glyph in a block within a new atlas
728 Vector< TextCacheEntry > mTextCache; ///> Caches data from previous render
729 Property::Map mQuadVertexFormat; ///> Describes the vertex format for text
730 int mDepth; ///> DepthIndex passed by control when connect to stage
733 Text::RendererPtr AtlasRenderer::New()
735 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Text::AtlasRenderer::New()\n" );
737 return Text::RendererPtr( new AtlasRenderer() );
740 Actor AtlasRenderer::Render( Text::ViewInterface& view,
741 float& alignmentOffset,
744 DALI_LOG_INFO( gLogFilter, Debug::General, "Text::AtlasRenderer::Render()\n" );
746 UnparentAndReset( mImpl->mActor );
748 Length numberOfGlyphs = view.GetNumberOfGlyphs();
750 if( numberOfGlyphs > 0u )
752 Vector<GlyphInfo> glyphs;
753 glyphs.Resize( numberOfGlyphs );
755 Vector<Vector2> positions;
756 positions.Resize( numberOfGlyphs );
758 numberOfGlyphs = view.GetGlyphs( glyphs.Begin(),
764 glyphs.Resize( numberOfGlyphs );
765 positions.Resize( numberOfGlyphs );
767 const Vector4* const colorsBuffer = view.GetColors();
768 const ColorIndex* const colorIndicesBuffer = view.GetColorIndices();
769 const Vector4& defaultColor = view.GetTextColor();
771 mImpl->AddGlyphs( view,
780 /* In the case where AddGlyphs does not create a renderable Actor for example when glyphs are all whitespace create a new Actor. */
781 /* This renderable actor is used to position the text, other "decorations" can rely on there always being an Actor regardless of it is whitespace or regular text. */
782 if ( !mImpl->mActor )
784 mImpl->mActor = Actor::New();
788 return mImpl->mActor;
791 AtlasRenderer::AtlasRenderer()
797 AtlasRenderer::~AtlasRenderer()