From 0c29a5f0da6f783eb98561172bc8179395e8d24e Mon Sep 17 00:00:00 2001 From: Richard Underhill Date: Wed, 1 Apr 2015 11:53:43 +0100 Subject: [PATCH] Added underline position and thickness to FontMetrics Change-Id: I036851956f96fe604a30da0ba3c1be4a51eaf325 Signed-off-by: Richard Underhill --- .../text-abstraction/font-client-plugin-impl.cpp | 8 ++++++-- .../public-api/text-abstraction/font-metrics.cpp | 8 ++++++-- .../public-api/text-abstraction/font-metrics.h | 14 +++++++++----- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp b/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp index 5e771744f..ba1dd012a 100644 --- a/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp +++ b/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp @@ -749,7 +749,9 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path, // Indicate that the font is a fixed sized bitmap FontMetrics metrics( fixedHeight, 0.0f, - fixedHeight ); + fixedHeight, + 0.0f, + 0.0f ); mFontCache.push_back( CacheItem( ftFace, path, pointSize, faceIndex, metrics, fixedWidth, fixedHeight ) ); id = mFontCache.size(); @@ -796,7 +798,9 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path, FontMetrics metrics( static_cast< float >( ftMetrics.ascender ) * FROM_266, static_cast< float >( ftMetrics.descender ) * FROM_266, - static_cast< float >( ftMetrics.height ) * FROM_266 ); + static_cast< float >( ftMetrics.height ) * FROM_266, + static_cast< float >( ftFace->underline_position ) * FROM_266, + static_cast< float >( ftFace->underline_thickness ) * FROM_266 ); mFontCache.push_back( CacheItem( ftFace, path, pointSize, faceIndex, metrics ) ); id = mFontCache.size(); diff --git a/text/dali/public-api/text-abstraction/font-metrics.cpp b/text/dali/public-api/text-abstraction/font-metrics.cpp index f1a172c77..63145d4cb 100644 --- a/text/dali/public-api/text-abstraction/font-metrics.cpp +++ b/text/dali/public-api/text-abstraction/font-metrics.cpp @@ -33,10 +33,14 @@ FontMetrics::FontMetrics() FontMetrics::FontMetrics( float ascenderPixels, float descenderPixels, - float heightPixels ) + float heightPixels, + float underlinePositionPixels, + float underlineThicknessPixels ) : ascender( ascenderPixels ), descender( descenderPixels ), - height( heightPixels ) + height( heightPixels ), + underlinePosition( underlinePositionPixels ), + underlineThickness( underlineThicknessPixels ) { } diff --git a/text/dali/public-api/text-abstraction/font-metrics.h b/text/dali/public-api/text-abstraction/font-metrics.h index 5d274c8bc..3649dab64 100644 --- a/text/dali/public-api/text-abstraction/font-metrics.h +++ b/text/dali/public-api/text-abstraction/font-metrics.h @@ -42,11 +42,15 @@ struct DALI_IMPORT_API FontMetrics */ FontMetrics( float ascenderPixels, float descenderPixels, - float heightPixels ); - - float ascender; ///< The ascender in pixels. - float descender; ///< The descender in pixels. - float height; ///< The height in pixels. + float heightPixels, + float underlinePositionPixels, + float underlinePositionThickness ); + + float ascender; ///< The ascender in pixels. + float descender; ///< The descender in pixels. + float height; ///< The height in pixels. + float underlinePosition; ///< The underline position in pixels. + float underlineThickness; ///< The vertical height of the underline in pixels. }; } // Dali -- 2.34.1