shithub: freetype+ttf2subf

Download patch

ref: 81bb4ad937f21e5fe64b2bdfef98250984e37eff
parent: 9d636b6d14dc5decc9651757e15faab5267b0873
author: David Turner <[email protected]>
date: Wed Jun 28 00:19:49 EDT 2000

latest clean-ups..

The code compiles with NO WARNINGS with GCC and
Visual C++ (also with LCC minus debugging options)

git/fs: mount .git/fs: mount/attach disallowed
--- a/BUILD
+++ b/BUILD
@@ -222,9 +222,9 @@
      src/base/ftinit.c           - initialisation layer
      src/base/ftdebug.c          - debugging component (empty in release build)
      src/base/ftbase.c           - the "base layer" component
-     src/base/ftraster.c         - the standard raster (scan-converter)
-     src/base/ftgrays.c          - the smooth raster (anti-aliased only)
      src/base/ftglyph.c          - optional convenience functions
+     src/raster1/raster1.c       - the monochrome bitmap renderer
+     src/smooth/smooth.c         - the anti-aliased bitmap renderer
      src/sfnt/sfnt.c             - the "sfnt" module
      src/psnames/psnames.c       - the "psnames" module
      src/truetype/truetype.c     - the TrueType font driver
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,9 @@
     
     "make multi" now works well :-)
     
+    Also removed the use of "cidafm" for now, even if the source files
+    are still there. This functionality will certainly go into a specific
+    module..
     
 
   - CHANGES TO THE RENDERER MODULES
--- a/config/win32/w32-lcc.mk
+++ b/config/win32/w32-lcc.mk
@@ -119,8 +119,8 @@
   #   librarian library_file {list of object files} 
   #
   $(FT_LIBRARY): $(OBJECTS_LIST)
-	  lcclib /out:$(subst $(SEP),$(HOSTSEP),$@) \
-                 $(subst $(SEP),$(HOSTSEP),$(OBJECTS_LIST))
+	  lcclib /out:$(subst $(SEP),\\,$@) \
+                 $(subst $(SEP),\\,$(OBJECTS_LIST))
 
 endif
 
--- a/demos/src/ftmulti.c
+++ b/demos/src/ftmulti.c
@@ -343,6 +343,8 @@
     const unsigned char* p;
 
 
+    ptsize=ptsize;
+
     start_x = 4;
     start_y = 32 + size->metrics.y_ppem;
 
@@ -586,7 +588,7 @@
     return 1;
 
   Do_Axis:
-    if ( axis < multimaster.num_axis )
+    if ( axis < (int)multimaster.num_axis )
     {
       FT_MM_Axis*  a   = multimaster.axis + axis;
       FT_Long      pos = design_pos[axis];
@@ -711,7 +713,7 @@
       int  n;
 
       
-      for ( n = 0; n < multimaster.num_axis; n++ )
+      for ( n = 0; n < (int)multimaster.num_axis; n++ )
         design_pos[n] =
           ( multimaster.axis[n].minimum + multimaster.axis[n].maximum ) / 2;
     }
@@ -790,7 +792,7 @@
           int  n;
 
 
-          for ( n = 0; n < multimaster.num_axis; n++ )
+          for ( n = 0; n < (int)multimaster.num_axis; n++ )
           {
             char  temp[32];
 
--- a/demos/src/ftview.c
+++ b/demos/src/ftview.c
@@ -601,7 +601,7 @@
     if ( debug )
     {
 #ifdef FT_DEBUG_LEVEL_TRACE
-      FT_SetTraceLevel( trace_any, trace_level );
+      FT_SetTraceLevel( trace_any, (FT_Byte)trace_level );
 #else
       trace_level = 0;
 #endif
--- a/demos/src/memtest.c
+++ b/demos/src/memtest.c
@@ -18,6 +18,7 @@
   int  Fail;
   int  Num;
 
+  extern void FT_Add_Default_Modules( FT_Library  library );
 
 
 
@@ -42,11 +43,6 @@
 static  MyBlock my_blocks[ MAX_RECORDED_BLOCKS ];
 static  int     num_my_blocks = 0;
 
-static
-void  rewind_memory( void )
-{
-  num_my_blocks = 0;
-}
 
 /* record a new block in the table, check for duplicates too */
 static
@@ -125,6 +121,7 @@
   if (p)
     record_my_block(p,size);
 
+  memory=memory;
   return p;
 }
 
@@ -131,6 +128,7 @@
 static
 void   my_free( FT_Memory memory, void*  block )
 {
+  memory=memory;
   forget_my_block(block);
   /* free(block);  WE DO NOT REALLY FREE THE BLOCK */
 }
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -184,6 +184,7 @@
     FT_FaceRec    root;
     void*         psnames;
     CID_Info      cid;
+    void*         afm_data;
     CID_Subrs*    subrs;
   
   } CID_FaceRec;
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2257,7 +2257,7 @@
 
     
     if ( !result || result->glyph_format != slot->format )
