freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] parthw-demos 5138e19: Accept `tfm' file to be attached


From: Parth Wazurkar
Subject: [freetype2-demos] parthw-demos 5138e19: Accept `tfm' file to be attached to `gf' and `pk' files.
Date: Fri, 10 Aug 2018 00:09:44 -0400 (EDT)

branch: parthw-demos
commit 5138e19e1b90bac6ff7e7694e81ef143343652bd
Author: Parth Wazurkar <address@hidden>
Commit: Parth Wazurkar <address@hidden>

    Accept `tfm' file to be attached to `gf' and `pk' files.
---
 src/ftcommon.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/ftcommon.c b/src/ftcommon.c
index 1ef3495..02fa82e 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -236,14 +236,15 @@
       const char*  format = FT_Get_Font_Format( *aface );
 
 
-      if ( !strcmp( format, "Type 1" ) )
+      if ( !strcmp( format, "Type 1" ) || !strcmp( format, "GF" ) || !strcmp( 
format, "PK" ) )
       {
         char   orig[5];
         char*  suffix        = (char*)strrchr( font->filepathname, '.' );
         int    has_extension = suffix                                &&
                                ( strcasecmp( suffix, ".pfa" ) == 0 ||
-                                 strcasecmp( suffix, ".pfb" ) == 0 );
-
+                                 strcasecmp( suffix, ".pfb" ) == 0 ||
+                                 strcasecmp( suffix, ".600gf" ) == 0  ||
+                                 strcasecmp( suffix, ".600pk" ) == 0 );
 
         if ( has_extension )
           memcpy( orig, suffix, 5 );
@@ -251,10 +252,23 @@
           /* we have already allocated four more bytes */
           suffix = (char*)font->filepathname + strlen( font->filepathname );
 
-        memcpy( suffix, ".afm", 5 );
-        if ( FT_Attach_File( *aface, font->filepathname ) )
+        if( !strcmp( format, "Type 1" ) )
+        {
+          memcpy( suffix, ".afm", 5 );
+          if ( FT_Attach_File( *aface, font->filepathname ) )
+          {
+            memcpy( suffix, ".pfm", 5 );
+            FT_Attach_File( *aface, font->filepathname );
+          }
+        }
+        else if( !strcmp( format, "GF" ) )
+        {
+          memcpy( suffix, ".tfm", 5 );
+          FT_Attach_File( *aface, font->filepathname );
+        }
+        else if( !strcmp( format, "PK" ) )
         {
-          memcpy( suffix, ".pfm", 5 );
+          memcpy( suffix, ".tfm", 5 );
           FT_Attach_File( *aface, font->filepathname );
         }
 



reply via email to

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