shithub: freetype+ttf2subf

Download patch

ref: 7e3df82efdd2c9cc39ce169873cd95a5e29e9532
parent: 87a2bc7b693dd6758dfab4faddf49bec6193ab1c
author: Werner Lemberg <[email protected]>
date: Thu Jun 20 17:03:48 EDT 2002

* src/base/fttype1.c: Include FT_INTERNAL_TYPE42_TYPES_H.
(t1_face_check_cast): Removed.
(FT_Get_PS_Font_Info): Make it work with CID and Type 42 drivers
also.

* src/type42/t42parse.c (t42_parse_sfnts): Fix compiler warning.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-06-19  Detlef W�rkner  <[email protected]>
+
+	* src/base/fttype1.c: Include FT_INTERNAL_TYPE42_TYPES_H.
+	(t1_face_check_cast): Removed.
+	(FT_Get_PS_Font_Info): Make it work with CID and Type 42 drivers
+	also.
+
+2002-06-19  Sebastien BARRE  <[email protected]>
+
+	* src/type42/t42parse.c (t42_parse_sfnts): Fix compiler warning.
+
 2002-06-19  Werner Lemberg  <[email protected]>
 
 	* src/base/ftoutln.c (FT_Vector_Transform): Fix serious typo
--- a/src/base/fttype1.c
+++ b/src/base/fttype1.c
@@ -18,35 +18,10 @@
 
 #include <ft2build.h>
 #include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_TYPE42_TYPES_H
 #include FT_INTERNAL_OBJECTS_H
 
 
-  /* Cast a FT_Face to a T1_Face if necessary.                           */
-  /* This implementation sucks, but a lot of things should change in the */
-  /* future anyway...                                                    */
-  /*                                                                     */
-  static T1_Face
-  t1_face_check_cast( FT_Face  face )
-  {
-    FT_Module  driver;
-    T1_Face    result = NULL;
-
-
-    if ( face && face->driver != NULL )
-    {
-      driver = (FT_Module)face->driver;
-
-      if ( driver->clazz && driver->clazz->module_name &&
-           ft_strcmp( driver->clazz->module_name, "type1" ) == 0 )
-      {
-        /* correct typecast! */
-        result = (T1_Face)face;
-      }
-    }
-    return result;
-  }
-
-
   /* documentation is in t1tables.h */
 
   FT_EXPORT_DEF( FT_Error )
@@ -53,14 +28,25 @@
   FT_Get_PS_Font_Info( FT_Face          face,
                        PS_FontInfoRec*  afont_info )
   {
-    FT_Error  error   = FT_Err_Invalid_Argument;
-    T1_Face   t1_face = t1_face_check_cast( face );
+    PS_FontInfo  font_info = NULL;
+    FT_Error     error     = FT_Err_Invalid_Argument;
+    const char*  driver_name;
 
 
-    if ( t1_face != NULL )
+    if ( face && face->driver && face->driver->root.clazz )
     {
-      *afont_info = t1_face->type1.font_info;
-      error       = FT_Err_Ok;
+      driver_name = face->driver->root.clazz->module_name;
+      if ( ft_strcmp( driver_name, "type1" ) == 0 )
+        font_info = &((T1_Face)face)->type1.font_info;
+      else if ( ft_strcmp( driver_name, "t1cid" ) == 0 )
+        font_info = &((CID_Face)face)->cid.font_info;
+      else if ( ft_strcmp( driver_name, "type42" ) == 0 )
+        font_info = &((T42_Face)face)->type42.font_info;
+    }
+    if ( font_info != NULL )
+    {
+      *afont_info = *font_info;
+      error = FT_Err_Ok;
     }
 
     return error;
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -629,7 +629,8 @@
           goto Fail;
         }
 
-        v = (FT_Byte)( 16 * t42_hexval( *cur++ ) + t42_hexval( *cur++ ) );
+        v = (FT_Byte)( 16 * t42_hexval( *cur ) + t42_hexval( *( cur + 1 ) ) );
+        cur += 2;
         string_size++;
       }