-      result = ft_lookup_renderer( library, slot->format, 0 );
+      result = FT_Lookup_Renderer( library, slot->format, 0 );
     
     return result;
   }
@@ -2439,7 +2439,6 @@
   }                                           
 
 
-<<<<<<< ftobjs.c
  /*************************************************************************
   *
   *  <Function>
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -645,12 +645,27 @@
         *(FT_UShort*)p = (FT_UShort)value;
         break;
 
+     /* A slight note regarding the following:                    */
+     /*                                                           */
+     /*  SIZEOF_INT is defined in <freetype/config/ftconfig.h>    */
+     /*  and gives the size in bytes of the "int" type on the     */
+     /*  current platform..                                       */
+     /*                                                           */
+     /*  Only on 16-bit systems can the value of SIZEOF_INT be    */
+     /*  less than 4. In this case SIZEOF_LONG is always 4        */
+     /*                                                           */
+     /*  On a 64-bit system, SIZEOF_LONG can be 8, which is       */
+     /*  handled by the default case..                            */
+     /*                                                           */
+
+#if SIZEOF_INT == 4
       case 4:
-         *(FT_ULong*)p = (FT_ULong)value;
+         *(FT_UInt*)p = (FT_UInt)value;
          break;
+#endif
 
       default:
-         ;          /* ignore! */
+         *(FT_ULong*)p = (FT_ULong)value;
       }
 
       /* go to next field */
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -363,6 +363,10 @@
     if (cff->num_subfonts >= 1)
     {
       FT_Byte  fd_index = CFF_Get_FD( &cff->fd_select, glyph_index );
+      if (fd_index >= cff->num_subfonts)
+      {
+        FT_ERROR(( "INVALID FD INDEX = %d >= %d\n", fd_index, cff->num_subfonts ));
+      }
       sub = cff->subfonts[fd_index];
     }
     
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -516,17 +516,28 @@
             case t2_kind_fixed:
               val = t2_parse_fixed( parser->stack );
 
+            /* A slight note regarding the following:                    */
+            /*                                                           */
+            /*  SIZEOF_INT is defined in <freetype/config/ftconfig.h>    */
+            /*  and gives the size in bytes of the "int" type on the     */
+            /*  current platform..                                       */
+            /*                                                           */
+            /*  Only on 16-bit systems can the value of SIZEOF_INT be    */
+            /*  less than 4. In this case SIZEOF_LONG is always 4        */
+            /*                                                           */
+            /*  On a 64-bit system, SIZEOF_LONG can be 8, which is       */
+            /*  handled by the default case..                            */
+            /*                                                           */
+
             Store_Number:
               switch ( field->size )
               {
-              case 1:
-                *(FT_Byte*)q = (FT_Byte)val;
-                break;
-              case 2:
-                *(FT_Short*)q = (FT_Short)val;
-                break;
-              default:
-                *(FT_Long*)q = val;
+                case 1:  *(FT_Byte*)q  = (FT_Byte)val;  break;
+                case 2:  *(FT_Short*)q = (FT_Short)val; break;
+#if SIZEOF_INT == 4
+                case 4:  *(FT_Int*)q   = (FT_Int)val;   break;
+#endif
+                default: *(FT_Long*)q  = val;
               }
               break;
 
--- a/src/cid/cidafm.c
+++ b/src/cid/cidafm.c
@@ -159,7 +159,7 @@
 
   /* parse an AFM file - for now, only read the kerning pairs */
   LOCAL_FUNC
