Fixed the appearance of a bold text when setting underline property.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / rendering / text-typesetter.cpp
index 3184d4a..dcd803c 100755 (executable)
@@ -353,6 +353,14 @@ PixelData Typesetter::Render( const Vector2& size, RenderBehaviour behaviour, bo
       // Create the image buffer for shadow
       Devel::PixelBuffer shadowImageBuffer = CreateImageBuffer( bufferWidth, bufferHeight, Typesetter::STYLE_SHADOW, ignoreHorizontalAlignment, pixelFormat, penY, 0u, numberOfGlyphs - 1 );
 
+      // Check whether it will be a soft shadow
+      const float& blurRadius = mModel->GetShadowBlurRadius();
+
+      if ( blurRadius > Math::MACHINE_EPSILON_1 )
+      {
+        shadowImageBuffer.ApplyGaussianBlur( blurRadius );
+      }
+
       // Combine the two buffers
       imageBuffer = CombineImageBuffer( imageBuffer, shadowImageBuffer, bufferWidth, bufferHeight );
     }
@@ -582,11 +590,14 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer( const unsigned int bufferWidth
         // Don't render outline for other styles
         outlineWidth = 0.0f;
       }
+      if( style != Typesetter::STYLE_UNDERLINE )
+      {
+        fontClient.CreateBitmap( glyphInfo->fontId,
+                                 glyphInfo->index,
+                                 glyphData.glyphBitmap,
+                                 outlineWidth );
+      }
 
-      fontClient.CreateBitmap( glyphInfo->fontId,
-                               glyphInfo->index,
-                               glyphData.glyphBitmap,
-                               outlineWidth );
 
       // Sets the glyph's bitmap into the bitmap of the whole text.
       if( NULL != glyphData.glyphBitmap.buffer )
@@ -609,7 +620,7 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer( const unsigned int bufferWidth
 
       for( unsigned int y = underlineYOffset; y < underlineYOffset + maxUnderlineThickness; y++ )
       {
-        if( ( y < 0 ) || ( y > bufferHeight - 1 ) )
+        if( y > bufferHeight - 1 )
         {
           // Do not write out of bounds.
           break;
@@ -617,7 +628,7 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer( const unsigned int bufferWidth
 
         for( unsigned int x = glyphData.horizontalOffset + lineExtentLeft; x <= glyphData.horizontalOffset + lineExtentRight; x++ )
         {
-          if( ( x < 0 ) || ( x > bufferWidth - 1 ) )
+          if( x > bufferWidth - 1 )
           {
             // Do not write out of bounds.
             break;