Allow up-scaling of Emojis 86/57886/3
authorPaul Wisbey <p.wisbey@samsung.com>
Mon, 25 Jan 2016 17:10:33 +0000 (17:10 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 25 Jan 2016 17:26:04 +0000 (17:26 +0000)
Change-Id: I0a77babdfa910ca32f7a9da576b301e12364f7d6

text/dali/devel-api/text-abstraction/font-client.cpp
text/dali/devel-api/text-abstraction/font-client.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 c508990..414c45c 100644 (file)
@@ -138,9 +138,9 @@ void FontClient::GetFixedSizes( const FontDescription& fontDescription,
   GetImplementation(*this).GetFixedSizes( fontDescription, sizes );
 }
 
-void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics, int maxFixedSize )
+void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize )
 {
-  GetImplementation(*this).GetFontMetrics( fontId, metrics, maxFixedSize );
+  GetImplementation(*this).GetFontMetrics( fontId, metrics, desiredFixedSize );
 }
 
 GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
@@ -148,9 +148,9 @@ GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
   return GetImplementation(*this).GetGlyphIndex( fontId, charcode );
 }
 
-bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int maxFixedSize )
+bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int desiredFixedSize )
 {
-  return GetImplementation(*this).GetGlyphMetrics( array, size, horizontal, maxFixedSize );
+  return GetImplementation(*this).GetGlyphMetrics( array, size, horizontal, desiredFixedSize );
 }
 
 BufferImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
index 262a0cf..a1ffcb5 100644 (file)
@@ -270,9 +270,9 @@ public:
    *
    * @param[in] fontId The ID of the font for the required glyph.
    * @param[out] metrics The font metrics.
-   * @param[in] maxFixedSize The metrics for fixed-size fonts will be down-scaled, when exceeding this maximum value in pixels.
+   * @param[in] desiredFixedSize The metrics for fixed-size fonts will be scaled to this desired size (in pixels).
    */
-  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int maxFixedSize = 0 );
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize = 0 );
 
   /**
    * @brief Retrieve the glyph index for a UTF-32 character code.
@@ -291,10 +291,10 @@ public:
    * On return, the glyph's size value will be initialized. The bearing value will be updated by adding the font's glyph bearing to the one set by the shaping tool.
    * @param[in] size The size of the array.
    * @param[in] horizontal True for horizontal layouts (set to false for vertical layouting).
-   * @param[in] maxFixedSize The metrics for fixed-size fonts will be down-scaled, when exceeding this maximum value in pixels.
+   * @param[in] desiredFixedSize The metrics for fixed-size fonts will be scaled to this desired size (in pixels).
    * @return True if all of the requested metrics were found.
    */
-  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal = true, int maxFixedSize = 0 );
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal = true, int desiredFixedSize = 0 );
 
   /**
    * @brief Render a bitmap representation of a glyph.
index 01a75e3..2521dd6 100644 (file)
@@ -189,11 +189,11 @@ FontId FontClient::GetFontId( const FontDescription& fontDescription,
                              faceIndex );
 }
 
-void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics, int maxFixedSize )
+void FontClient::GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize )
 {
   CreatePlugin();
 
-  return mPlugin->GetFontMetrics( fontId, metrics, maxFixedSize );
+  return mPlugin->GetFontMetrics( fontId, metrics, desiredFixedSize );
 }
 
 GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
@@ -203,11 +203,11 @@ GlyphIndex FontClient::GetGlyphIndex( FontId fontId, Character charcode )
   return mPlugin->GetGlyphIndex( fontId, charcode );
 }
 
-bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int maxFixedSize )
+bool FontClient::GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int desiredFixedSize )
 {
   CreatePlugin();
 
-  return mPlugin->GetGlyphMetrics( array, size, horizontal, maxFixedSize );
+  return mPlugin->GetGlyphMetrics( array, size, horizontal, desiredFixedSize );
 }
 
 BufferImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
index aebdbd7..74edd11 100644 (file)
@@ -141,7 +141,7 @@ public:
   /**
    * @copydoc Dali::FontClient::GetFontMetrics()
    */
-  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int maxFixedSize );
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize );
 
   /**
    * @copydoc Dali::FontClient::GetGlyphIndex()
@@ -151,7 +151,7 @@ public:
   /**
    * @copydoc Dali::FontClient::GetGlyphMetrics()
    */
-  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int maxFixedSize );
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int desiredFixedSize );
 
   /**
    * @copydoc Dali::FontClient::CreateBitmap()
index a1edfd4..3653603 100644 (file)
@@ -649,7 +649,7 @@ void FontClient::Plugin::ValidateFont( const FontDescription& fontDescription,
 
 void FontClient::Plugin::GetFontMetrics( FontId fontId,
                                          FontMetrics& metrics,
-                                         int maxFixedSize )
+                                         int desiredFixedSize )
 {
   if( fontId > 0 &&
       fontId-1 < mFontCache.size() )
@@ -660,10 +660,9 @@ void FontClient::Plugin::GetFontMetrics( FontId fontId,
 
     // Adjust the metrics if the fixed-size font should be down-scaled
     if( font.mIsFixedSizeBitmap &&
-        ( maxFixedSize > 0 ) &&
-        ( font.mFixedHeightPixels > maxFixedSize ) )
+        ( desiredFixedSize > 0 ) )
     {
-      float scaleFactor = static_cast<float>(maxFixedSize) / static_cast<float>(font.mFixedHeightPixels);
+      float scaleFactor = static_cast<float>(desiredFixedSize) / static_cast<float>(font.mFixedHeightPixels);
 
       metrics.ascender           *= scaleFactor;
       metrics.descender          *= scaleFactor;
@@ -697,7 +696,7 @@ GlyphIndex FontClient::Plugin::GetGlyphIndex( FontId fontId,
 bool FontClient::Plugin::GetGlyphMetrics( GlyphInfo* array,
                                           uint32_t size,
                                           bool horizontal,
-                                          int maxFixedSize )
+                                          int desiredFixedSize )
 {
   bool success( true );
 
@@ -726,10 +725,9 @@ bool FontClient::Plugin::GetGlyphMetrics( GlyphInfo* array,
           array[i].yBearing = font.mFixedHeightPixels;
 
           // Adjust the metrics if the fixed-size font should be down-scaled
-          if( ( maxFixedSize > 0 ) &&
-              ( font.mFixedHeightPixels > maxFixedSize ) )
+          if( desiredFixedSize > 0 )
           {
-            float scaleFactor = static_cast<float>(maxFixedSize) / static_cast<float>(font.mFixedHeightPixels);
+            float scaleFactor = static_cast<float>(desiredFixedSize) / static_cast<float>(font.mFixedHeightPixels);
 
             array[i].width    *= scaleFactor;
             array[i].height   *= scaleFactor;
index bcfaec1..32bba4a 100644 (file)
@@ -237,7 +237,7 @@ struct FontClient::Plugin
   /**
    * @copydoc Dali::FontClient::GetFontMetrics()
    */
-  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int maxFixedSize );
+  void GetFontMetrics( FontId fontId, FontMetrics& metrics, int desiredFixedSize );
 
   /**
    * @copydoc Dali::FontClient::GetGlyphIndex()
@@ -247,7 +247,7 @@ struct FontClient::Plugin
   /**
    * @copydoc Dali::FontClient::GetGlyphMetrics()
    */
-  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int maxFixedSize );
+  bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal, int desiredFixedSize );
 
   /**
    * @copydoc Dali::FontClient::CreateBitmap()