Merge "Doxygen grouping" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 4 Sep 2015 10:04:36 +0000 (03:04 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Fri, 4 Sep 2015 10:04:36 +0000 (03:04 -0700)
adaptors/base/update-thread.cpp
adaptors/x11/ecore-x-event-handler.cpp
packaging/dali-adaptor.spec
text/dali/devel-api/text-abstraction/font-client.cpp
text/dali/devel-api/text-abstraction/font-client.h
text/dali/devel-api/text-abstraction/font-list.cpp
text/dali/devel-api/text-abstraction/font-list.h
text/dali/internal/text-abstraction/font-client-impl.cpp
text/dali/internal/text-abstraction/font-client-impl.h
text/dali/internal/text-abstraction/font-client-plugin-impl.cpp
text/dali/internal/text-abstraction/font-client-plugin-impl.h

index 451d301..ce80037 100644 (file)
@@ -190,7 +190,8 @@ void UpdateThread::UpdateStatusLogging( unsigned int keepUpdatingStatus )
 
   if ( !(++mStatusLogCount % mStatusLogInterval) )
   {
-    oss = "UpdateStatusLogging keepUpdating: " + keepUpdatingStatus ? "true":"false";
+    oss = "UpdateStatusLogging keepUpdating: ";
+    oss += (keepUpdatingStatus ? "true":"false");
 
     if ( keepUpdatingStatus )
     {
index 39296ac..739ed0b 100644 (file)
@@ -372,10 +372,14 @@ struct EventHandler::Impl
             mXiDeviceId = xiEventMask.deviceid;
 
             // SelectXi2Event
-            xiEventMask.mask = (unsigned char*)(calloc( 1, XIMaskLen( XI_LASTEVENT ) ) );
+            Dali::Vector< unsigned char > mask;
+            std::size_t xiMaskLen = XIMaskLen( XI_LASTEVENT );
+            mask.Reserve( xiMaskLen );
+            xiEventMask.mask = mask.Begin();
+
             XISetMask( xiEventMask.mask, XI_RawMotion );
 
-            xiEventMask.mask_len = sizeof( xiEventMask.mask );
+            xiEventMask.mask_len = xiMaskLen * sizeof( unsigned char );
 
             int ret = XISelectEvents( display, rootWindow, &xiEventMask, 1 );
             if( ret == 0 )
@@ -387,8 +391,6 @@ struct EventHandler::Impl
             {
               DALI_LOG_INFO( gImfLogging, Debug::General, "Failed to Select Events\n" );
             }
-
-            free( xiEventMask.mask );
           }
 
           if( deviceInfo != NULL )
index f5b764d..6704d60 100644 (file)
@@ -168,8 +168,15 @@ CXXFLAGS+=" -DOVER_TIZEN_SDK_2_2"
 %endif
 
 libtoolize --force
-cd %{_builddir}/%{name}-%{version}/build/tizen && autoreconf --install
-cd %{_builddir}/%{name}-%{version}/build/tizen && CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}" FONT_PRELOADED_PATH="%{font_preloaded_path}" FONT_DOWNLOADED_PATH="%{font_downloaded_path}" FONT_APPLICATION_PATH="%{font_application_path}" FONT_CONFIGURATION_FILE="%{font_configuration_file}"
+cd %{_builddir}/%{name}-%{version}/build/tizen
+autoreconf --install
+
+DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
+DALI_DATA_RO_DIR="%{dali_data_ro_dir}"  ; export DALI_DATA_RO_DIR
+FONT_PRELOADED_PATH="%{font_preloaded_path}" ; export FONT_PRELOADED_PATH
+FONT_DOWNLOADED_PATH="%{font_downloaded_path}" ; export FONT_DOWNLOADED_PATH
+FONT_APPLICATION_PATH="%{font_application_path}"  ; export FONT_APPLICATION_PATH
+FONT_CONFIGURATION_FILE="%{font_configuration_file}" ; export FONT_CONFIGURATION_FILE
 
 %configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-shaderbincache=%{shaderbincache_flag} --enable-profile=%{dali_profile} \
 %if 0%{?dali_feedback_plugin}
index 27feb02..7ff5250 100644 (file)
@@ -63,10 +63,9 @@ void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi
   GetImplementation(*this).GetDpi( horizontalDpi, verticalDpi );
 }
 
-void FontClient::SetDefaultFontFamily( const std::string& fontFamilyName,
-                                       const std::string& fontStyle )
+void FontClient::SetDefaultFont( const FontDescription& fontDescription )
 {
-  GetImplementation(*this).SetDefaultFontFamily( fontFamilyName, fontStyle );
+  GetImplementation(*this).SetDefaultFont( fontDescription );
 }
 
 void FontClient::GetDefaultFonts( FontList& defaultFonts )
@@ -99,13 +98,11 @@ FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, F
   return GetImplementation(*this).GetFontId( path, pointSize, faceIndex );
 }
 
-FontId FontClient::GetFontId( const FontFamily& fontFamily,
-                              const FontStyle& fontStyle,
+FontId FontClient::GetFontId( const FontDescription& fontDescription,
                               PointSize26Dot6 pointSize,
                               FaceIndex faceIndex )
 {
-  return GetImplementation(*this).GetFontId( fontFamily,
-                                             fontStyle,
+  return GetImplementation(*this).GetFontId( fontDescription,
                                              pointSize,
                                              faceIndex );
 }
@@ -115,9 +112,9 @@ bool FontClient::IsScalable( const FontPath& path )
   return GetImplementation(*this).IsScalable( path );;
 }
 
-bool FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& style )
+bool FontClient::IsScalable( const FontDescription& fontDescription )
 {
-  return GetImplementation(*this).IsScalable( fontFamily, style );
+  return GetImplementation(*this).IsScalable( fontDescription );
 }
 
 void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
@@ -125,11 +122,10 @@ void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26D
   GetImplementation(*this).GetFixedSizes( path, sizes );
 }
 
