// INTERNAL INCLUDES
#include <singleton-service-impl.h>
+/**
+ * Conversion from Fractional26.6 to float
+ */
+namespace
+{
+const float FROM_266 = 1.0f / 64.0f;
+}
+
namespace Dali
{
id = mFontCache.size() + 1;
FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
- FontMetrics metrics( ftMetrics.ascender, ftMetrics.descender, ftMetrics.height );
+
+ FontMetrics metrics( static_cast< float >( ftMetrics.ascender ) * FROM_266,
+ static_cast< float >( ftMetrics.descender ) * FROM_266,
+ static_cast< float >( ftMetrics.height ) * FROM_266 );
mFontCache.push_back( CacheItem( id, ftFace, path, pointSize, faceIndex, metrics ) );
}
namespace Internal
{
-/**
- * Conversion from Fractional26.6 to float
- */
-namespace
-{
- const float FROM_266 = 1.0f / 64.0f;
-}
-
/**
* Implementation of the FontClient
*/
{
}
-FontMetrics::FontMetrics( signed long ascender26Dot6,
- signed long descender26Dot6,
- signed long height26Dot6 )
-: ascender( ascender26Dot6 ),
- descender( descender26Dot6 ),
- height( height26Dot6 )
+FontMetrics::FontMetrics( float ascenderPixels,
+ float descenderPixels,
+ float heightPixels )
+: ascender( ascenderPixels ),
+ descender( descenderPixels ),
+ height( heightPixels )
{
}
{
/**
- * The metrics for a Font expressed in 26.6 fractional pixel format.
+ * The metrics for a Font expressed in pixels.
*/
struct FontMetrics
{
FontMetrics();
/**
- * @brief Create the font metrics in 26.6 fractional pixel format.
+ * @brief Create the font metrics in pixels.
*/
- FontMetrics( signed long ascender26Dot6,
- signed long descender26Dot6,
- signed long height26Dot6 );
+ FontMetrics( float ascenderPixels,
+ float descenderPixels,
+ float heightPixels );
- signed long ascender; ///< The ascender in 26.6 fractional pixels.
- signed long descender; ///< The descender in 26.6 fractional pixels.
- signed long height; ///< The height in 26.6 fractional pixels.
+ float ascender; ///< The ascender in pixels.
+ float descender; ///< The descender in pixels.
+ float height; ///< The height in pixels.
};
} // Dali
/**
* The information describing a glyph (font ID, index, metrics)
- * The metrics have been converted from Fractional26.6 to floats.
+ * The metrics are in pixels.
*/
struct GlyphInfo
{
*/
GlyphInfo( FontId font, GlyphIndex i );
- FontId fontId; ///< Identifies the font containing the glyph
- GlyphIndex index; ///< Uniquely identifies a glyph for a given FontId
+ 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