freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] parthw-cleaned 8ce66d7 11/42: [gf] Added GF_Size_Request and


From: Parth Wazurkar
Subject: [freetype2] parthw-cleaned 8ce66d7 11/42: [gf] Added GF_Size_Request and GF_Size_Select functions.
Date: Mon, 30 Jul 2018 14:20:01 -0400 (EDT)

branch: parthw-cleaned
commit 8ce66d72c8bffa88369985971ecea154ef530ec5
Author: Parth Wazurkar <address@hidden>
Commit: Parth Wazurkar <address@hidden>

    [gf] Added GF_Size_Request and GF_Size_Select functions.
---
 src/gf/gfdrivr.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 53 insertions(+), 5 deletions(-)

diff --git a/src/gf/gfdrivr.c b/src/gf/gfdrivr.c
index 4959c07..ee20b70 100644
--- a/src/gf/gfdrivr.c
+++ b/src/gf/gfdrivr.c
@@ -39,7 +39,7 @@
 
   typedef struct  GF_CMapRec_
   {
-    FT_CMapRec        cmap;            
+    FT_CMapRec        cmap;
     FT_UInt32         bc;       /* Beginning Character */
     FT_UInt32         ec;       /* End Character */
   } GF_CMapRec, *GF_CMap;
@@ -76,12 +76,12 @@
   {
     FT_UInt  gindex = 0;
     GF_CMap  cmap   = (GF_CMap)gfcmap;
-               
+
     char_code -= cmap->bc;
-   
+
     if ( char_code < cmap->ec - cmap->bc + 1 )
       gindex = (FT_UInt)( char_code );
-    
+
     return gindex;
   }
 
@@ -145,10 +145,58 @@
   }
 
   FT_CALLBACK_DEF( FT_Error )
+  GF_Size_Select(  FT_Size   size,
+                   FT_ULong  strike_index )
+  {
+    GF_Face        face   = (GF_Face)size->face;
+
+    FT_UNUSED( strike_index );
+
+
+    FT_Select_Metrics( size->face, 0 );
+
+    size->metrics.ascender    =  /*  */  ;
+    size->metrics.descender   =  /*  */  ;
+    size->metrics.max_advance =  /*  */  ;
+
+    return FT_Err_Ok;
+
+  }
+
+  FT_CALLBACK_DEF( FT_Error )
   GF_Size_Request(  FT_Size          size,
                     FT_Size_Request  req )
   {
-    //TO-DO
+    GF_Face           face    = (GF_Face)size->face;
+    FT_Bitmap_Size*   bsize   = size->face->available_sizes;
+    FT_Error          error   = FT_ERR( Invalid_Pixel_Size );
+    FT_Long           height;
+
+
+    height = FT_REQUEST_HEIGHT( req );
+    height = ( height + 32 ) >> 6;
+
+    switch ( req->type )
+    {
+    case FT_SIZE_REQUEST_TYPE_NOMINAL:
+      if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) )
+        error = FT_Err_Ok;
+      break;
+
+    case FT_SIZE_REQUEST_TYPE_REAL_DIM:
+      if ( height == /*  */ )
+        error = FT_Err_Ok;
+      break;
+
+    default:
+      error = FT_THROW( Unimplemented_Feature );
+      break;
+    }
+
+    if ( error )
+      return error;
+    else
+      return GF_Size_Select( size, 0 );
   }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]