if( FT_Err_Ok == error )
{
- array[i].width = ftFace->glyph->metrics.width;
- array[i].height = ftFace->glyph->metrics.height;
+ array[i].width = static_cast< float >( ftFace->glyph->metrics.width ) * FROM_266;
+ array[i].height = static_cast< float >( ftFace->glyph->metrics.height ) * FROM_266 ;
if( horizontal )
{
- array[i].xBearing = ftFace->glyph->metrics.horiBearingX;
- array[i].yBearing = ftFace->glyph->metrics.horiBearingY;
- array[i].advance = ftFace->glyph->metrics.horiAdvance;
+ array[i].xBearing = static_cast< float >( ftFace->glyph->metrics.horiBearingX ) * FROM_266;
+ array[i].yBearing = static_cast< float >( ftFace->glyph->metrics.horiBearingY ) * FROM_266;
+ array[i].advance = static_cast< float >( ftFace->glyph->metrics.horiAdvance ) * FROM_266;
}
else
{
- array[i].xBearing = ftFace->glyph->metrics.vertBearingX;
- array[i].yBearing = ftFace->glyph->metrics.vertBearingY;
- array[i].advance = ftFace->glyph->metrics.vertAdvance;
+ array[i].xBearing = static_cast< float >( ftFace->glyph->metrics.vertBearingX ) * FROM_266;
+ array[i].yBearing = static_cast< float >( ftFace->glyph->metrics.vertBearingY ) * FROM_266;
+ array[i].advance = static_cast< float >( ftFace->glyph->metrics.vertAdvance ) * FROM_266;
}
}
else
{
/**
+ * Conversion from Fractional26.6 to float
+ */
+namespace
+{
+ const float FROM_266 = 1.0f / 64.0f;
+}
+
+/**
* Implementation of the FontClient
*/
class FontClient : public Dali::BaseObject
/**
* The information describing a glyph (font ID, index, metrics)
- * The metrics are expressed in 26.6 fractional pixel format.
+ * The metrics have been converted from Fractional26.6 to floats.
*/
struct GlyphInfo
{
FontId fontId; ///< Identifies the font containing the glyph
GlyphIndex index; ///< Uniquely identifies a glyph for a given FontId
- uint32_t width; ///< The width of the glyph
- uint32_t height; ///< The height of the glyph
- uint32_t xBearing; ///< The distance from the cursor position to the leftmost border of the glyph
- uint32_t yBearing; ///< The distance from the baseline to the topmost border of the glyph
- uint32_t advance; ///< The distance to move the cursor for this glyph
+ 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
};
} // Dali