shithub: freetype+ttf2subf

Download patch

ref: 4d57024d1c861443a981de6d7388548928349eee
parent: 4a23351091dd3a445e9cf208f4a8644e0a0b7fcd
author: David Turner <[email protected]>
date: Sat Feb 23 21:59:24 EST 2002

* moving all code related to glyph loaders to "internal/ftgloadr.h"
        and "src/base/ftgloadr.c".

        Note also that the type "FT_GlyphLoader" is now a pointer to the
        structure "FT_GlyphLoaderRec"..

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2002-02-24  David Turner   <[email protected]>
 
+        * moving all code related to glyph loaders to "internal/ftgloadr.h"
+        and "src/base/ftgloadr.c".
+
+        Note also that the type "FT_GlyphLoader" is now a pointer to the
+        structure "FT_GlyphLoaderRec"..
+
+
         * renaming "ft_glyph_own_bitmap" into "FT_GLYPH_OWN_BITMAP"
 
 2002-02-22  Werner Lemberg  <[email protected]>
--- a/include/freetype/internal/ftgloadr.h
+++ b/include/freetype/internal/ftgloadr.h
@@ -32,7 +32,7 @@
   /*    The glyph loader implementation is not part of the high-level API, */
   /*    hence the forward structure declaration.                           */
   /*                                                                       */
-  typedef struct FT_GlyphLoader_  FT_GlyphLoader ;
+  typedef struct FT_GlyphLoaderRec_*  FT_GlyphLoader ;
 
 
 #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS          1
@@ -89,7 +89,7 @@
  /* create new empty glyph loader */
   FT_BASE( FT_Error )
   FT_GlyphLoader_New( FT_Memory         memory,
-                       FT_GlyphLoader   *aloader );
+                      FT_GlyphLoader   *aloader );
 
  /* add an extra points table to a glyph loader */
   FT_BASE( FT_Error )
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -31,6 +31,7 @@
 #include FT_RENDER_H
 #include FT_SIZES_H
 #include FT_INTERNAL_MEMORY_H
+#include FT_INTERNAL_GLYPH_LOADER_H
 #include FT_INTERNAL_DRIVER_H
 #include FT_INTERNAL_AUTOHINT_H
 
@@ -76,22 +77,6 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Struct>                                                              */
-  /*    FT_GlyphLoader                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    The glyph loader is an internal object used to load several glyphs */
-  /*    together (for example, in the case of composites).                 */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The glyph loader implementation is not part of the high-level API, */
-  /*    hence the forward structure declaration.                           */
-  /*                                                                       */
-  typedef struct FT_GlyphLoader_  FT_GlyphLoader;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
   /*    FT_Face_InternalRec                                                */
   /*                                                                       */
   /* <Description>                                                         */
@@ -171,12 +156,12 @@
   /*                                                                       */
   typedef struct  FT_Slot_InternalRec_
   {
-    FT_GlyphLoader*  loader;
+    FT_GlyphLoader   loader;
     FT_Bool          glyph_transformed;
     FT_Matrix        glyph_matrix;
     FT_Vector        glyph_delta;
     void*            glyph_hints;
-  
+
   } FT_GlyphSlot_InternalRec;
 
 
@@ -345,6 +330,8 @@
   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
 
 
+#if 0
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
@@ -444,6 +431,7 @@
   FT_GlyphLoader_Copy_Points( FT_GlyphLoader*  target,
                               FT_GlyphLoader*  source );
 
+#endif
 
   /*************************************************************************/
   /*************************************************************************/
@@ -533,7 +521,7 @@
     FT_ListRec        faces_list;
     void*             extensions;
 
-    FT_GlyphLoader*   glyph_loader;
+    FT_GlyphLoader    glyph_loader;
 
   } FT_DriverRec;
 
--- a/include/freetype/internal/internal.h
+++ b/include/freetype/internal/internal.h
@@ -33,7 +33,7 @@
 #define FT_INTERNAL_DRIVER_H              <freetype/internal/ftdriver.h>
 #define FT_INTERNAL_EXTEND_H              <freetype/internal/ftextend.h>
 #define FT_INTERNAL_TRACE_H               <freetype/internal/fttrace.h>