-void FontClient::GetFixedSizes( const FontFamily& fontFamily,
-                                const FontStyle& style,
+void FontClient::GetFixedSizes( const FontDescription& fontDescription,
                                 Dali::Vector< PointSize26Dot6 >& sizes )
 {
-  GetImplementation(*this).GetFixedSizes( fontFamily, style, sizes );
+  GetImplementation(*this).GetFixedSizes( fontDescription, sizes );
 }
 
 void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics, int maxFixedSize )
index f069bd3..67bac59 100644 (file)
@@ -123,12 +123,11 @@ public:
 
   /**
    * Set the default font family and its style that should be used by the font client.
+   * The style could be a pair 'font style, font width' or a cluster 'font width, font weight, font slant'.
    *
-   * @param[in] fontFamilyName The default name of the font's family.
-   * @param[in] fontStyle The default font's style.
+   * @param[in] fontDescription Description of the default font.
    */
-  void SetDefaultFontFamily( const std::string& fontFamilyName,
-                             const std::string& fontStyle );
+  void SetDefaultFont( const FontDescription& fontDescription );
 
   /**
    * @brief Retrieve the list of default fonts supported by the system.
@@ -183,19 +182,21 @@ public:
    * @param[in] faceIndex The index of the font face (optional).
    * @return A valid font ID, or zero if the font does not exist.
    */
-  FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE, FaceIndex faceIndex = 0 );
+  FontId GetFontId( const FontPath& path,
+                    PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
+                    FaceIndex faceIndex = 0 );
 
   /**
    * @brief Retrieve the unique identifier for a font.
    *
-   * @param[in] fontFamily The font family name.
-   * @param[in] fontStyle  The font style.
+   * @note It the font style is not empty, it will be used instead the font weight and font slant slant.
+   *
+   * @param[in] fontDescription A font description.
    * @param[in] pointSize The point size in 26.6 fractional points; the default point size is 12*64.
    * @param[in] faceIndex The index of the font face (optional).
    * @return A valid font ID, or zero if the font does not exist.
    */
