}
else
{
+ // Whether the given glyph is a color one.
+ const bool isColorGlyph = Pixel::BGRA8888 == data.glyphBitmap.format;
+
// Initial vertical offset.
const int yOffset = data.verticalOffset + position->y;
uint8_t* bitmapBuffer = reinterpret_cast< uint8_t* >( data.bitmapBuffer.GetBuffer() );
- // Update the alpha channel.
- const uint8_t alpha = *( data.glyphBitmap.buffer + glyphBufferOffset + index );
-
- // Copy non-transparent pixels only
- if ( alpha > 0u )
+ if ( !isColorGlyph )
{
- // Check alpha of overlapped pixels
- uint8_t& currentAlpha = *( bitmapBuffer + verticalOffset + xOffsetIndex );
- uint8_t newAlpha = static_cast<uint8_t>( color->a * static_cast<float>( alpha ) );
-
- // For any pixel overlapped with the pixel in previous glyphs, make sure we don't
- // overwrite a previous bigger alpha with a smaller alpha (in order to avoid
- // semi-transparent gaps between joint glyphs with overlapped pixels, which could
- // happen, for example, in the RTL text when we copy glyphs from right to left).
- *( bitmapBuffer + verticalOffset + xOffsetIndex ) = std::max( currentAlpha, newAlpha );
+ // Update the alpha channel.
+ const uint8_t alpha = *( data.glyphBitmap.buffer + glyphBufferOffset + index );
+
+ // Copy non-transparent pixels only
+ if ( alpha > 0u )
+ {
+ // Check alpha of overlapped pixels
+ uint8_t& currentAlpha = *( bitmapBuffer + verticalOffset + xOffsetIndex );
+ uint8_t newAlpha = static_cast<uint8_t>( color->a * static_cast<float>( alpha ) );
+
+ // For any pixel overlapped with the pixel in previous glyphs, make sure we don't
+ // overwrite a previous bigger alpha with a smaller alpha (in order to avoid
+ // semi-transparent gaps between joint glyphs with overlapped pixels, which could
+ // happen, for example, in the RTL text when we copy glyphs from right to left).
+ *( bitmapBuffer + verticalOffset + xOffsetIndex ) = std::max( currentAlpha, newAlpha );
+ }
}
}
}
switch( mModel->GetVerticalAlignment() )
{
- case Layout::VERTICAL_ALIGN_TOP:
+ case VerticalAlignment::TOP:
{
// No offset to add.
break;
}
- case Layout::VERTICAL_ALIGN_CENTER:
+ case VerticalAlignment::CENTER:
{
penY = static_cast<int>( 0.5f * ( size.height - layoutSize.height ) );
break;
}
- case Layout::VERTICAL_ALIGN_BOTTOM:
+ case VerticalAlignment::BOTTOM:
{
penY = static_cast<int>( size.height - layoutSize.height );
break;
// 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 );
}
// 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 )
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;
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;