Support for fixed size fonts in FreeType2 22/36022/6
authorRichard Underhill <r.underhill@partner.samsung.com>
Tue, 3 Mar 2015 10:22:33 +0000 (10:22 +0000)
committerRichard Underhill <r.underhill@partner.samsung.com>
Tue, 3 Mar 2015 16:22:46 +0000 (16:22 +0000)
Change-Id: Ic962d26e0933bac859c4426836eb8741ec5cf907
Signed-off-by: Richard Underhill <r.underhill@partner.samsung.com>
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
text/dali/public-api/text-abstraction/font-client.cpp
text/dali/public-api/text-abstraction/font-client.h

index d069949..d59eef4 100644 (file)
@@ -123,6 +123,36 @@ FontId FontClient::FindDefaultFont( Character charcode, PointSize26Dot6 pointSiz
   return mPlugin->FindDefaultFont( charcode, pointSize );
 }
 
+bool FontClient::IsScalable( const FontPath& path )
+{
+  CreatePlugin();
+
+  return mPlugin->IsScalable( path );
+}
+
+bool FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& style )
+{
+  CreatePlugin();
+
+  return mPlugin->IsScalable( fontFamily, style );
+}
+
+void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
+{
+  CreatePlugin();
+
+  mPlugin->GetFixedSizes( path, sizes );
+}
+
+void FontClient::GetFixedSizes( const FontFamily& fontFamily,
+                                const FontStyle& style,
+                                Dali::Vector< PointSize26Dot6 >& sizes )
+{
+  CreatePlugin();
+
+  mPlugin->GetFixedSizes( fontFamily, style, sizes );
+}
+
 FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
 {
   CreatePlugin();
index 8965607..9fd66e5 100644 (file)
@@ -105,6 +105,28 @@ public:
                     FaceIndex faceIndex );
 
   /**
+   * @copydoc Dali::FontClient::IsScalable(const FontPath& path )
+   */
+  bool IsScalable( const FontPath& path );
+
+  /**
+   * @copydoc Dali::FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+   */
+  bool IsScalable( const FontFamily& fontFamily, const FontStyle& style );
+
+  /**
+   * @copydoc Dali::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
+   */
+  void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
+
+  /**
+   * @copydoc Dali::FontClient::GetFixedSizes( const FontFamily& fontFamily, const FontStyle& fontStyle, Dali::Vector< PointSize26Dot6>& sizes )
+   */
+  void GetFixedSizes( const FontFamily& fontFamily,
+                      const FontStyle& style,
+                      Dali::Vector< PointSize26Dot6 >& sizes );
+
+  /**
    * @copydoc Dali::FontClient::GetFontMetrics()
    */
   void GetFontMetrics( FontId fontId, FontMetrics& metrics );
index 4d6b5c4..8537b17 100644 (file)
@@ -47,6 +47,8 @@ namespace TextAbstraction
 namespace Internal
 {
 
+const bool FONT_FIXED_SIZE_BITMAP( true );
+
 FontClient::Plugin::FontDescriptionCacheItem::FontDescriptionCacheItem( const FontFamily& fontFamily,
                                                                         const FontStyle& fontStyle,
                                                                         FontDescriptionId index )
@@ -67,12 +69,14 @@ FontClient::Plugin::CacheItem::CacheItem( FT_Face ftFace,
                                           const FontPath& path,
                                           PointSize26Dot6 pointSize,
                                           FaceIndex face,
-                                          const FontMetrics& metrics )
+                                          const FontMetrics& metrics,
+                                          bool isFixedSizeBitmap )
 : mFreeTypeFace( ftFace ),
   mPath( path ),
   mPointSize( pointSize ),
   mFaceIndex( face ),
