shithub: freetype+ttf2subf

Download patch

ref: cb9109fc4013c04b1fdb6c6c1bd1294dd3602448
parent: 2b9be99c2a6a3b7e27e4043685475ac06f5951ab
author: Werner Lemberg <[email protected]>
date: Fri Jun 9 01:25:19 EDT 2000

Applied Tom's patches to improve CFF handling.

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -406,22 +406,35 @@
       error = t2_new_cff_index( &font->charstrings_index, stream, 0 );
       if (error) goto Exit;
 
-      /* read the local subrs */      
-      if ( FILE_Seek( base_offset + font->top_dict.private_offset +
-                      font->private_dict.local_subrs_offset ) )
-        goto Exit;
+      /* read the local subrs, if any */
+
+      if (font->private_dict.local_subrs_offset) {
+
+	if ( FILE_Seek( base_offset + font->top_dict.private_offset +
+			font->private_dict.local_subrs_offset ) )
+	  goto Exit;
         
-      error = t2_new_cff_index( &font->local_subrs_index, stream, 1 );
-      if (error) goto Exit;
+	error = t2_new_cff_index( &font->local_subrs_index, stream, 1 );
+	if (error) goto Exit;
+      }
       
       /* explicit the global and local subrs */
-      font->num_local_subrs  = font->local_subrs_index.count;
+
+      if (font->private_dict.local_subrs_offset) {
+	font->num_local_subrs  = font->local_subrs_index.count;
+      } else {
+	font->num_local_subrs = 0;
+      }
+
       font->num_global_subrs = font->global_subrs_index.count;
       
-      error = t2_explicit_cff_index( &font->global_subrs_index,
-                                     &font->global_subrs ) ||
-              t2_explicit_cff_index( &font->local_subrs_index,
-                                     &font->local_subrs );
+
+      error = t2_explicit_cff_index( &font->global_subrs_index, &font->global_subrs ) ;
+
+      if (font->private_dict.local_subrs_offset) {
+	error |= t2_explicit_cff_index( &font->local_subrs_index, &font->local_subrs ) ;
+      }
+
       if (error) goto Exit;
     }