shithub: freetype+ttf2subf

Download patch

ref: ae340bbfec2182fd4f56f9888095d61a5601bcba
parent: 3200d68dc6c493caa8f515e850143cee3d0ff228
author: Leonard Rosenthol <[email protected]>
date: Fri Oct 26 09:24:39 EDT 2001

Incorporated changes for faces other than the first

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -218,14 +218,20 @@
 
 
   /* Look inside the FOND data, answer whether there should be an SFNT
-     resource, and answer the name of a possible LWFN Type 1 file. */
+     resource, and answer the name of a possible LWFN Type 1 file. 
+     
+     Thanks to Paul Miller ([email protected]) for the fix 
+     to load a face OTHER than the first one in the FOND!
+  */
   static void
   parse_fond( char*   fond_data,
               short*  have_sfnt,
               short*  sfnt_id,
-              Str255  lwfn_file_name )
+              Str255  lwfn_file_name,
+              short   face_index )
   {
     AsscEntry*  assoc;
+    AsscEntry*  base_assoc;
     FamRec*     fond;
 
 
@@ -235,12 +241,20 @@
 
     fond = (FamRec*)fond_data;
     assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
+    base_assoc = assoc;
+    assoc += face_index;        /* add on the face_index! */
 
+    /* if the face at this index is not scalable, fall back to the first one (old behavior) */
     if ( assoc->fontSize == 0 )
     {
       *have_sfnt = 1;
       *sfnt_id = assoc->fontID;
     }
+    else if (base_assoc->fontSize == 0)
+    {
+      *have_sfnt = 1;
+      *sfnt_id = base_assoc->fontID;
+    }
 
     if ( fond->ffStylOff )
     {
@@ -638,7 +652,7 @@
       return FT_Err_Invalid_File_Format;
 
     HLock( fond );
-    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name );
+    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
     HUnlock( fond );
 
     if ( lwfn_file_name[0] )