-  FontId GetFontId( const FontFamily& fontFamily,
-                    const FontStyle& fontStyle,
+  FontId GetFontId( const FontDescription& fontDescription,
                     PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
                     FaceIndex faceIndex = 0 );
 
@@ -210,11 +211,13 @@ public:
   /**
    * @brief Check to see if a font is scalable.
    *
-   * @param[in] fontFamily The font family name.
-   * @param[in] style The font style.
+   * @note It the font style is not empty, it will be used instead the font weight and font slant slant.
+   *
+   * @param[in] fontDescription A font description.
+   *
    * @return true if scalable
    */
-  bool IsScalable( const FontFamily& fontFamily, const FontStyle& style );
+  bool IsScalable( const FontDescription& fontDescription );
 
   /**
    * @brief Get a list of sizes available for a fixed size font.
@@ -227,12 +230,12 @@ public:
   /**
    * @brief Get a list of sizes available for a fixed size font.
    *
-   * @param[in] fontFamily The font family name.
-   * @param[in] style The font style.
+   * @note It the font style is not empty, it will be used instead the font weight and font slant slant.
+   *
+   * @param[in] fontDescription A font description.
    * @param[out] sizes A list of the available sizes, if no sizes available will return empty.
    */
-  void GetFixedSizes( const FontFamily& fontFamily,
-                      const FontStyle& style,
+  void GetFixedSizes( const FontDescription& fontDescription,
                       Dali::Vector< PointSize26Dot6 >& sizes );
 
   ////////////////////////////////////////
index 9d5c3a0..8118f99 100644 (file)
@@ -28,7 +28,8 @@ DALI_IMPORT_API std::ostream& operator<<( std::ostream& o, const FontList& fontL
 {
   for( unsigned int i=0; i<fontList.size(); ++i )
   {
-    o << "Font " << i << ") path: " << fontList[i].path << " family: " << fontList[i].family << " style: " << fontList[i].style << std::endl;
+    const FontDescription& description = fontList[i];
+    o << "Font " << i << ") path: " << description.path << " family: " << " width : " << description.width << " weight : " << description.weight << " slant : " << description.slant << std::endl;
   }
 
   return o;
index 75549eb..46e2438 100644 (file)
@@ -28,16 +28,89 @@ namespace Dali
 
 namespace TextAbstraction
 {
-
 typedef std::string FontPath;
 typedef std::string FontFamily;
 typedef std::string FontStyle;
 
+namespace FontWidth
+{
+  /**
+   * @brief Enumeration type for the font's width
+   */
+  enum Type
+  {
+    ULTRA_CONDENSED,
+    EXTRA_CONDENSED,
+    CONDENSED,
+    SEMI_CONDENSED,
+    NORMAL,
+    SEMI_EXPANDED,
+    EXPANDED,
+    EXTRA_EXPANDED,
+    ULTRA_EXPANDED,
+  };
+} // namespace FontWidth
+
+namespace FontWeight
+{
+  /**
+   * @brief Enumeration type for the font's weight
+   */
+  enum Type
+  {
+    THIN,
+    ULTRA_LIGHT,
+    EXTRA_LIGHT = ULTRA_LIGHT,
+    LIGHT,
+    DEMI_LIGHT,
+    SEMI_LIGHT = DEMI_LIGHT,
+    BOOK,
+    NORMAL,
+    REGULAR = NORMAL,
+    MEDIUM,
+    DEMI_BOLD,
+    SEMI_BOLD = DEMI_BOLD,
+    BOLD,
+    ULTRA_BOLD,
+    EXTRA_BOLD = ULTRA_BOLD,
+    BLACK,
+    HEAVY = BLACK,
+    EXTRA_BLACK = BLACK
+  };
+}
+
+namespace FontSlant
+{
+  /**
+   * @brief Enumeration type for the font's slant
+   */
+  enum Type
+  {
+    NORMAL,
+    ROMAN = NORMAL,
+    ITALIC,
+    OBLIQUE
+  };
+} // namespace FontSlant
+
 struct FontDescription
 {
-  FontPath   path;
-  FontFamily family;
-  FontStyle  style;
+  FontDescription()
+  : path(),
+    family(),
+    width( FontWidth::NORMAL ),
+    weight( FontWeight::NORMAL ),
+    slant( FontSlant::NORMAL )
+  {}
+
+  ~FontDescription()
+  {}
+
+  FontPath         path;   ///< The font's file name path.
+  FontFamily       family; ///< The font's family name.
+  FontWidth::Type  width;  ///< The font's width.
+  FontWeight::Type weight; ///< The font's weight.
+  FontSlant::Type  slant;  ///< The font's slant.
 };
 
 typedef std::vector<FontDescription> FontList;
index c53b4cf..3199c21 100644 (file)
@@ -86,12 +86,11 @@ void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi
   verticalDpi = mDpiVertical;
 }
 
-void FontClient::SetDefaultFontFamily( const std::string& fontFamilyName,
-                                       const std::string& fontStyle )
+void FontClient::SetDefaultFont( const FontDescription& fontDescription )
 {
   CreatePlugin();
 
-  mPlugin->SetDefaultFontFamily( fontFamilyName, fontStyle );
+  mPlugin->SetDefaultFont( fontDescription );
 }
 
 void FontClient::GetDefaultFonts( FontList& defaultFonts )
@@ -136,11 +135,11 @@ bool FontClient::IsScalable( const FontPath& path )
   return mPlugin->IsScalable( path );
 }
 
-bool FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& style )
+bool FontClient::IsScalable( const FontDescription& fontDescription )
 {
   CreatePlugin();
 
-  return mPlugin->IsScalable( fontFamily, style );
+  return mPlugin->IsScalable( fontDescription );
 }
 
 void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
@@ -150,13 +149,12 @@ void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26D
   mPlugin->GetFixedSizes( path, sizes );
 }
 
-void FontClient::GetFixedSizes( const FontFamily& fontFamily,
-                                const FontStyle& style,
+void FontClient::GetFixedSizes( const FontDescription& fontDescription,
                                 Dali::Vector< PointSize26Dot6 >& sizes )
 {
   CreatePlugin();
 
-  mPlugin->GetFixedSizes( fontFamily, style, sizes );
+  mPlugin->GetFixedSizes( fontDescription, sizes );
 }
 
 FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
@@ -166,15 +164,13 @@ FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, F
   return mPlugin->GetFontId( path, pointSize, faceIndex );
 }
 
-FontId FontClient::GetFontId( const FontFamily& fontFamily,
-                              const FontStyle& fontStyle,
+FontId FontClient::GetFontId( const FontDescription& fontDescription,
                               PointSize26Dot6 pointSize,
                               FaceIndex faceIndex )
 {
   CreatePlugin();
 
-  return mPlugin->GetFontId( fontFamily,
-                             fontStyle,
+  return mPlugin->GetFontId( fontDescription,
                              pointSize,
                              faceIndex );
 }
index 4e3edec..e83a089 100644 (file)
@@ -66,10 +66,9 @@ public:
   void GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi );
 
   /**
-   * @copydoc Dali::FontClient::SetDefaultFontFamily()
+   * @copydoc Dali::FontClient::SetDefaultFont()
    */
-  void SetDefaultFontFamily( const std::string& fontFamilyName,
-                             const std::string& fontStyle );
+  void SetDefaultFont( const FontDescription& fontDescription );
 
   /**
    * @copydoc Dali::FontClient::GetDefaultFonts()
@@ -102,22 +101,21 @@ public:
   FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex );
 
   /**
-   * @copydoc Dali::FontClient::GetFontId(const FontFamily& fontFamily, const FontStyle& fontStyle, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 pointSize, FaceIndex faceIndex )
    */
-  FontId GetFontId( const FontFamily& fontFamily,
-                    const FontStyle& fontStyle,
+  FontId GetFontId( const FontDescription& fontDescription,
                     PointSize26Dot6 pointSize,
                     FaceIndex faceIndex );
 
   /**
-   * @copydoc Dali::FontClient::IsScalable(const FontPath& path )
+   * @copydoc Dali::FontClient::IsScalable( const FontPath& path )
    */
   bool IsScalable( const FontPath& path );
 
   /**
-   * @copydoc Dali::FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+   * @copydoc Dali::FontClient::IsScalable( const FontDescription& fontDescription )
    */
-  bool IsScalable( const FontFamily& fontFamily, const FontStyle& style );
+  bool IsScalable( const FontDescription& fontDescription );
 
   /**
    * @copydoc Dali::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
@@ -125,10 +123,9 @@ public:
   void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
 
   /**
-   * @copydoc Dali::FontClient::GetFixedSizes( const FontFamily& fontFamily, const FontStyle& fontStyle, Dali::Vector< PointSize26Dot6>& sizes )
+   * @copydoc Dali::FontClient::GetFixedSizes()
    */
-  void GetFixedSizes( const FontFamily& fontFamily,
-                      const FontStyle& style,
+  void GetFixedSizes( const FontDescription& fontDescription,
                       Dali::Vector< PointSize26Dot6 >& sizes );
 
   /**
index 8053ac5..1830013 100644 (file)
@@ -19,6 +19,7 @@
 #include <dali/internal/text-abstraction/font-client-plugin-impl.h>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/text-abstraction/font-list.h>
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/integration-api/debug.h>
@@ -35,9 +36,86 @@ const float FROM_266 = 1.0f / 64.0f;
 
 const std::string FONT_FORMAT( "TrueType" );
 const std::string DEFAULT_FONT_FAMILY_NAME( "Tizen" );
-const std::string DEFAULT_FONT_STYLE( "Regular" );
+const int DEFAULT_FONT_WIDTH  = 100; // normal
+const int DEFAULT_FONT_WEIGHT =  80; // normal
+const int DEFAULT_FONT_SLANT  =   0; // normal
 
 const uint32_t ELLIPSIS_CHARACTER = 0x2026;
+
+const bool FONT_FIXED_SIZE_BITMAP( true );
+
+// http://www.freedesktop.org/software/fontconfig/fontconfig-user.html
+
+// ULTRA_CONDENSED 50
+// EXTRA_CONDENSED 63
+// CONDENSED       75
+// SEMI_CONDENSED  87
+// NORMAL         100
+// SEMI_EXPANDED  113
+// EXPANDED       125
+// EXTRA_EXPANDED 150
+// ULTRA_EXPANDED 200
+const int FONT_WIDTH_TYPE_TO_INT[] = { 50, 63, 75, 87, 100, 113, 125, 150, 200 };
+const unsigned int NUM_FONT_WIDTH_TYPE = sizeof( FONT_WIDTH_TYPE_TO_INT ) / sizeof( int );
+
+// THIN                        0
+// ULTRA_LIGHT, EXTRA_LIGHT   40
+// LIGHT                      50
+// DEMI_LIGHT, SEMI_LIGHT     55
+// BOOK                       75
+// NORMAL, REGULAR            80
+// MEDIUM                    100
+// DEMI_BOLD, SEMI_BOLD      180
+// BOLD                      200
+// ULTRA_BOLD, EXTRA_BOLD    205
+// BLACK, HEAVY, EXTRA_BLACK 210
+const int FONT_WEIGHT_TYPE_TO_INT[] = { 0, 40, 50, 55, 75, 80, 100, 180, 200, 205, 210 };
+const unsigned int NUM_FONT_WEIGHT_TYPE = sizeof( FONT_WEIGHT_TYPE_TO_INT ) / sizeof( int );
+
+// NORMAL, ROMAN   0
+// ITALIC        100
+// OBLIQUE       110
+const int FONT_SLANT_TYPE_TO_INT[] = { 0, 100, 110 };
+const unsigned int NUM_FONT_SLANT_TYPE = sizeof( FONT_SLANT_TYPE_TO_INT ) / sizeof( int );
+
+/**
+ * @brief Retrieves a table index for a given value.
+ *
+ * @param[in] value The value.
+ * @param[in] table The table.
+ * @param[in] maxIndex The maximum valid index of the table.
+ *
+ * @return The index to the closest available value
+ */
+int ValueToIndex( int value, const int* const table, unsigned int maxIndex )
+{
+  if( ( NULL == table ) ||
+      ( value <= table[0] ) )
+  {
+    return 0;
+  }
+
+  if( value >= table[maxIndex] )
+  {
+    return maxIndex;
+  }
+
+  for( unsigned int index = 0u; index < maxIndex; )
+  {
+    const unsigned int indexPlus = ++index;
+    const int v1 = table[index];
+    const int v2 = table[indexPlus];
+    if( ( v1 < value ) && ( value <= v2 ) )
+    {
+      return ( ( value - v1 ) < ( v2 - value ) ) ? index : indexPlus;
+    }
+
+    index = indexPlus;
+  }
+
+  return 0;
+}
+
 }
 
 using Dali::Vector;
@@ -51,13 +129,45 @@ namespace TextAbstraction
 namespace Internal
 {
 
-const bool FONT_FIXED_SIZE_BITMAP( true );
+/**
+ * @brief Returns the FontWidth's enum index for the given width value.
+ *
+ * @param[in] width The width value.
+ *
+ * @return The FontWidth's enum index.
+ */
+FontWidth::Type IntToWidthType( int width )
+{
+  return static_cast<FontWidth::Type>( ValueToIndex( width, FONT_WIDTH_TYPE_TO_INT, NUM_FONT_WIDTH_TYPE - 1u ) );
+}
+
+/**
+ * @brief Returns the FontWeight's enum index for the given weight value.
+ *
+ * @param[in] weight The weight value.
+ *
+ * @return The FontWeight's enum index.
+ */
+FontWeight::Type IntToWeightType( int weight )
+{
+  return static_cast<FontWeight::Type>( ValueToIndex( weight, FONT_WEIGHT_TYPE_TO_INT, NUM_FONT_WEIGHT_TYPE - 1u ) );
+}
 
-FontClient::Plugin::FontDescriptionCacheItem::FontDescriptionCacheItem( const FontFamily& fontFamily,
-                                                                        const FontStyle& fontStyle,
+/**
+ * @brief Returns the FontSlant's enum index for the given slant value.
+ *
+ * @param[in] slant The slant value.
+ *
+ * @return The FontSlant's enum index.
+ */
+FontSlant::Type IntToSlantType( int slant )
+{
+  return static_cast<FontSlant::Type>( ValueToIndex( slant, FONT_SLANT_TYPE_TO_INT, NUM_FONT_SLANT_TYPE - 1u ) );
+}
+
+FontClient::Plugin::FontDescriptionCacheItem::FontDescriptionCacheItem( const FontDescription& fontDescription,
                                                                         FontDescriptionId index )
-: fontFamily( fontFamily ),
-  fontStyle( fontStyle ),
+: fontDescription( fontDescription ),
   index( index )
 {
 }
@@ -137,13 +247,11 @@ void FontClient::Plugin::SetDpi( unsigned int horizontalDpi,
   mDpiVertical = verticalDpi;
 }
 
-void FontClient::Plugin::SetDefaultFontFamily( const FontFamily& fontFamilyName,
-                                               const FontStyle& fontStyle )
+void FontClient::Plugin::SetDefaultFont( const FontDescription& fontDescription )
 {
   mDefaultFonts.clear();
 
-  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamilyName,
-                                                          fontStyle );
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
 
   FcResult result = FcResultMatch;
 
@@ -169,12 +277,20 @@ void FontClient::Plugin::SetDefaultFontFamily( const FontFamily& fontFamilyName,
       if( GetFcString( fontPattern, FC_FILE, path ) )
       {
         mDefaultFonts.push_back( FontDescription() );
-        FontDescription& fontDescription = mDefaultFonts.back();
-
-        fontDescription.path = path;
-
-        GetFcString( fontPattern, FC_FAMILY, fontDescription.family );
-        GetFcString( fontPattern, FC_STYLE, fontDescription.style );
+        FontDescription& newFontDescription = mDefaultFonts.back();
+
+        newFontDescription.path = path;
+
+        int width = 0;
+        int weight = 0;
+        int slant = 0;
+        GetFcString( fontPattern, FC_FAMILY, newFontDescription.family );
+        GetFcInt( fontPattern, FC_WIDTH, width );
+        GetFcInt( fontPattern, FC_WEIGHT, weight );
+        GetFcInt( fontPattern, FC_SLANT, slant );
+        newFontDescription.width = IntToWidthType( width );
+        newFontDescription.weight = IntToWeightType( weight );
+        newFontDescription.slant = IntToSlantType( slant );
       }
     }
 
@@ -188,8 +304,12 @@ void FontClient::Plugin::GetDefaultFonts( FontList& defaultFonts )
 {
   if( mDefaultFonts.empty() )
   {
-    SetDefaultFontFamily( DEFAULT_FONT_FAMILY_NAME,
-                          DEFAULT_FONT_STYLE );
+    FontDescription fontDescription;
+    fontDescription.family = DEFAULT_FONT_FAMILY_NAME;
+    fontDescription.width = IntToWidthType( DEFAULT_FONT_WIDTH );
+    fontDescription.weight = IntToWeightType( DEFAULT_FONT_WEIGHT );
+    fontDescription.slant = IntToSlantType( DEFAULT_FONT_SLANT );
+    SetDefaultFont( fontDescription );
   }
 
   defaultFonts = mDefaultFonts;
@@ -252,8 +372,12 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode,
   // Create the list of default fonts if it has not been created.
   if( mDefaultFonts.empty() )
   {
-    SetDefaultFontFamily( DEFAULT_FONT_FAMILY_NAME,
-                          DEFAULT_FONT_STYLE );
+    FontDescription fontDescription;
+    fontDescription.family = DEFAULT_FONT_FAMILY_NAME;
+    fontDescription.width = IntToWidthType( DEFAULT_FONT_WIDTH );
+    fontDescription.weight = IntToWeightType( DEFAULT_FONT_WEIGHT );
+    fontDescription.slant = IntToSlantType( DEFAULT_FONT_SLANT );
+    SetDefaultFont( fontDescription );
   }
 
   // Traverse the list of default fonts.
@@ -265,8 +389,7 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode,
   {
     const FontDescription& description = *it;
 
-    FcPattern* pattern = CreateFontFamilyPattern( description.family,
-                                                  description.style );
+    FcPattern* pattern = CreateFontFamilyPattern( description );
 
     FcResult result = FcResultMatch;
     FcPattern* match = FcFontMatch( NULL /* use default configure */, pattern, &result );
@@ -277,8 +400,7 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode,
     if( FcCharSetHasChar( charSet, charcode ) )
     {
       Vector< PointSize26Dot6 > fixedSizes;
-      GetFixedSizes( description.family,
-                     description.style,
+      GetFixedSizes( description,
                      fixedSizes );
 
       const Vector< PointSize26Dot6 >::SizeType count = fixedSizes.Count();
@@ -297,8 +419,7 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode,
         requestedSize = size;
       }
 
-      fontId = GetFontId( description.family,
-                          description.style,
+      fontId = GetFontId( description,
                           requestedSize,
                           0u );
 
@@ -350,20 +471,19 @@ FontId FontClient::Plugin::GetFontId( const FontPath& path,
   return id;
 }
 
-FontId FontClient::Plugin::GetFontId( const FontFamily& fontFamily,
-                                      const FontStyle& fontStyle,
+FontId FontClient::Plugin::GetFontId( const FontDescription& fontDescription,
                                       PointSize26Dot6 pointSize,
                                       FaceIndex faceIndex )
 {
   // This method uses three vectors which caches:
-  // * Pairs of non validated 'fontFamily, fontStyle' and an index to a vector with paths to font file names.
+  // * Pairs of non validated font descriptions and an index to a vector with paths to font file names.
   // * The path to font file names.
   // * The font ids of pairs 'font point size, index to the vector with paths to font file names'.
 
-  // 1) Checks in the cache if the pair 'fontFamily, fontStyle' has been validated before.
+  // 1) Checks in the cache if the font's description has been validated before.
   //    If it was it gets an index to the vector with paths to font file names. Otherwise,
-  //    retrieves using font config a path to a font file name which matches with the pair
-  //    'fontFamily, fontStyle'. The path is stored in the chache.
+  //    retrieves using font config a path to a font file name which matches with the
+  //    font's description. The path is stored in the chache.
   //
   // 2) Checks in the cache if the pair 'font point size, index to the vector with paths to
   //    fon file names' exists. If exists, it gets the font id. If it doesn't it calls
@@ -373,15 +493,15 @@ FontId FontClient::Plugin::GetFontId( const FontFamily& fontFamily,
   // The font id to be returned.
   FontId fontId = 0u;
 
-  // Check first if the pair font family and style have been validated before.
+  // Check first if the font's description have been validated before.
   FontDescriptionId validatedFontId = 0u;
 
-  if( !FindValidatedFont( fontFamily,
-                          fontStyle,
+  if( !FindValidatedFont( fontDescription,
                           validatedFontId ) )
   {
-    // Use font config to validate the font family name and font style.
-    ValidateFont( fontFamily, fontStyle, validatedFontId );
+    // Use font config to validate the font's description.
+    ValidateFont( fontDescription,
+                  validatedFontId );
   }
 
   // Check if exists a pair 'validatedFontId, pointSize' in the cache.
@@ -405,13 +525,11 @@ FontId FontClient::Plugin::GetFontId( const FontFamily& fontFamily,
   return fontId;
 }
 
-void FontClient::Plugin::ValidateFont( const FontFamily& fontFamily,
-                                       const FontStyle& fontStyle,
+void FontClient::Plugin::ValidateFont( const FontDescription& fontDescription,
                                        FontDescriptionId& validatedFontId )
 {
   // Create a font pattern.
-  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
-                                                            fontStyle );
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
 
   FcResult result = FcResultMatch;
 
@@ -421,10 +539,18 @@ void FontClient::Plugin::ValidateFont( const FontFamily& fontFamily,
   if( match )
   {
     // Get the path to the font file name.
+    int width = 0;
+    int weight = 0;
+    int slant = 0;
     FontDescription description;
     GetFcString( match, FC_FILE, description.path );
     GetFcString( match, FC_FAMILY, description.family );
-    GetFcString( match, FC_STYLE, description.style );
+    GetFcInt( match, FC_WIDTH, width );
+    GetFcInt( match, FC_WEIGHT, weight );
+    GetFcInt( match, FC_SLANT, slant );
+    description.width = IntToWidthType( width );
+    description.weight = IntToWeightType( weight );
+    description.slant = IntToSlantType( slant );
 
     // Set the index to the vector of paths to font file names.
     validatedFontId = mFontDescriptionCache.size();
@@ -432,8 +558,10 @@ void FontClient::Plugin::ValidateFont( const FontFamily& fontFamily,
     // Add the path to the cache.
     mFontDescriptionCache.push_back( description );
 
-    // Cache the index and the pair font family name, font style.
-    FontDescriptionCacheItem item( fontFamily, fontStyle, validatedFontId );
+    // Cache the index and the font's description.
+    FontDescriptionCacheItem item( description,
+                                   validatedFontId );
+
     mValidatedFontCache.push_back( item );
 
     // destroyed the matched pattern
@@ -441,7 +569,11 @@ void FontClient::Plugin::ValidateFont( const FontFamily& fontFamily,
   }
   else
   {
-    DALI_LOG_ERROR( "FontClient::Plugin::ValidateFont failed for font %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+    DALI_LOG_ERROR( "FontClient::Plugin::ValidateFont failed for font %s %d %d %d\n",
+                    fontDescription.family.c_str(),
+                    fontDescription.width,
+                    fontDescription.weight,
+                    fontDescription.slant );
   }
 
   // destroy the pattern
@@ -704,8 +836,16 @@ void FontClient::Plugin::InitSystemFonts()
 
         fontDescription.path = path;
 
+        int width = 0;
+        int weight = 0;
+        int slant = 0;
         GetFcString( fontPattern, FC_FAMILY, fontDescription.family );
-        GetFcString( fontPattern, FC_STYLE, fontDescription.style );
+        GetFcInt( fontPattern, FC_WIDTH, width );
+        GetFcInt( fontPattern, FC_WEIGHT, weight );
+        GetFcInt( fontPattern, FC_SLANT, slant );
+        fontDescription.width = IntToWidthType( width );
+        fontDescription.weight = IntToWeightType( weight );
+        fontDescription.slant = IntToSlantType( slant );
       }
     }
 
@@ -713,18 +853,18 @@ void FontClient::Plugin::InitSystemFonts()
   }
 }
 
-FcPattern* FontClient::Plugin::CreateFontFamilyPattern( const FontFamily& fontFamily,
-                                                        const FontStyle& fontStyle )
+FcPattern* FontClient::Plugin::CreateFontFamilyPattern( const FontDescription& fontDescription )
 {
   // create the cached font family lookup pattern
   // a pattern holds a set of names, each name refers to a property of the font
   FcPattern* fontFamilyPattern = FcPatternCreate();
 
   // add a property to the pattern for the font family
-  FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( fontFamily.c_str() ) );
+  FcPatternAddString( fontFamilyPattern, FC_FAMILY, reinterpret_cast<const FcChar8*>( fontDescription.family.c_str() ) );
 
-  // add a property to the pattern for the font family
-  FcPatternAddString( fontFamilyPattern, FC_STYLE, reinterpret_cast<const FcChar8*>( fontStyle.c_str() ) );
+  FcPatternAddInteger( fontFamilyPattern, FC_WIDTH, FONT_WIDTH_TYPE_TO_INT[fontDescription.width] );
+  FcPatternAddInteger( fontFamilyPattern, FC_WEIGHT, FONT_WEIGHT_TYPE_TO_INT[fontDescription.weight] );
+  FcPatternAddInteger( fontFamilyPattern, FC_SLANT, FONT_SLANT_TYPE_TO_INT[fontDescription.slant] );
 
   // Add a property of the pattern, to say we want to match TrueType fonts
   FcPatternAddString( fontFamilyPattern , FC_FONTFORMAT, reinterpret_cast<const FcChar8*>( FONT_FORMAT.c_str() ) );
@@ -751,7 +891,9 @@ _FcFontSet* FontClient::Plugin::GetFcFontSet() const
   // build an object set from a list of property names
   FcObjectSetAdd( objectSet, FC_FILE );
   FcObjectSetAdd( objectSet, FC_FAMILY );
-  FcObjectSetAdd( objectSet, FC_STYLE );
+  FcObjectSetAdd( objectSet, FC_WIDTH );
+  FcObjectSetAdd( objectSet, FC_WEIGHT );
+  FcObjectSetAdd( objectSet, FC_SLANT );
 
   // get a list of fonts
   // creates patterns from those fonts containing only the objects in objectSet and returns the set of unique such patterns
@@ -789,6 +931,18 @@ bool FontClient::Plugin::GetFcString( const FcPattern* const pattern,
   return false;
 }
 
+bool FontClient::Plugin::GetFcInt( const _FcPattern* const pattern, const char* const n, int& intVal )
+{
+  const FcResult retVal = FcPatternGetInteger( pattern, n, 0u, &intVal );
+
+  if( FcResultMatch == retVal )
+  {
+    return true;
+  }
+
+  return false;
+}
+
 FontId FontClient::Plugin::CreateFont( const FontPath& path,
                                        PointSize26Dot6 pointSize,
                                        FaceIndex faceIndex,
@@ -839,7 +993,16 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
               FontDescription description;
               description.path = path;
               description.family = FontFamily( ftFace->family_name );
-              description.style = FontStyle( ftFace->style_name );
+
+              // Note FreeType doesn't give too much info to build a proper font style.
+              if( ftFace->style_flags | FT_STYLE_FLAG_ITALIC )
+              {
+                description.slant = FontSlant::ITALIC;
+              }
+              if( ftFace->style_flags | FT_STYLE_FLAG_BOLD )
+              {
+                description.weight = FontWeight::BOLD;
+              }
 
               mFontDescriptionCache.push_back( description );
             }
@@ -888,7 +1051,16 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
           FontDescription description;
           description.path = path;
           description.family = FontFamily( ftFace->family_name );
-          description.style = FontStyle( ftFace->style_name );
+
+          // Note FreeType doesn't give too much info to build a proper font style.
+          if( ftFace->style_flags | FT_STYLE_FLAG_ITALIC )
+          {
+            description.slant = FontSlant::ITALIC;
+          }
+          if( ftFace->style_flags | FT_STYLE_FLAG_BOLD )
+          {
+            description.weight = FontWeight::BOLD;
+          }
 
           mFontDescriptionCache.push_back( description );
         }
@@ -987,8 +1159,7 @@ bool FontClient::Plugin::FindFont( const FontPath& path,
   return false;
 }
 
-bool FontClient::Plugin::FindValidatedFont( const FontFamily& fontFamily,
-                                            const FontStyle& fontStyle,
+bool FontClient::Plugin::FindValidatedFont( const FontDescription& fontDescription,
                                             FontDescriptionId& validatedFontId )
 {
   validatedFontId = 0u;
@@ -1000,8 +1171,11 @@ bool FontClient::Plugin::FindValidatedFont( const FontFamily& fontFamily,
   {
     const FontDescriptionCacheItem& item = *it;
 
-    if( ( fontFamily == item.fontFamily ) &&
-        ( fontStyle == item.fontStyle ) && ( fontFamily !="") )
+    if( !fontDescription.family.empty() &&
+        ( fontDescription.family == item.fontDescription.family ) &&
+        ( fontDescription.width == item.fontDescription.width ) &&
+        ( fontDescription.weight == item.fontDescription.weight ) &&
+        ( fontDescription.slant == item.fontDescription.slant ) )
     {
       validatedFontId = item.index;
 
@@ -1050,11 +1224,10 @@ bool FontClient::Plugin::IsScalable( const FontPath& path )
   return ( ftFace->num_fixed_sizes == 0 );
 }
 
-bool FontClient::Plugin::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+bool FontClient::Plugin::IsScalable( const FontDescription& fontDescription )
 {
   // Create a font pattern.
-  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
-                                                          fontStyle );
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
 
   FcResult result = FcResultMatch;
 
@@ -1071,7 +1244,11 @@ bool FontClient::Plugin::IsScalable( const FontFamily& fontFamily, const FontSty
   }
   else
   {
-    DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+    DALI_LOG_ERROR( "FreeType Cannot check font: %s %d %d %d\n",
+                    fontDescription.family.c_str(),
+                    fontDescription.width,
+                    fontDescription.weight,
+                    fontDescription.slant );
   }
   FcPatternDestroy( fontFamilyPattern );
   FcPatternDestroy( match );
@@ -1103,13 +1280,11 @@ void FontClient::Plugin::GetFixedSizes( const FontPath& path, Vector< PointSize2
   }
 }
 
-void FontClient::Plugin::GetFixedSizes( const FontFamily& fontFamily,
-                                        const FontStyle& fontStyle,
+void FontClient::Plugin::GetFixedSizes( const FontDescription& fontDescription,
                                         Vector< PointSize26Dot6 >& sizes )
 {
   // Create a font pattern.
-  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
-                                                          fontStyle );
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontDescription );
 
   FcResult result = FcResultMatch;
 
@@ -1125,7 +1300,11 @@ void FontClient::Plugin::GetFixedSizes( const FontFamily& fontFamily,
   }
   else
   {
-    DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+    DALI_LOG_ERROR( "FreeType Cannot check font: %s %d %d %d\n",
+                    fontDescription.family.c_str(),
+                    fontDescription.width,
+                    fontDescription.weight,
+                    fontDescription.slant );
   }
   FcPatternDestroy( match );
   FcPatternDestroy( fontFamilyPattern );
index b292178..3449547 100644 (file)
@@ -42,7 +42,7 @@ namespace Internal
 {
 
 /**
- *@brief Type used for indices addressing the vector with front descriptions of validated pairs 'font family name, font style'.
+ *@brief Type used for indices addressing the vector with front descriptions of validated fonts.
  */
 typedef uint32_t FontDescriptionId;
 
@@ -52,17 +52,15 @@ typedef uint32_t FontDescriptionId;
 struct FontClient::Plugin
 {
   /**
-   * @brief Caches an index to the vector of font descriptions for a given 'font family name, font style'.
+   * @brief Caches an index to the vector of font descriptions for a given font.
    */
   struct FontDescriptionCacheItem
   {
-    FontDescriptionCacheItem( const FontFamily& fontFamily,
-                              const FontStyle& fontStyle,
+    FontDescriptionCacheItem( const FontDescription& fontDescription,
                               FontDescriptionId index );
 
-    FontFamily        fontFamily; ///< The font family name.
-    FontStyle         fontStyle;  ///< The font style.
-    FontDescriptionId index;      ///< Index to the vector of font descriptions.
+    FontDescription fontDescription; ///< The font description.
+    FontDescriptionId index;         ///< Index to the vector of font descriptions.
   };
 
   /**
@@ -138,10 +136,9 @@ struct FontClient::Plugin
   void SetDpi( unsigned int horizontalDpi, unsigned int verticalDpi );
 
   /**
-   * @copydoc Dali::FontClient::SetDefaultFontFamily()
+   * @copydoc Dali::FontClient::SetDefaultFont()
    */
-  void SetDefaultFontFamily( const FontFamily& fontFamilyName,
-                             const FontStyle& fontStyle );
+  void SetDefaultFont( const FontDescription& fontDescription );
 
   /**
    * @copydoc Dali::FontClient::GetDefaultFonts()
@@ -176,33 +173,31 @@ struct FontClient::Plugin
   FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription = true );
 
   /**
-   * @copydoc Dali::FontClient::GetFontId(const FontFamily& fontFamily, const FontStyle& fontStyle, PointSize26Dot6 pointSize, FaceIndex faceIndex )
+   * @copydoc Dali::FontClient::GetFontId( const FontDescription& fontDescription, PointSize26Dot6 pointSize, FaceIndex faceIndex )
    */
-  FontId GetFontId( const FontFamily& fontFamily,
-                    const FontStyle& fontStyle,
+  FontId GetFontId( const FontDescription& fontDescription,
                     PointSize26Dot6 pointSize,
                     FaceIndex faceIndex );
 
   /**
-   * @copydoc Dali::FontClient::IsScalable(const FontPath& path )
+   * @copydoc Dali::FontClient::IsScalable( const FontPath& path )
    */
   bool IsScalable( const FontPath& path );
 
   /**
-   * @copydoc Dali::FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+   * @copydoc Dali::FontClient::IsScalable( const FontDescription& fontDescription )
    */
-  bool IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle );
+  bool IsScalable( const FontDescription& fontDescription );
 
   /**
-   * @copydoc Dali::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
+   * @copydoc Dali::FontClient::GetFixedSizes()
    */
   void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
 
   /**
-   * @copydoc Dali::FontClient::GetFixedSizes( const FontFamily& fontFamily, const FontStyle& fontStyle, Dali::Vector< PointSize26Dot6>& sizes )
+   * @copydoc Dali::FontClient::GetFixedSizes()
    */
-  void GetFixedSizes( const FontFamily& fontFamily,
-                      const FontStyle& fontStyle,
+  void GetFixedSizes( const FontDescription& fontDescription,
                       Dali::Vector< PointSize26Dot6 >& sizes );
 
   /**
@@ -242,13 +237,11 @@ private:
   /**
    * @brief Creates a font family pattern used to match fonts.
    *
-   * @param[in] fontFamily The font family name.
-   * @param[in] fontStyle The font style.
+   * @param[in] fontDescription The font to cache.
    *
    * @return The pattern.
    */
-  _FcPattern* CreateFontFamilyPattern( const FontFamily& fontFamily,
-                                       const FontStyle& fontStyle );
+  _FcPattern* CreateFontFamilyPattern( const FontDescription& fontDescription );
 
   /**
    * Retrieves the fonts present in the platform.
@@ -269,6 +262,17 @@ private:
   bool GetFcString( const _FcPattern* const pattern, const char* const n, std::string& string );
 
   /**
+   * Retrieves a font config object's value from a pattern.
+   *
+   * @param[in] pattern The font config pattern.
+   * @param[in] n The object.
+   * @param[out] intVal The object's value.
+   *
+   * @return @e true if the operation is successful.
+   */
+  bool GetFcInt( const _FcPattern* const pattern, const char* const n, int& intVal );
+
+  /**
    * @brief Creates a font.
    *
    * @param[in] path The path to the font file name.
@@ -313,17 +317,15 @@ private:
   bool FindFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, FontId& fontId ) const;
 
   /**
-   * @brief Finds in the cahce a pair 'font family, font style'.
-   * If there is one, it writes the index to the vector with font descriptions in the param @p  validatedFontId.
+   * @brief Finds in the cahce a cluster 'font family, font width, font weight, font slant'
+   * If there is one, it writes the index to the vector with font descriptions in the param @p validatedFontId.
    *
-   * @param[in] fontFamily The font family name.
-   * @param[in] fontStyle The font style.
+   * @param[in] fontDescription The font to validate.
    * @param[out] validatedFontId The index to the vector with font descriptions.
    *
    * @return @e true if the pair is found.
    */
-  bool FindValidatedFont( const FontFamily& fontFamily,
-                          const FontStyle& fontStyle,
+  bool FindValidatedFont( const FontDescription& fontDescription,
                           FontDescriptionId& validatedFontId );
 
   /**
@@ -341,14 +343,12 @@ private:
                  FontId& fontId );
 
   /**
-   * @brief Validate a font family and style
+   * @brief Validate a font description.
    *
-   * @param[in] fontFamily Font Family to validate
-   * @param[in] fontStyle Font Style to validate
+   * @param[in] fontDescription The font to validate.
    * @param[out] validatedFontId Result of validation
    */
-  void ValidateFont( const FontFamily& fontFamily,
-                     const FontStyle& fontStyle,
+  void ValidateFont( const FontDescription& fontDescription,
                      FontDescriptionId& validatedFontId );
 
   FT_Library mFreeTypeLibrary; ///< A handle to a FreeType library instance.
@@ -360,8 +360,8 @@ private:
   FontList mDefaultFonts;      ///< Cached default fonts.
 
   std::vector<CacheItem>                mFontCache;            ///< Caches the FreeType face and font metrics of the triplet 'path to the font file name, font point size and face index'.
-  std::vector<FontDescriptionCacheItem> mValidatedFontCache;   ///< Caches indices to the vector of font descriptions for a given 'font family name, font style'.
-  FontList                              mFontDescriptionCache; ///< Caches font descriptions for the validated font family name and font style pairs.
+  std::vector<FontDescriptionCacheItem> mValidatedFontCache;   ///< Caches indices to the vector of font descriptions for a given font.
+  FontList                              mFontDescriptionCache; ///< Caches font descriptions for the validated font.
   std::vector<FontIdCacheItem>          mFontIdCache;          ///< Caches font ids for the pairs of font point size and the index to the vector with font descriptions of the validated fonts.
 
   Vector<EllipsisItem> mEllipsisCache;      ///< Caches ellipsis glyphs for a particular point size.