-  mMetrics( metrics )
+  mMetrics( metrics ),
+  mIsFixedSizeBitmap( isFixedSizeBitmap )
 {}
 
 FontClient::Plugin::Plugin( unsigned int horizontalDpi,
@@ -306,44 +310,7 @@ FontId FontClient::Plugin::GetFontId( const FontFamily& fontFamily,
                           validatedFontId ) )
   {
     // Use font config to validate the font family name and font style.
-
-    // Create a font pattern.
-    FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
-                                                            fontStyle );
-
-    FcResult result = FcResultMatch;
-
-    // match the pattern
-    FcPattern* match = FcFontMatch( NULL /* use default configure */, fontFamilyPattern, &result );
-
-    if( match )
-    {
-      // Get the path to the font file name.
-      FontDescription description;
-      GetFcString( match, FC_FILE, description.path );
-      GetFcString( match, FC_FAMILY, description.family );
-      GetFcString( match, FC_STYLE, description.style );
-
-      // Set the index to the vector of paths to font file names.
-      validatedFontId = mFontDescriptionCache.size();
-
-      // 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 );
-      mValidatedFontCache.push_back( item );
-
-      // destroyed the matched pattern
-      FcPatternDestroy( match );
-    }
-    else
-    {
-      DALI_LOG_ERROR( "FontClient::Plugin::GetFontId failed for font %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
-    }
-
-    // destroy the pattern
-    FcPatternDestroy( fontFamilyPattern );
+    ValidateFont( fontFamily, fontStyle, validatedFontId );
   }
 
   // Check if exists a pair 'validatedFontId, pointSize' in the cache.
@@ -367,6 +334,51 @@ FontId FontClient::Plugin::GetFontId( const FontFamily& fontFamily,
   return fontId;
 }
 
