shithub: freetype+ttf2subf

Download patch

ref: f5dcdd5cfb6d66fd1e75508b7bd85da58973e921
parent: 5e4c2cb3bfdf883e5043b766eb9ee8ea00bc2b22
author: David Turner <[email protected]>
date: Tue May 23 18:16:27 EDT 2000

minor fix to the Type1 driver(s) to apply the font matrix when
necessary..

git/fs: mount .git/fs: mount/attach disallowed
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 LATEST_CHANGES
 
+  - a minor fix to the Type 1 driver to let them apply the font matrix
+    correctly (used for many oblique fonts..)
+
   - some fixes for 64-bit systems (mainly changing some FT_TRACE calls
     to use %p instead of %lx).. Thanks to Karl Robillard
 
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -1565,6 +1565,9 @@
         FT_BBox           cbox;
         FT_Glyph_Metrics* metrics = &glyph->root.metrics;
 
+        /* apply the font matrix */
+        FT_Outline_Transform( &glyph->root.outline, &face->type1.font_matrix );
+
         FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
 
         /* grid fit the bounding box if necessary */
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -586,8 +586,8 @@
         switch (n)
         {
           case 0 : result = &matrix->xx; break;
-          case 1 : result = &matrix->xy; break;
-          case 2 : result = &matrix->yx; break;
+          case 1 : result = &matrix->yx; break;
+          case 2 : result = &matrix->xy; break;
           default: result = &matrix->yy;
         }
 
--- a/src/type1z/t1gload.c
+++ b/src/type1z/t1gload.c
@@ -1349,6 +1349,9 @@
           metrics->vertAdvance  = FT_MulFix( metrics->vertAdvance,  x_scale );
         }
 
+        /* apply the font matrix */
+        FT_Outline_Transform( &glyph->root.outline, &face->type1.font_matrix );
+
         /* compute the other metrics */
         FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
 
--- a/src/type1z/t1parse.c
+++ b/src/type1z/t1parse.c
@@ -579,6 +579,43 @@
     return t1_tobool( &parser->cursor, parser->limit );
   }
 
+
+#if 0
+  /* load a single field in an object */
+  LOCAL_FUNC
+  T1_Error  T1_Load_Field( T1_Parser*     parser,
+                           void*          object,
+                           T1_Field_Rec*  field )
+  {
+    FT_Byte*  p       = (FT_Byte*)object + field->offset;
+    FT_Byte** pcursor = &parser->cursor;
+    FT_Byte*  limit   = parser->limit;
+    
+    switch (field->type)
+    {
+      case t1_field_boolean:
+        *(T1_Bool*)p = t1_tobool( pcursor, limit );
+        break;
+        
+      case t1_field_string:
+        *(T1_String**)p = t1_tostring( pcursor, limit, parser->memory );
+        break;
+        
+      case t1_field_int:
+        *(T1_Long*)p = t1_toint( pcursor, limit );
+        break;
+        
+      case t1_field_fixed:
+        *(T1_Fixed*)p = t1_tofixed( pcursor, limit, field->power_ten );
+        break;
+        
+      default:
+        return T1_Err_Invalid_Argument;
+    }
+    return 0;
+  }                           
+#endif
+
   static
   FT_Error  read_pfb_tag( FT_Stream  stream, T1_UShort *tag, T1_Long*  size )
   {
--- a/src/type1z/t1parse.h
+++ b/src/type1z/t1parse.h
@@ -37,6 +37,30 @@
   extern "C" {
 #endif
 
+
+  typedef enum T1_Field_Type_
+  {
+    t1_field_none = 0,
+    t1_field_bool,
+    t1_field_integer,
+    t1_field_fixed,
+    t1_field_string,
+    t1_field_fixed_array,
+    t1_field_coord_array
+    
+  } T1_Field_Type;
+  
+  
+  typedef struct T1_Field_Rec_
+  {
+    T1_Field_Type  type;      /* type of field                        */
+    FT_UInt        offset;    /* offset of field in object            */
+    FT_UInt        size;      /* size of field in bytes               */
+    T1_Int         array_max; /* maximum number of elements for array */
+    T1_Int         power_ten; /* power of ten for "fixed" fields      */
+    
+  } T1_Field_Rec;
+  
 /*************************************************************************
  *
  * <Struct> T1_Table
@@ -181,6 +205,14 @@
 #if 0
   LOCAL_DEF
   T1_Int  T1_ToImmediate( T1_Parser*  parser );
+#endif
+
+#if 0
+  /* load a single field in an object */
+  LOCAL_DEF
+  T1_Error  T1_Load_Field( T1_Parser*     parser,
+                           void*          object,
+                           T1_Field_Rec*  field );
 #endif
 
   LOCAL_DEF