return GetImplementation(*this).GetGlyphMetrics( array, size, type, horizontal );
}
-void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, GlyphBufferData& data, int outlineWidth )
+void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, GlyphBufferData& data, int outlineWidth )
{
- GetImplementation(*this).CreateBitmap( fontId, glyphIndex, data, outlineWidth );
+ GetImplementation(*this).CreateBitmap( fontId, glyphIndex, softwareItalic, softwareBold, data, outlineWidth );
}
PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )
*
* @note The caller is responsible for deallocating the bitmap data @p data.buffer using delete[].
*
- * @param[in] fontId The identifier of the font.
- * @param[in] glyphIndex The index of a glyph within the specified font.
- * @param[out] data The bitmap data.
- * @param[in] outlineWidth The width of the glyph outline in pixels.
- */
- void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, GlyphBufferData& data, int outlineWidth );
+ * @param[in] fontId The identifier of the font.
+ * @param[in] glyphIndex The index of a glyph within the specified font.
+ * @param[in] softwareItalic Whether glyph needs software support to draw italic style.
+ * @param[in] softwareBold Whether glyph needs software support to draw bold style.
+ * @param[out] data The bitmap data.
+ * @param[in] outlineWidth The width of the glyph outline in pixels.
+ */
+ void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, GlyphBufferData& data, int outlineWidth );
/**
* @brief Create a bitmap representation of a glyph.
xBearing( 0 ),
yBearing( 0 ),
advance( 0 ),
- scaleFactor( 0 )
+ scaleFactor( 0 ),
+ softwareItalic(false),
+ softwareBold(false)
{
}
xBearing( 0 ),
yBearing( 0 ),
advance( 0 ),
- scaleFactor( 0 )
+ scaleFactor( 0 ),
+ softwareItalic(false),
+ softwareBold(false)
{
}
*/
GlyphInfo( FontId font, GlyphIndex i );
- FontId fontId; ///< Identifies the font containing the glyph
- GlyphIndex index; ///< Uniquely identifies a glyph for a given FontId
- float width; ///< The width of the glyph
- float height; ///< The height of the glyph
- float xBearing; ///< The distance from the cursor position to the leftmost border of the glyph
- float yBearing; ///< The distance from the baseline to the topmost border of the glyph
- float advance; ///< The distance to move the cursor for this glyph
- float scaleFactor; ///< The scaling applied (fixed-size fonts only)
+ FontId fontId; ///< Identifies the font containing the glyph
+ GlyphIndex index; ///< Uniquely identifies a glyph for a given FontId
+ float width; ///< The width of the glyph
+ float height; ///< The height of the glyph
+ float xBearing; ///< The distance from the cursor position to the leftmost border of the glyph
+ float yBearing; ///< The distance from the baseline to the topmost border of the glyph
+ float advance; ///< The distance to move the cursor for this glyph
+ float scaleFactor; ///< The scaling applied (fixed-size fonts only)
+ bool softwareItalic; ///< Whether glyph needs software support to draw italic style
+ bool softwareBold; ///< Whether glyph needs software support to draw bold style
};
} // Dali
return mPlugin->GetGlyphMetrics( array, size, type, horizontal );
}
-void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
+void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
{
CreatePlugin();
- mPlugin->CreateBitmap( fontId, glyphIndex, data, outlineWidth );
+ mPlugin->CreateBitmap( fontId, glyphIndex, softwareItalic, softwareBold, data, outlineWidth );
}
PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )
bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, GlyphType type, bool horizontal );
/**
- * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
+ * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
*/
- void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth );
+ void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth );
/**
* @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )
*/
const float FROM_266 = 1.0f / 64.0f;
const float POINTS_PER_INCH = 72.f;
+const FT_Fixed FONT_SLANT_TANGENT = 0.221694663 * 0x10000; // For support software italic
const std::string FONT_FORMAT( "TrueType" );
const std::string DEFAULT_FONT_FAMILY_NAME( "Tizen" );
#endif
}
-void FontClient::Plugin::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
+void FontClient::Plugin::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
{
if( ( fontId > 0 ) &&
( fontId - 1u < mFontFaceCache.size() ) )
if( FT_Err_Ok == error )
{
FT_Glyph glyph;
+
+ if( softwareBold )
+ {
+ FT_GlyphSlot_Embolden(ftFace->glyph);
+ }
+
+ if( softwareItalic )
+ {
+ // FT Matrix uses 16.16 fixed-point format
+ FT_Matrix transform = {0x10000, FONT_SLANT_TANGENT, 0x00000, 0x10000};
+ FT_Outline_Transform(&ftFace->glyph->outline, &transform);
+ }
+
error = FT_Get_Glyph( ftFace->glyph, &glyph );
// Convert to bitmap if necessary
{
TextAbstraction::FontClient::GlyphBufferData data;
- CreateBitmap( fontId, glyphIndex, data, outlineWidth );
+ CreateBitmap( fontId, glyphIndex, false, false, data, outlineWidth );
return PixelData::New( data.buffer,
data.width * data.height * Pixel::GetBytesPerPixel( data.format ),
#include FT_GLYPH_H
#include FT_OUTLINE_H
#include FT_STROKER_H
+#include FT_SYNTHESIS_H
// forward declarations of font config types.
struct _FcCharSet;
bool GetVectorMetrics( GlyphInfo* array, uint32_t size, bool horizontal );
/**
- * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
+ * @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth )
*/
- void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth );
+ void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, bool softwareItalic, bool softwareBold, Dali::TextAbstraction::FontClient::GlyphBufferData& data, int outlineWidth );
/**
* @copydoc Dali::TextAbstraction::FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, int outlineWidth )