-
+#define FT_INTERNAL_GLYPH_LOADER_H        <freetype/internal/ftgloadr.h>
 #define FT_INTERNAL_SFNT_H                <freetype/internal/sfnt.h>
 
 #define FT_INTERNAL_TRUETYPE_TYPES_H      <freetype/internal/tttypes.h>
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -508,7 +508,7 @@
     FT_Memory         memory;
     FT_Face           face;
     FT_GlyphSlot      glyph;
-    FT_GlyphLoader*   loader;
+    FT_GlyphLoader    loader;
     FT_Outline*       base;
     FT_Outline*       current;
 
@@ -535,7 +535,7 @@
     void*             hints_funcs;    /* hinter-specific */
     void*             hints_globals;  /* hinter-specific */
 
-    T1_Builder_Funcs  funcs;      
+    T1_Builder_Funcs  funcs;
   };
 
 
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1615,7 +1615,7 @@
     FT_Face          face;
     FT_Size          size;
     FT_GlyphSlot     glyph;
-    FT_GlyphLoader*  gloader;
+    FT_GlyphLoader   gloader;
 
     FT_ULong         load_flags;
     FT_UInt          glyph_index;
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -351,7 +351,7 @@
   /*                                                                       */
   FT_LOCAL_DEF void
   ah_outline_save( AH_Outline*  outline,
-                   AH_Loader*   gloader )
+                   AH_Loader    gloader )
   {
     AH_Point*   point       = outline->points;
     AH_Point*   point_limit = point + outline->num_points;
--- a/src/autohint/ahglyph.h
+++ b/src/autohint/ahglyph.h
@@ -79,7 +79,7 @@
 
   FT_LOCAL void
   ah_outline_save( AH_Outline*  outline,
-                   AH_Loader*   loader );
+                   AH_Loader    loader );
 
   FT_LOCAL void
   ah_outline_done( AH_Outline*  outline );
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -388,7 +388,7 @@
     ah_debug_disable_vert = no_vert_edges;
 #else
     FT_UNUSED( no_horz_edges );
-    FT_UNUSED( no_vert_edges );    
+    FT_UNUSED( no_vert_edges );
 #endif
     /* AH_Interpolate_Blue_Edges( hinter ); -- doesn't seem to help      */
     /* reduce the problem of the disappearing eye in the `e' of Times... */
@@ -1011,7 +1011,7 @@
     FT_Fixed          y_scale  = face->size->metrics.y_scale;
     FT_Error          error;
     AH_Outline*       outline  = hinter->glyph;