+void FontClient::Plugin::ValidateFont( const FontFamily& fontFamily,
+                                       const FontStyle& fontStyle,
+                                       FontDescriptionId& validatedFontId )
+{
+  // Create a font pattern.
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
+                                                            fontStyle );
+
+  FcResult result = FcResultMatch;
+
+  // match the pattern
+  FcPattern* match = FcFontMatch( NULL /* use default configure */, fontFamilyPattern, &result );
+
+  if( match )
+  {
+    // Get the path to the font file name.
+    FontDescription description;
+    GetFcString( match, FC_FILE, description.path );
+    GetFcString( match, FC_FAMILY, description.family );
+    GetFcString( match, FC_STYLE, description.style );
+
+    // Set the index to the vector of paths to font file names.
+    validatedFontId = mFontDescriptionCache.size();
+
+    // 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 );
+    mValidatedFontCache.push_back( item );
+
+    // destroyed the matched pattern
+    FcPatternDestroy( match );
+  }
+  else
+  {
+    DALI_LOG_ERROR( "FontClient::Plugin::ValidateFont failed for font %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+  }
+
+  // destroy the pattern
+  FcPatternDestroy( fontFamilyPattern );
+}
+
+
+
 void FontClient::Plugin::GetFontMetrics( FontId fontId,
                                          FontMetrics& metrics )
 {
@@ -412,6 +424,29 @@ bool FontClient::Plugin::GetGlyphMetrics( GlyphInfo* array,
     {
       FT_Face ftFace = mFontCache[fontId-1].mFreeTypeFace;
 
+      // Check to see if we should be loading a Fixed Size bitmap?
+      if ( mFontCache[fontId-1].mIsFixedSizeBitmap )
+      {
+        int error = FT_Load_Glyph( ftFace, array[i].index, FT_LOAD_COLOR );
+        if ( FT_Err_Ok == error )
+        {
+          // TODO passing height for metrics, should store width, height and advance
+
+          float height = mFontCache[ fontId -1 ].mMetrics.height;
+          array[i].width = height;
+          array[i].height = height;
+          array[i].advance = height;
+          array[i].xBearing = 0.0f;
+          array[i].yBearing = 0.0f;
+          return success;
+        }
+        else
+        {
+          DALI_LOG_ERROR( "FreeType Bitmap Load_Glyph error %d\n", error );
+          return false;
+        }
+      }
+
       int error = FT_Load_Glyph( ftFace, array[i].index, FT_LOAD_DEFAULT );
 
       if( FT_Err_Ok == error )
@@ -455,7 +490,17 @@ BitmapImage FontClient::Plugin::CreateBitmap( FontId fontId,
   {
     FT_Face ftFace = mFontCache[fontId-1].mFreeTypeFace;
 
-    FT_Error error = FT_Load_Glyph( ftFace, glyphIndex, FT_LOAD_DEFAULT );
+    FT_Error error;
+
+    // Check to see if this is fixed size bitmap
+    if ( mFontCache[fontId-1].mIsFixedSizeBitmap )
+    {
+      error = FT_Load_Glyph( ftFace, glyphIndex, FT_LOAD_COLOR );
+    }
+    else
+    {
+      error = FT_Load_Glyph( ftFace, glyphIndex, FT_LOAD_DEFAULT );
+    }
     if( FT_Err_Ok == error )
     {
       FT_Glyph glyph;
@@ -467,26 +512,24 @@ BitmapImage FontClient::Plugin::CreateBitmap( FontId fontId,
         if( glyph->format != FT_GLYPH_FORMAT_BITMAP )
         {
           error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 0, 1 );
+          if ( FT_Err_Ok == error )
+          {
+            FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph)glyph;
+            ConvertBitmap( bitmap, bitmapGlyph->bitmap );
+          }
+          else
+          {
+            DALI_LOG_ERROR( "FT_Get_Glyph Failed with error: %d\n", error );
+          }
         }
         else
         {
-          DALI_LOG_ERROR( "FT_Glyph_To_Bitmap Failed with error: %d\n", error );
+          ConvertBitmap( bitmap, ftFace->glyph->bitmap );
         }
-      }
-      else
-      {
-        DALI_LOG_ERROR( "FT_Get_Glyph Failed with error: %d\n", error );
-      }
 
-      if( FT_Err_Ok == error )
-      {
-        // Access the underlying bitmap data
-        FT_BitmapGlyph bitmapGlyph = (FT_BitmapGlyph)glyph;
-        ConvertBitmap( bitmap, bitmapGlyph->bitmap );
+        // Created FT_Glyph object must be released with FT_Done_Glyph
+        FT_Done_Glyph( glyph );
       }
-
-      // Created FT_Glyph object must be released with FT_Done_Glyph
-      FT_Done_Glyph( glyph );
     }
     else
     {
@@ -621,37 +664,91 @@ FontId FontClient::Plugin::CreateFont( const FontPath& path,
 
   if( FT_Err_Ok == error )
   {
-    error = FT_Set_Char_Size( ftFace,
+    // Check to see if the font contains fixed sizes?
+    if ( ftFace->num_fixed_sizes && ftFace->available_sizes )
+    {
+      // Ensure this size is available
+      for ( int i = 0; i < ftFace->num_fixed_sizes; ++i )
+      {
+        if ( pointSize == ftFace->available_sizes[ i ].size )
+        {
+          // Tell Freetype to use this size
+          error = FT_Select_Size( ftFace, i );
+          if ( FT_Err_Ok != error )
+          {
+            DALI_LOG_ERROR( "FreeType Select_Size error: %d\n", error );
+          }
+          else
+          {
+            // Indicate that the font is a fixed sized bitmap
+            FontMetrics metrics( 0.0f,
+                                 0.0f,
+                                 static_cast< float >( ftFace->available_sizes[ i ].height ) );
+
+            mFontCache.push_back( CacheItem( ftFace, path, pointSize, faceIndex, metrics, FONT_FIXED_SIZE_BITMAP ) );
+            id = mFontCache.size();
+
+            if( cacheDescription )
+            {
+              FontDescription description;
+              description.path = path;
+              description.family = FontFamily( ftFace->family_name );
+              description.style = FontStyle( ftFace->style_name );
+
+              mFontDescriptionCache.push_back( description );
+            }
+            return id;
+          }
+        }
+      }
+
+      // Can't find this size
+      std::stringstream sizes;
+      for ( int i = 0; i < ftFace->num_fixed_sizes; ++i )
+      {
+        if ( i )
+        {
+          sizes << ", ";
+        }
+        sizes << ftFace->available_sizes[ i ].size;
+      }
+      DALI_LOG_ERROR( "FreeType Font: %s, does not contain Bitmaps of size: %d. Available sizes are: %s\n",
+                       path.c_str(), pointSize, sizes.str().c_str() );
+    }
+    else
+    {
+      error = FT_Set_Char_Size( ftFace,
                               0,
                               pointSize,
                               mDpiHorizontal,
                               mDpiVertical );
 
-    if( FT_Err_Ok == error )
-    {
-      id = mFontCache.size() + 1;
+      if( FT_Err_Ok == error )
+      {
 
-      FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
+        FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
 
-      FontMetrics metrics( static_cast< float >( ftMetrics.ascender  ) * FROM_266,
-                           static_cast< float >( ftMetrics.descender ) * FROM_266,
-                           static_cast< float >( ftMetrics.height    ) * FROM_266 );
+        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( ftFace, path, pointSize, faceIndex, metrics ) );
+        mFontCache.push_back( CacheItem( ftFace, path, pointSize, faceIndex, metrics ) );
+        id = mFontCache.size();
 
-      if( cacheDescription )
-      {
-        FontDescription description;
-        description.path = path;
-        description.family = FontFamily( ftFace->family_name );
-        description.style = FontStyle( ftFace->style_name );
+        if( cacheDescription )
+        {
+          FontDescription description;
+          description.path = path;
+          description.family = FontFamily( ftFace->family_name );
+          description.style = FontStyle( ftFace->style_name );
 
-        mFontDescriptionCache.push_back( description );
+          mFontDescriptionCache.push_back( description );
+        }
+      }
+      else
+      {
+        DALI_LOG_ERROR( "FreeType Set_Char_Size error: %d for pointSize %d\n", error, pointSize );
       }
-    }
-    else
-    {
-      DALI_LOG_ERROR( "FreeType Set_Char_Size error: %d for pointSize %d\n", pointSize );
     }
   }
   else
@@ -667,15 +764,35 @@ void FontClient::Plugin::ConvertBitmap( BitmapImage& destBitmap,
 {
   if( srcBitmap.width*srcBitmap.rows > 0 )
   {
-    // TODO - Support all pixel modes
-    if( FT_PIXEL_MODE_GRAY == srcBitmap.pixel_mode )
+    switch( srcBitmap.pixel_mode )
     {
-      if( srcBitmap.pitch == static_cast< int >( srcBitmap.width ) )
+      case FT_PIXEL_MODE_GRAY:
+      {
+        if( srcBitmap.pitch == static_cast< int >( srcBitmap.width ) )
+        {
+          destBitmap = BitmapImage::New( srcBitmap.width, srcBitmap.rows, Pixel::L8 );
+
+          PixelBuffer* destBuffer = destBitmap.GetBuffer();
+          memcpy( destBuffer, srcBitmap.buffer, srcBitmap.width*srcBitmap.rows );
+        }
+        break;
+      }
+
+      case FT_PIXEL_MODE_BGRA:
       {
-        destBitmap = BitmapImage::New( srcBitmap.width, srcBitmap.rows, Pixel::L8 );
+        if ( srcBitmap.pitch == static_cast< int >( srcBitmap.width << 2 ) )
+        {
+          destBitmap = BitmapImage::New( srcBitmap.width, srcBitmap.rows, Pixel::BGRA8888 );
 
-        PixelBuffer* destBuffer = destBitmap.GetBuffer();
-        memcpy( destBuffer, srcBitmap.buffer, srcBitmap.width*srcBitmap.rows );
+          PixelBuffer* destBuffer = destBitmap.GetBuffer();
+          memcpy( destBuffer, srcBitmap.buffer, srcBitmap.width*srcBitmap.rows*4 );
+        }
+        break;
+      }
+      default:
+      {
+        DALI_LOG_ERROR( "FontClient Unable to create Bitmap of this PixelType\n" );
+        break;
       }
     }
   }
@@ -755,6 +872,90 @@ bool FontClient::Plugin::FindFont( FontDescriptionId validatedFontId,
   return false;
 }
 
+bool FontClient::Plugin::IsScalable( const FontPath& path )
+{
+  FT_Face ftFace;
+  int error = FT_New_Face( mFreeTypeLibrary,
+                           path.c_str(),
+                           0,
+                           &ftFace );
+  if( FT_Err_Ok != error )
+  {
+    DALI_LOG_ERROR( "FreeType Cannot check font: %s\n", path.c_str() );
+  }
+  return ( ftFace->num_fixed_sizes == 0 );
+}
+
+bool FontClient::Plugin::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+{
+  // Create a font pattern.
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
+                                                          fontStyle );
+
+  FcResult result = FcResultMatch;
+
+  // match the pattern
+  FcPattern* match = FcFontMatch( NULL /* use default configure */, fontFamilyPattern, &result );
+
+  if( match )
+  {
+    // Get the path to the font file name.
+    FontPath path;
+    GetFcString( match, FC_FILE, path );
+    return IsScalable( path );
+  }
+  DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+  return true;
+}
+
+void FontClient::Plugin::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6 >& sizes )
+{
+  // Empty the caller container
+  sizes.Clear();
+
+  FT_Face ftFace;
+  int error = FT_New_Face( mFreeTypeLibrary,
+                           path.c_str(),
+                           0,
+                           &ftFace );
+  if( FT_Err_Ok != error )
+  {
+    DALI_LOG_ERROR( "FreeType Cannot check font: %s\n", path.c_str() );
+  }
+
+  // Fetch the number of fixed sizes available
+  if ( ftFace->num_fixed_sizes && ftFace->available_sizes )
+  {
+    for ( int i = 0; i < ftFace->num_fixed_sizes; ++i )
+    {
+      sizes.PushBack( ftFace->available_sizes[ i ].size );
+    }
+  }
+}
+
+void FontClient::Plugin::GetFixedSizes( const FontFamily& fontFamily,
+                                        const FontStyle& fontStyle,
+                                        Dali::Vector< PointSize26Dot6 >& sizes )
+{
+  // Create a font pattern.
+  FcPattern* fontFamilyPattern = CreateFontFamilyPattern( fontFamily,
+                                                          fontStyle );
+
+  FcResult result = FcResultMatch;
+
+  // match the pattern
+  FcPattern* match = FcFontMatch( NULL /* use default configure */, fontFamilyPattern, &result );
+
+  if( match )
+  {
+    // Get the path to the font file name.
+    FontPath path;
+    GetFcString( match, FC_FILE, path );
+    return GetFixedSizes( path, sizes );
+  }
+  DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() );
+}
+
 } // namespace Internal
 
 } // namespace TextAbstraction
index e4995a7..8bf3795 100644 (file)
@@ -87,13 +87,15 @@ struct FontClient::Plugin
                const FontPath& path,
                PointSize26Dot6 pointSize,
                FaceIndex face,
-               const FontMetrics& metrics );
+               const FontMetrics& metrics,
+               bool isFixedSizeBitmap = false );
 
-    FT_Face mFreeTypeFace;      ///< The FreeType fance.
+    FT_Face mFreeTypeFace;      ///< The FreeType face.
     FontPath mPath;             ///< The path to the font file name.
     PointSize26Dot6 mPointSize; ///< The font point size.
     FaceIndex mFaceIndex;       ///< The face index.
     FontMetrics mMetrics;       ///< The font metrics.
+    bool mIsFixedSizeBitmap;    ///< Font is fixed size bitmap.
   };
 
   /**
@@ -166,6 +168,28 @@ struct FontClient::Plugin
                     FaceIndex faceIndex );
 
   /**
+   * @copydoc Dali::FontClient::IsScalable(const FontPath& path )
+   */
+  bool IsScalable( const FontPath& path );
+
+  /**
+   * @copydoc Dali::FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle )
+   */
+  bool IsScalable( const FontFamily& fontFamily, const FontStyle& fontStyle );
+
+  /**
+   * @copydoc Dali::FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
+   */
+  void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
+
+  /**
+   * @copydoc Dali::FontClient::GetFixedSizes( const FontFamily& fontFamily, const FontStyle& fontStyle, Dali::Vector< PointSize26Dot6>& sizes )
+   */
+  void GetFixedSizes( const FontFamily& fontFamily,
+                      const FontStyle& fontStyle,
+                      Dali::Vector< PointSize26Dot6 >& sizes );
+
+  /**
    * @copydoc Dali::FontClient::GetFontMetrics()
    */
   void GetFontMetrics( FontId fontId, FontMetrics& metrics );
@@ -236,6 +260,18 @@ private:
   FontId CreateFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription );
 
   /**
+   * @brief Creates a fixed size font
+   *
+   * @param[in] path The path to the font file name.
+   * @param[in] pointSize The font point size( must be an available size ).
+   * @param[in] faceIndex A face index.
+   * @param[in] cacheDescription Whether to cache the font description.
+   *
+   * @return The font id.
+   */
+  FontId CreateFixedSizeFont( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex, bool cacheDescription );
+
+  /**
    *
    * @param[in] destBitmap
    * @param[in] srcBitmap
@@ -283,6 +319,17 @@ private:
                  PointSize26Dot6 pointSize,
                  FontId& fontId );
 
+  /**
+   * @brief Validate a font family and style
+   *
+   * @param[in] fontFamily Font Family to validate
+   * @param[in] fontStyle Font Style to validate
+   * @param[out] validatedFontId Result of validation
+   */
+  void ValidateFont( const FontFamily& fontFamily,
+                     const FontStyle& fontStyle,
+                     FontDescriptionId& validatedFontId );
+
   FT_Library mFreeTypeLibrary; ///< A handle to a FreeType library instance.
 
   unsigned int mDpiHorizontal; ///< Horizontal dpi.
index 90aa49a..81027cf 100644 (file)
@@ -125,6 +125,28 @@ BitmapImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
   return GetImplementation(*this).CreateBitmap( fontId, glyphIndex );
 }
 