-  FT_Error  CID_Read_AFM( FT_Face    t1_face,
+  FT_Error  CID_Read_AFM( FT_Face    cid_face,
                           FT_Stream  stream )
   {
     FT_Error       error;
@@ -168,9 +168,9 @@
     FT_Byte*       limit;
     FT_Byte*       p;
     FT_Int         count = 0;
-    CID_Kern_Pair*  pair;
+    CID_Kern_Pair* pair;
     T1_Font*       type1 = &((T1_Face)t1_face)->type1;
-    CID_AFM*        afm   = 0;
+    CID_AFM*       afm   = 0;
 
 
     if ( ACCESS_Frame( stream->size ) )
--- a/src/cid/cidafm.h
+++ b/src/cid/cidafm.h
@@ -32,7 +32,7 @@
 
   typedef struct  CID_AFM_
   {
-    FT_Int         num_pairs;
+    FT_UInt         num_pairs;
     CID_Kern_Pair*  kern_pairs;
 
   } CID_AFM;
@@ -41,15 +41,15 @@
 #if 1
 
   LOCAL_DEF
-  FT_Error  CID_Read_AFM( FT_Face    t1_face,
+  FT_Error  CID_Read_AFM( FT_Face    cid_face,
                           FT_Stream  stream );
 
   LOCAL_DEF
   void  CID_Done_AFM( FT_Memory  memory,
-                      CID_AFM*    afm );
+                      CID_AFM*   afm );
 
   LOCAL_DEF
-  void  CID_Get_Kerning( CID_AFM*     afm,
+  void  CID_Get_Kerning( CID_AFM*    afm,
                          FT_UInt     glyph1,
                          FT_UInt     glyph2,
                          FT_Vector*  kerning );
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -1324,10 +1324,10 @@
       goto Exit;
 
     p = (FT_Byte*)stream->cursor;
-    fd_select = (FT_UInt) cid_get_offset( &p, cid->fd_bytes );
-    off1      = (FT_ULong)cid_get_offset( &p, cid->gd_bytes );
+    fd_select = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
+    off1      = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
     p        += cid->fd_bytes;
-    glyph_len = cid_get_offset( &p, cid->gd_bytes ) - off1;
+    glyph_len = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;
 
     FORGET_Frame();
 
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -400,7 +400,7 @@
 
       p = (FT_Byte*)stream->cursor;
       for ( count = 0; count <= num_subrs; count++ )
-        offsets[count] = cid_get_offset( &p, dict->sd_bytes );
+        offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes );
 
       FORGET_Frame();
 
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -22,7 +22,6 @@
 #include <cidgload.h>
 #include <cidload.h>
 #include <freetype/internal/psnames.h>
-#include <cidafm.h>
 
 
   /*************************************************************************/
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -18,7 +18,6 @@
 
 #include <cidriver.h>
 #include <cidgload.h>
-#include <cidafm.h>
 
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
@@ -48,7 +47,7 @@
   }
 
 
-#ifndef T1_CONFIG_OPTION_NO_AFM
+#if 0 /* unimplemented for now.. */
 
   static
   FT_Error  cid_Get_Kerning( T1_Face     face,
@@ -70,7 +69,7 @@
   }
 
 
-#endif /* !T1_CONFIG_OPTION_NO_AFM */
+#endif /* 0 */
 
 
   /*************************************************************************/
@@ -209,13 +208,8 @@
     (FTDriver_loadGlyph)    CID_Load_Glyph,
     (FTDriver_getCharIndex) CID_Get_Char_Index,
 
-#ifdef T1_CONFIG_OPTION_NO_AFM
     (FTDriver_getKerning)   0,
     (FTDriver_attachFile)   0,
-#else
-    (FTDriver_getKerning)   cid_Get_Kerning,
-    (FTDriver_attachFile)   CID_Read_AFM,
-#endif
 
     (FTDriver_getAdvances)  0
   };
--- a/src/cid/rules.mk
+++ b/src/cid/rules.mk
@@ -35,7 +35,6 @@
                $(CID_DIR_)cidload.c   \
                $(CID_DIR_)cidriver.c  \
                $(CID_DIR_)cidgload.c  \
-               $(CID_DIR_)cidafm.c    \
                $(CID_DIR_)cidobjs.c
 
 # CID driver headers
--- a/src/cid/type1cid.c
+++ b/src/cid/type1cid.c
@@ -24,7 +24,7 @@
 #include <cidriver.c>
 #include <cidgload.c>
 
-#if 1
+#if 0
 #include <cidafm.c>
 #endif
 
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1417,7 +1417,7 @@
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
     /* clear all outline flags, except the `owner' one */
-    glyph->outline.flags &= ft_outline_owner;
+    glyph->outline.flags = 0;
 
     if ( size && size->root.metrics.y_ppem < 24 )
       glyph->outline.flags |= ft_outline_high_precision;
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -308,12 +308,12 @@
 
 #ifdef T1_CONFIG_OPTION_NO_AFM
     (FTDriver_getKerning)   0,
-    (FTDriver_getAdvances)  0
+    (FTDriver_getAdvances)  0,
 #else
     (FTDriver_getKerning)   Get_Kerning,
-    (FTDriver_attachFile)   T1_Read_AFM
+    (FTDriver_attachFile)   T1_Read_AFM,
 #endif
-    (FTDriver_getAdvances)          0
+    (FTDriver_getAdvances)  0
   };