-    AH_Loader*        gloader  = hinter->loader;
+    AH_Loader         gloader  = hinter->loader;
     FT_Bool           no_horz_hints = FT_BOOL(
                         ( load_flags & AH_HINT_NO_HORZ_EDGES ) != 0 );
     FT_Bool           no_vert_hints = FT_BOOL(
--- a/src/autohint/ahloader.h
+++ b/src/autohint/ahloader.h
@@ -41,73 +41,8 @@
 
 FT_BEGIN_HEADER
 
+#include FT_INTERNAL_GLYPH_LOADER_H
 
-#ifdef _STANDALONE_
-
-  typedef struct  AH_GlyphLoad_
-  {
-    FT_Outline    outline;       /* outline             */
-    FT_UInt       num_subglyphs; /* number of subglyphs */
-    FT_SubGlyph*  subglyphs;     /* subglyphs           */
-    FT_Vector*    extra_points;  /* extra points table  */
-
-  } AH_GlyphLoad;
-
-
-  struct  AH_GlyphLoader_
-  {
-    FT_Memory     memory;
-    FT_UInt       max_points;
-    FT_UInt       max_contours;
-    FT_UInt       max_subglyphs;
-    FT_Bool       use_extra;
-
-    AH_GlyphLoad  base;
-    AH_GlyphLoad  current;
-
-    void*         other;        /* for possible future extensions */
-  };
-
-
-  FT_LOCAL FT_Error
-  AH_GlyphLoader_New( FT_Memory         memory,
-                      AH_GlyphLoader**  aloader );
-
-  FT_LOCAL FT_Error
-  AH_GlyphLoader_Create_Extra( AH_GlyphLoader*  loader );
-
-  FT_LOCAL void
-  AH_GlyphLoader_Done( AH_GlyphLoader*  loader );
-
-  FT_LOCAL void
-  AH_GlyphLoader_Reset( AH_GlyphLoader*  loader );
-
-  FT_LOCAL void
-  AH_GlyphLoader_Rewind( AH_GlyphLoader*  loader );
-
-  FT_LOCAL FT_Error
-  AH_GlyphLoader_Check_Points( AH_GlyphLoader*  loader,
-                               FT_UInt          n_points,
-                               FT_UInt          n_contours );
-
-  FT_LOCAL FT_Error
-  AH_GlyphLoader_Check_Subglyphs( AH_GlyphLoader*  loader,
-                                  FT_UInt          n_subs );
-
-  FT_LOCAL void
-  AH_GlyphLoader_Prepare( AH_GlyphLoader*  loader );
-
-  FT_LOCAL void
-  AH_GlyphLoader_Add( AH_GlyphLoader*  loader );
-
-  FT_LOCAL FT_Error
-  AH_GlyphLoader_Copy_Points( AH_GlyphLoader*  target,
-                              FT_GlyphLoader*  source );
-
-#else /* _STANDALONE */
-
-#include FT_INTERNAL_OBJECTS_H
-
   #define AH_Load    FT_GlyphLoad
   #define AH_Loader  FT_GlyphLoader
 
@@ -121,8 +56,6 @@
   #define ah_loader_prepare          FT_GlyphLoader_Prepare
   #define ah_loader_add              FT_GlyphLoader_Add
   #define ah_loader_copy_points      FT_GlyphLoader_Copy_Points
-
-#endif /* _STANDALONE_ */
 
 
 FT_END_HEADER
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -477,7 +477,7 @@
 
     AH_Outline*       glyph;
 
-    AH_Loader*        loader;
+    AH_Loader         loader;
     FT_Vector         pp1;
     FT_Vector         pp2;
 
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -10,7 +10,7 @@
 
   if $(FT2_MULTI)
   {
-    _sources = ftcalc ftlist ftobjs ftstream ftoutln ftnames fttrigon
+    _sources = ftcalc ftgloadr ftlist ftobjs ftstream ftoutln ftnames fttrigon
                ftdbgmem ;
   }
   else
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -22,6 +22,7 @@
 
 #include "ftcalc.c"
 #include "fttrigon.c"
+#include "ftgloadr.c"
 #include "ftobjs.c"
 #include "ftstream.c"
 #include "ftlist.c"
@@ -28,9 +29,5 @@
 #include "ftoutln.c"
 #include "ftnames.c"
 #include "ftdbgmem.c"
-
-#if 0
-#include "ftextend.c"
-#endif
 
 /* END */
--- a/src/base/ftgloadr.c
+++ b/src/base/ftgloadr.c
@@ -1,5 +1,6 @@
 #include <ft2build.h>
 #include FT_INTERNAL_GLYPH_LOADER_H
+#include FT_INTERNAL_MEMORY_H
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_gloader
@@ -65,8 +66,8 @@
   FT_BASE_DEF( void )
   FT_GlyphLoader_Rewind( FT_GlyphLoader   loader )
   {
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
+    FT_GlyphLoad  base    = &loader->base;
+    FT_GlyphLoad  current = &loader->current;
 
 
     base->outline.n_points   = 0;
@@ -154,8 +155,8 @@
   static void
   FT_GlyphLoader_Adjust_Subglyphs( FT_GlyphLoader   loader )
   {
-    FT_GlyphLoad* base    = &loader->base;
-    FT_GlyphLoad* current = &loader->current;
+    FT_GlyphLoad  base    = &loader->base;
+    FT_GlyphLoad  current = &loader->current;
 
 
     current->subglyphs = base->subglyphs + base->num_subglyphs;
@@ -235,8 +236,8 @@
     FT_Error   error  = FT_Err_Ok;
     FT_UInt    new_max, old_max;
 
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
+    FT_GlyphLoad  base    = &loader->base;
+    FT_GlyphLoad  current = &loader->current;
 
 
     new_max = base->num_subglyphs + current->num_subglyphs + n_subs;
@@ -261,7 +262,7 @@
   FT_BASE_DEF( void )
   FT_GlyphLoader_Prepare( FT_GlyphLoader   loader )
   {
-    FT_GlyphLoad*  current = &loader->current;
+    FT_GlyphLoad  current = &loader->current;
 
 
     current->outline.n_points   = 0;
@@ -277,8 +278,8 @@
   FT_BASE_DEF( void )
   FT_GlyphLoader_Add( FT_GlyphLoader   loader )
   {
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
+    FT_GlyphLoad   base    = &loader->base;
+    FT_GlyphLoad   current = &loader->current;
 
     FT_UInt        n_curr_contours = current->outline.n_contours;
     FT_UInt        n_base_points   = base->outline.n_points;
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -262,6 +262,8 @@
 #define FT_COMPONENT  trace_objs
 
 
+#if 0
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
@@ -598,6 +600,7 @@
     return error;
   }
 
+#endif
 
   /*************************************************************************/
   /*************************************************************************/
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -34,6 +34,7 @@
 #
 BASE_SRC := $(BASE_)ftcalc.c   \
             $(BASE_)fttrigon.c \
+            $(BASE_)ftgloadr.c \
             $(BASE_)ftlist.c   \
             $(BASE_)ftobjs.c   \
             $(BASE_)ftstream.c \
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -238,7 +238,7 @@
 
     if ( glyph )
     {
-      FT_GlyphLoader*  loader = glyph->root.internal->loader;
+      FT_GlyphLoader  loader = glyph->root.internal->loader;
 
 
       builder->loader  = loader;
@@ -248,7 +248,7 @@
 
       builder->hints_globals = 0;
       builder->hints_funcs   = 0;
-            
+
       if ( hinting && size )
       {
         builder->hints_globals = size->internal;
@@ -588,7 +588,7 @@
     if ( decoder->builder.no_recurse )
     {
       FT_GlyphSlot     glyph  = (FT_GlyphSlot)decoder->builder.glyph;
-      FT_GlyphLoader*  loader = glyph->internal->loader;
+      FT_GlyphLoader   loader = glyph->internal->loader;
       FT_SubGlyph*     subg;
 
 
@@ -1091,7 +1091,7 @@
         case cff_op_hintmask:
         case cff_op_cntrmask:
           FT_TRACE4(( op == cff_op_hintmask ? " hintmask" : " cntrmask" ));
-  
+
           /* implement vstem when needed --                        */
           /* the specification doesn't say it, but this also works */
           /* with the 'cntrmask' operator                          */
@@ -1103,7 +1103,7 @@
                              0,
                              num_args / 2,
                              args );
-          
+
             decoder->num_hints += num_args / 2;
           }
 
--- a/src/cff/cffgload.h
+++ b/src/cff/cffgload.h
@@ -89,7 +89,7 @@
     FT_Memory         memory;
     TT_Face           face;
     CFF_GlyphSlot     glyph;
-    FT_GlyphLoader*   loader;
+    FT_GlyphLoader    loader;
     FT_Outline*       base;
     FT_Outline*       current;
 
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -166,8 +166,8 @@
       FT_Error   error;
       FT_Offset  new_size  = table->capacity;
       FT_Long    in_offset;
-      
 
+
       in_offset = (FT_Long)((FT_Byte*)object - table->block);
       if ( (FT_ULong)in_offset >= table->capacity )
         in_offset = -1;
@@ -178,7 +178,7 @@
       error = reallocate_t1_table( table, new_size );
       if ( error )
         return error;
-      
+
       if ( in_offset >= 0 )
         object = table->block + in_offset;
     }
@@ -1085,7 +1085,7 @@
 
     if ( glyph )
     {
-      FT_GlyphLoader*  loader = glyph->internal->loader;
+      FT_GlyphLoader  loader = glyph->internal->loader;
 
 
       builder->loader  = loader;
@@ -1095,7 +1095,7 @@
 
       builder->hints_globals = size->internal;
       builder->hints_funcs   = 0;
-            
+
       if ( hinting )
         builder->hints_funcs = glyph->internal->glyph_hints;
     }
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -218,7 +218,7 @@
     if ( decoder->builder.no_recurse )
     {
       FT_GlyphSlot     glyph  = (FT_GlyphSlot)decoder->builder.glyph;
-      FT_GlyphLoader*  loader = glyph->internal->loader;
+      FT_GlyphLoader   loader = glyph->internal->loader;
       FT_SubGlyph*     subg;
 
 
@@ -290,7 +290,7 @@
     decoder->builder.advance      = advance;
 
     /* XXX: old code doesn't work with postscript hinter */
-#if 0    
+#if 0
     /* Finally, move the accent */
     if ( decoder->builder.load_points )
     {
@@ -302,7 +302,7 @@
 
       FT_Outline_Translate( &dummy, adx - asb, ady );
     }
-#else    
+#else
     decoder->builder.pos_x = 0;
     decoder->builder.pos_y = 0;
 #endif
@@ -638,10 +638,10 @@
             goto Syntax_Error;
           }
           ip += 2;
-          
+
           if ( hinter )
             hinter->reset( hinter->hints, builder->current->n_points );
-            
+
           break;
 
         case 12:
@@ -736,19 +736,19 @@
           FT_TRACE4(( " endchar" ));
 
           close_contour( builder );
-          
+
           /* close hints recording session */
           if ( hinter )
           {
             if (hinter->close( hinter->hints, builder->current->n_points ))
               goto Syntax_Error;
-            
+
             /* apply hints to the loaded glyph outline now */
             hinter->apply( hinter->hints,
                            builder->current,
                            (PSH_Globals)builder->hints_globals );
           }
-          
+
           /* add current outline to the glyph slot */
           FT_GlyphLoader_Add( builder->loader );
 
@@ -1016,7 +1016,7 @@
 
         case op_hstem:
           FT_TRACE4(( " hstem" ));
-          
+
           /* record horizontal hint */
           if ( hinter )
           {
@@ -1032,7 +1032,7 @@
           /* record horizontal counter-controlled hints */
           if ( hinter )
             hinter->stem3( hinter->hints, 1, top );
-                           
+
           break;
 
         case op_vstem:
@@ -1054,7 +1054,7 @@
           if ( hinter )
           {
             FT_Pos  dx = orig_x;
-            
+
             top[0] += dx;
             top[2] += dx;
             top[4] += dx;
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -176,7 +176,7 @@
 
   static void
   tt_prepare_zone( TT_GlyphZone*  zone,
-                   FT_GlyphLoad*  load,
+                   FT_GlyphLoad   load,
                    FT_UInt        start_point,
                    FT_UInt        start_contour )
   {
@@ -267,7 +267,7 @@
   {
     FT_Error         error;
     FT_Stream        stream     = load->stream;
-    FT_GlyphLoader*  gloader    = load->gloader;
+    FT_GlyphLoader   gloader    = load->gloader;
     FT_Int           n_contours = load->n_contours;
     FT_Outline*      outline;
     TT_Face          face    = (TT_Face)load->face;
@@ -470,7 +470,7 @@
   {
     FT_Error         error;
     FT_Stream        stream  = loader->stream;
-    FT_GlyphLoader*  gloader = loader->gloader;
+    FT_GlyphLoader   gloader = loader->gloader;
     FT_SubGlyph*     subglyph;
     FT_UInt          num_subglyphs;
     FT_Int           byte_len = loader->byte_len;
@@ -606,7 +606,7 @@
   TT_Process_Simple_Glyph( TT_Loader*  load,
                            FT_Bool     debug )
   {
-    FT_GlyphLoader*  gloader  = load->gloader;
+    FT_GlyphLoader   gloader  = load->gloader;
     FT_Outline*      outline  = &gloader->current.outline;
     FT_UInt          n_points = outline->n_points;
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -751,7 +751,7 @@
     FT_Int           contours_count;
     FT_UInt          index, num_points, count;
     FT_Fixed         x_scale, y_scale;
-    FT_GlyphLoader*  gloader = loader->gloader;
+    FT_GlyphLoader   gloader = loader->gloader;
     FT_Bool          opened_frame = 0;
 
 
@@ -1519,7 +1519,7 @@
 
     /* update the glyph zone bounds */
     {
-      FT_GlyphLoader*  gloader = FT_FACE_DRIVER(face)->glyph_loader;
+      FT_GlyphLoader  gloader = FT_FACE_DRIVER(face)->glyph_loader;
 
 
       loader.gloader = gloader;