+bool FontClient::IsScalable( const FontPath& path )
+{
+  return GetImplementation(*this).IsScalable( path );;
+}
+
+bool FontClient::IsScalable( const FontFamily& fontFamily, const FontStyle& style )
+{
+  return GetImplementation(*this).IsScalable( fontFamily, style );
+}
+
+void FontClient::GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes )
+{
+  GetImplementation(*this).GetFixedSizes( path, sizes );
+}
+
+void FontClient::GetFixedSizes( const FontFamily& fontFamily,
+                                const FontStyle& style,
+                                Dali::Vector< PointSize26Dot6 >& sizes )
+{
+  GetImplementation(*this).GetFixedSizes( fontFamily, style, sizes );
+}
+
 FontClient::FontClient( Internal::FontClient* internal )
 : BaseHandle( internal )
 {
index aa63353..afec3ba 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 // INTERNAL INCLUDES
+#include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/images/bitmap-image.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/text-abstraction/font-list.h>
@@ -187,6 +188,42 @@ public:
                     PointSize26Dot6 pointSize = DEFAULT_POINT_SIZE,
                     FaceIndex faceIndex = 0 );
 
+  /**
+   * @brief Check to see if a font is scalable.
+   *
+   * @param[in] path The path to a font file.
+   * @return true if scalable.
+   */
+  bool IsScalable( const FontPath& path );
+
+  /**
+   * @brief Check to see if a font is scalable.
+   *
+   * @param[in] fontFamily The font family name.
+   * @param[in] style The font style.
+   * @return true if scalable
+   */
+  bool IsScalable( const FontFamily& fontFamily, const FontStyle& style );
+
+  /**
+   * @brief Get a list of sizes available for a fixed size font.
+   *
+   * @param[in] path The path to a font file.
+   * @param[out] sizes A list of the available sizes, if no sizes available will return empty.
+   */
+  void GetFixedSizes( const FontPath& path, Dali::Vector< PointSize26Dot6>& sizes );
+
+  /**
+   * @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.
+   * @param[out] sizes A list of the available sizes, if no sizes available will return empty.
+   */
+  void GetFixedSizes( const FontFamily& fontFamily,
+                      const FontStyle& style,
+                      Dali::Vector< PointSize26Dot6 >& sizes );
+
   ////////////////////////////////////////
   // Font metrics, glyphs and bitmaps.
   ////////////////////////////////////////