freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] parthw-wip e7c9503 19/35: [gf] COnverted file functions to F


From: Parth Wazurkar
Subject: [freetype2] parthw-wip e7c9503 19/35: [gf] COnverted file functions to FT stream functions.
Date: Wed, 4 Jul 2018 14:09:30 -0400 (EDT)

branch: parthw-wip
commit e7c95039f5b683b89d6c115381283bb4334a6724
Author: Parth Wazurkar <address@hidden>
Commit: Parth Wazurkar <address@hidden>

    [gf] COnverted file functions to FT stream functions.
    
    * src/gf/gflib.c : Converted all the file functions like getc,
    fseek,etc. to FT specific stream functions.
---
 src/gf/gfdrivr.c |  95 ++++++++++---------
 src/gf/gfdrivr.h |   2 +-
 src/gf/gflib.c   | 282 +++++++++++++++++++++++++------------------------------
 3 files changed, 183 insertions(+), 196 deletions(-)

diff --git a/src/gf/gfdrivr.c b/src/gf/gfdrivr.c
index d45f596..a7c0d51 100644
--- a/src/gf/gfdrivr.c
+++ b/src/gf/gfdrivr.c
@@ -155,21 +155,21 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    GF_Face    face   = (GF_Face)gfface;
-    FT_Error   error;
-    FT_Memory  memory = FT_FACE_MEMORY( face );
+    GF_Face     face   = (GF_Face)gfface;
+    FT_Error    error;
+    FT_Memory   memory = FT_FACE_MEMORY( face );
+    GF_Glyph    go;
 
+    face->gf_glyph = &go ;
     FT_UNUSED( num_params );
     FT_UNUSED( params );
 
     FT_TRACE2(( "GF driver\n" ));
-    printf("\nHi I am here\n\n");
+
     /* load font */
-    error = gf_load_font( stream, face );
-    if ( !error )
-      goto Exit;
+    error = gf_load_font( stream, memory, &go 
);/*printf("face->gf_glyph->code_max %d",go->code_max);printf("Hi I am 
here1\n");*/
 
-    if ( FT_ERR_EQ( error, Unknown_File_Format ) )
+    if ( error )
       goto Exit;
 
     /* we have a gf font: let's construct the face object */
@@ -180,13 +180,13 @@
      *      an invalid argument error when the font could be
      *      opened by the specified driver.
      */
-    if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 )
+   /* if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 )
     {
       FT_ERROR(( "GF_Face_Init: invalid face index\n" ));
       GF_Face_Done( gfface );
       return FT_THROW( Invalid_Argument );
     }
-
+  */
     gfface->num_faces  = 1;
     gfface->face_index = 0;
     gfface->face_flags |= FT_FACE_FLAG_FIXED_SIZES |
@@ -195,13 +195,14 @@
      * XXX: TO-DO: gfface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
      * XXX: I have to check for this.
      */
-
+/*printf("Hi I am here2\n");*/
     gfface->family_name = NULL;
-    gfface->num_glyphs = (FT_Long)( sizeof(face->gf_glyph->bm_table) );
+    gfface->num_glyphs = (FT_Long)(go->code_max - go->code_min + 1 );
     gfface->num_fixed_sizes = 1;
+/*printf("Hi I am here3\n");*/
     if ( FT_NEW_ARRAY( gfface->available_sizes, 1 ) )
       goto Exit;
-
+/*printf("Hi I am here4\n");*/
     {
       FT_Bitmap_Size*  bsize = gfface->available_sizes;
       FT_UShort        x_res, y_res;
@@ -209,14 +210,15 @@
       FT_ZERO( bsize );
       bsize->width  = (FT_Short) face->gf_glyph->font_bbx_w    ;
       bsize->height = (FT_Short) face->gf_glyph->font_bbx_h    ;
-      bsize->size   =            face->gf_glyph->font_bbx_xoff ;
+      bsize->size   = (FT_Short) face->gf_glyph->ds            ; /* 
Preliminary to be checked for 26.6 fractional points*/
 
-      /*x_res =  ;
-      y_res =  ;
+      /*x_res =  ;  To be Checked for x_resolution and y_resolution
+        y_res =  ;
       */
       bsize->y_ppem = face->gf_glyph->font_bbx_yoff ;
       bsize->x_ppem = face->gf_glyph->font_bbx_xoff ;
     }
+/*printf("Hi I am here5\n");*/
 
       /* Charmaps */
 
@@ -226,7 +228,7 @@
 
       charmap.encoding    = FT_ENCODING_NONE;
       /* initial platform/encoding should indicate unset status? */
-      charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;
+      charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;  /*Preliminary */
       charmap.encoding_id = TT_APPLE_ID_DEFAULT;
       charmap.face        = face;
 
@@ -234,12 +236,14 @@
 
       if ( error )
         goto Fail;
+            /*printf("Hi I am here completed GF_Face_Init1\n");*/
     }
-
+/*printf("Hi I am here6\n");*/
   Fail:
     GF_Face_Done( gfface );
 
   Exit:
+/*    printf("Hi I am here completed GF_Face_Init2 
%ld\n",gfface->num_glyphs);*/
     return error;
   }
 
@@ -247,16 +251,16 @@
   GF_Size_Select(  FT_Size   size,
                    FT_ULong  strike_index )
   {
-
+    GF_Face        face   = (GF_Face)size->face;
     FT_UNUSED( strike_index );
 
 
     FT_Select_Metrics( size->face, 0 );
-/*
-    size->metrics.ascender    =    ;
-    size->metrics.descender   =    ;
-    size->metrics.max_advance =    ;
-*/
+
+    size->metrics.ascender    = face->gf_glyph->font_bbx_xoff    * 64 ;
+    size->metrics.descender   = face->gf_glyph->font_bbx_yoff    * 64 ;
+    size->metrics.max_advance = face->gf_glyph->font_bbx_w       * 64 ;
+
     return FT_Err_Ok;
 
   }
@@ -307,10 +311,11 @@
     FT_Face      face   = FT_FACE( gf );
     FT_Error     error  = FT_Err_Ok;
     FT_Bitmap*   bitmap = &slot->bitmap;
-    GF_BitmapRec glyph ;
+    GF_BitmapRec bm ;
 
     FT_UNUSED( load_flags );
 
+    printf("Hi I am here in gf_load_glyphs");
 
     if ( !face )
     {
@@ -326,34 +331,38 @@
 
     FT_TRACE1(( "GF_Glyph_Load: glyph index %d\n", glyph_index ));
 
-    if ( glyph_index > 0 )
-      glyph_index--;                           /* revert to real index */
+    /*if ( glyph_index > 0 )
+      glyph_index--;
     else
-      glyph_index = 0;                    /* the `.notdef' glyph  */
+      glyph_index = 0;
+    */
+
+    if ( glyph_index < 0 )
+      glyph_index = 0;
 
     /* slot, bitmap => freetype, glyph => gflib */
-    glyph = gf->gf_glyph->bm_table[glyph_index];
-/*
-    bitmap->rows  = ;
-    bitmap->width = ;
-    bitmap->pitch = ;     *//* (In BDF) same as FT_Bitmap.pitch */
+    bm = gf->gf_glyph->bm_table[glyph_index];
+
+    bitmap->rows  = bm.mv_y ; /* Prelimiary */
+    bitmap->width = bm.mv_x ; /* Prelimiary */
+    /*bitmap->pitch = bm      ; *//* Prelimiary */
 
     /* note: we don't allocate a new array to hold the bitmap; */
     /*       we can simply point to it                         */
-    ft_glyphslot_set_bitmap( slot, glyph.bitmap );
+    ft_glyphslot_set_bitmap( slot, bm.bitmap );
 
     slot->format      = FT_GLYPH_FORMAT_BITMAP;
-    /*slot->bitmap_left = ;
-    slot->bitmap_top  = ;
+    slot->bitmap_left = bm.off_x ; /* Prelimiary */
+    slot->bitmap_top  = bm.off_y ; /* Prelimiary */
 
-    slot->metrics.horiAdvance  = (FT_Pos) ;
-    slot->metrics.horiBearingX = (FT_Pos) ;
-    slot->metrics.horiBearingY = (FT_Pos) ;
-    slot->metrics.width        = (FT_Pos) ;
-    slot->metrics.height       = (FT_Pos) ;
+    slot->metrics.horiAdvance  = (FT_Pos) bm.bbx_width - bm.off_x       ; /* 
Prelimiary */
+    slot->metrics.horiBearingX = (FT_Pos) bm.off_x                      ; /* 
Prelimiary */
+    slot->metrics.horiBearingY = (FT_Pos) bm.off_y                      ; /* 
Prelimiary */
+    slot->metrics.width        = (FT_Pos) ( bitmap->width * 64 )        ; /* 
Prelimiary */
+    slot->metrics.height       = (FT_Pos) ( bitmap->rows * 64 )         ; /* 
Prelimiary */
+
+    ft_synthesize_vertical_metrics( &slot->metrics, bm.bbx_height * 64 );
 
-    ft_synthesize_vertical_metrics( &slot->metrics,  );
-    */
   Exit:
     return error;
   }
diff --git a/src/gf/gfdrivr.h b/src/gf/gfdrivr.h
index b5b8a8a..f32b3b0 100644
--- a/src/gf/gfdrivr.h
+++ b/src/gf/gfdrivr.h
@@ -33,7 +33,7 @@ FT_BEGIN_HEADER
     FT_UInt              bbx_width, bbx_height;
     FT_UInt              off_x, off_y;
     FT_UInt              mv_x,  mv_y;
-    unsigned char        *bitmap;
+    FT_Byte              *bitmap;
     FT_UInt              raster;
 
   } GF_BitmapRec, *GF_Bitmap;
diff --git a/src/gf/gflib.c b/src/gf/gflib.c
index 9c43261..ffcb372 100644
--- a/src/gf/gflib.c
+++ b/src/gf/gflib.c
@@ -49,103 +49,86 @@ unsigned char   bit_table[] = {
    *
    */
 
-  long           gf_read_intn(FILE*,int);
-  unsigned long  gf_read_uintn(FILE*,int);
-  void           gf_skip_n(FILE*,int);
-
-#define READ_INT1(fp)    (INT1)gf_read_intn((fp), 1)
-#define READ_UINT1(fp)   (UINT1)gf_read_uintn((fp), 1)
-#define READ_INT2(fp)    (INT2)gf_read_intn((fp), 2)
-#define READ_UINT2(fp)   (UINT2)gf_read_uintn((fp), 2)
-#define READ_INT3(fp)    (INT3)gf_read_intn((fp), 3)
-#define READ_UINT3(fp)   (UINT3)gf_read_uintn((fp), 3)
-#define READ_INT4(fp)    (INT4)gf_read_intn((fp), 4)
-#define READ_UINT4(fp)   (UINT4)gf_read_uintn((fp), 4)
-#define READ_INTN(fp,n)  (INT4)gf_read_intn((fp), (n))
-#define READ_UINTN(fp,n) (UINT4)gf_read_uintn((fp), (n))
-#define SKIP_N(fp,k)     gf_skip_n((fp), (k))
+  long           gf_read_intn(FT_Stream,int);
+  unsigned long  gf_read_uintn(FT_Stream,int);
+  void           gf_skip_n(FT_Stream,int);
+
+#define READ_INT1( stream )          (INT1)gf_read_intn(( stream ), 1)
+#define READ_UINT1( stream )         (UINT1)gf_read_uintn(( stream ), 1)
+#define READ_INT2( stream )          (INT2)gf_read_intn(( stream ), 2)
+#define READ_UINT2( stream )         (UINT2)gf_read_uintn(( stream ), 2)
+#define READ_INT3( stream )          (INT3)gf_read_intn(( stream ), 3)
+#define READ_UINT3( stream )         (UINT3)gf_read_uintn(( stream ), 3)
+#define READ_INT4( stream )          (INT4)gf_read_intn(( stream ), 4)
+#define READ_UINT4( stream )         (UINT4)gf_read_uintn(( stream ), 4)
+#define READ_INTN( stream ,n)        (INT4)gf_read_intn(( stream ), (n))
+#define READ_UINTN( stream ,n)       (UINT4)gf_read_uintn(( stream ), (n))
+#define SKIP_N( stream ,k)           gf_skip_n(( stream ), (k))
 
 
 /*
- * Reading a Number from file
+ * Reading a Number from stream
  */
   unsigned long
-  gf_read_uintn(FILE* fp, int size)
+  gf_read_uintn(FT_Stream stream, int size)
   {
     unsigned long  v;
+    FT_Error error = FT_Err_Ok;
     v = 0L;
     while (size >= 1)
     {
-      v = v*256L + (unsigned long)getc(fp);
+      v = v*256L + (unsigned long)FT_Stream_ReadULong(stream, &error);
+      stream->pos-=3;
       --size;
     }
     return v;
   }
 
-  long
-  gf_read_intn(FILE* fp, int size)
-  {
-    long           v;
-
-    v = (long)getc(fp) & 0xffL;
-    if (v & 0x80L)
-      v = v - 256L;
-    --size;
-    while (size >= 1)
-    {
-      v = v*256L + (unsigned long)getc(fp);
-      --size;
-               }
-
-    return v;
-  }
-
-  void
-  gf_skip_n(FILE* fp, int size)
-  {
-
-    while (size > 0)
-    {
-      (void)getc(fp);
-      --size;
-    }
-
-  }
-
+/* Preliminary */
   unsigned long
-  gf_get_uintn(unsigned char *p, int size)
+  gf_read_uint4(FT_Stream stream, int size)
   {
     unsigned long  v;
-
+    FT_Error error = FT_Err_Ok;
     v = 0L;
     while (size >= 1)
     {
-      v = v*256L + (unsigned long) *(p++);
+      v = v*256L + (unsigned long)FT_Stream_ReadULong(stream, &error);
       --size;
     }
-
     return v;
   }
 
+
   long
-  gf_get_intn(unsigned char *p, int size)
+  gf_read_intn(FT_Stream stream, int size)
   {
     long           v;
-
-    v = (long)*(p++) & 0xffL;
+    FT_Error error = FT_Err_Ok;
+    v = (long)FT_Stream_ReadULong(stream, &error) & 0xffL;
     if (v & 0x80L)
       v = v - 256L;
     --size;
     while (size >= 1)
     {
-      v = v*256L + (unsigned long) *(p++);
+      v = v*256L + (unsigned long)FT_Stream_ReadULong(stream, &error);
       --size;
-    }
-
+               }
     return v;
   }
 
-
+  void
+  gf_skip_n(FT_Stream stream, int size)
+  {
+    FT_Stream_Skip(stream, (FT_Long)size );
+    #if 0
+    while (size > 0)
+    {
+      (void)getc(fp);
+      --size;
+    }
+    #endif
+  }
 
   /**************************************************************************
    *
@@ -154,7 +137,7 @@ unsigned char   bit_table[] = {
    */
 
   FT_LOCAL_DEF( FT_Error )
-  gf_read_glyph(FT_FILE* fp, GF_Bitmap bm)
+  gf_read_glyph(FT_Stream stream, GF_Bitmap bm)
   {
     long           m, n;
     int            paint_sw;
@@ -165,22 +148,22 @@ unsigned char   bit_table[] = {
     unsigned char  *ptr;
     FT_Error        error  = FT_Err_Ok;
 
-    switch (READ_UINT1(fp))
+    switch (READ_UINT1( stream ))
     {
     case GF_BOC:
-      SKIP_N(fp, 4);
-      SKIP_N(fp, 4);
-      min_m = READ_INT4(fp);
-      max_m = READ_INT4(fp);
-      min_n = READ_INT4(fp);
-      max_n = READ_INT4(fp);
+      SKIP_N( stream , 4);
+      SKIP_N( stream , 4);
+      min_m = READ_INT4( stream );
+      max_m = READ_INT4( stream );
+      min_n = READ_INT4( stream );
+      max_n = READ_INT4( stream );
       break;
     case GF_BOC1:
-      SKIP_N(fp, 1);
-      del_m = (INT4)READ_UINT1(fp);
-      max_m = (INT4)READ_UINT1(fp);
-      del_n = (INT4)READ_UINT1(fp);
-      max_n = (INT4)READ_UINT1(fp);
+      SKIP_N( stream , 1);
+      del_m = (INT4)READ_UINT1( stream );
+      max_m = (INT4)READ_UINT1( stream );
+      del_n = (INT4)READ_UINT1( stream );
+      max_n = (INT4)READ_UINT1( stream );
       min_m = max_m - del_m;
       min_n = max_n - del_n;
       break;
@@ -216,7 +199,7 @@ unsigned char   bit_table[] = {
     m        = min_m;
     n        = max_n;
     paint_sw = 0;
-    while ((instr = (int)READ_UINT1(fp)) != GF_EOC)
+    while ((instr = (int)READ_UINT1( stream )) != GF_EOC)
     {
       if (instr == GF_PAINT_0)
       {
@@ -240,7 +223,7 @@ unsigned char   bit_table[] = {
         case GF_PAINT1:
         case GF_PAINT2:
         case GF_PAINT3:
-          d = (UINT4)READ_UINTN(fp, (instr - GF_PAINT1 + 1));
+          d = (UINT4)READ_UINTN( stream, (instr - GF_PAINT1 + 1));
           Paint:
             if (paint_sw == 0)
             {
@@ -273,18 +256,18 @@ unsigned char   bit_table[] = {
         case GF_SKIP2:
         case GF_SKIP3:
           m = min_m;
-          n = n - (UINT4)READ_UINTN(fp, (instr - GF_SKIP1 + 1)) - 1;
+          n = n - (UINT4)READ_UINTN( stream, (instr - GF_SKIP1 + 1)) - 1;
           paint_sw = 0;
           break;
         case GF_XXX1:
         case GF_XXX2:
         case GF_XXX3:
         case GF_XXX4:
-          k = READ_UINTN(fp, instr - GF_XXX1 + 1);
-          SKIP_N(fp, k);
+          k = READ_UINTN( stream, instr - GF_XXX1 + 1);
+          SKIP_N( stream, k);
           break;
         case GF_YYY:
-          SKIP_N(fp, 4);
+          SKIP_N( stream, 4);
           break;
         case GF_NO_OP:
           break;
@@ -304,7 +287,8 @@ unsigned char   bit_table[] = {
 
   FT_LOCAL_DEF( FT_Error )
   gf_load_font(  FT_Stream       stream,
-                 GF_Face         face  )
+                 FT_Memory       extmemory,
+                 GF_Glyph        *goptr  )
   {
     GF_Glyph        go;
     GF_Bitmap       bm;
@@ -314,83 +298,78 @@ unsigned char   bit_table[] = {
     INT4            w;
     UINT4           code;
     double          dx, dy;
-    long            ptr_post, ptr_p, ptr, optr, gptr;
+    long            ptr_post, ptr_p, ptr, optr, gptr,tp;
     int             bc, ec, nchars, i;
     FT_Error        error  = FT_Err_Ok;
-
-    FT_FILE *fp = (FT_FILE*)stream->descriptor.pointer ;/* Errors with 
STREAM_FILE( stream )
-    stream->descriptor.pointer is not allocating the file pointer properly*/
-    go          = face->gf_glyph;
-
-    char* st =  (char*)stream->pathname.pointer;
-    fp=fopen(st,"rb");
-
-    printf("\nHi I am here in gf_load_font 1 stream->pathname: %s %p\n\n", 
stream->pathname.pointer, *fp);
+    FT_Memory       memory = extmemory; /* needed for FT_NEW */
+    FT_ULong        offset;
 
     go = NULL;
     nchars = -1;
-
-    /* seek to post_post instr. */
-    fseek(fp, -5, SEEK_END);
-
 printf("\nHi I am here in gf_load_font -1\n\n");
-
-    while ((d = READ_UINT1(fp)) == 223)
-      fseek(fp, -2, SEEK_CUR);
+    /* seek to post_post instr. */
+    /* fseek(fp, -5, SEEK_END); */
+    FT_STREAM_SEEK( stream->size - 5 );
 
 printf("\nHi I am here in gf_load_font 0\n\n");
-printf("\nHi I am here in gf_load_font d instr is %d\n\n",d);
+    while ((d = READ_UINT1( stream )) == 223)
+    {
+      FT_STREAM_SEEK( stream->pos -2 );
+      /* fseek(fp, -2, SEEK_CUR); */
+    }
 
+printf("\nHi I am here in gf_load_font 1\n\n");
     if (d != GF_ID)
     {
       error = FT_THROW( Invalid_File_Format );
       goto ErrExit;
     }
-    printf("\nHi I am here in gf_load_font 1\n\n");
 
-    fseek(fp, -6, SEEK_CUR);
+printf("\nHi I am here in gf_load_font 2\n\n");
+    /* fseek(fp, -6, SEEK_CUR); */
+    FT_STREAM_SEEK( stream->pos -6 );
 
+printf("\nHi I am here in gf_load_font 3\n\n");
     /* check if the code is post_post */
-    if (READ_UINT1(fp) != GF_POST_POST)
+    if (READ_UINT1( stream ) != GF_POST_POST)
     {
       error = FT_THROW( Invalid_File_Format );
       goto ErrExit;
     }
 
-printf("\nHi I am here in gf_load_font 2\n\n");
-
+printf("\nHi I am here in gf_load_font 4\n\n");
     /* read pointer to post instr. */
-    if ((ptr_post = READ_UINT4(fp)) == -1)
+    if ((ptr_post = gf_read_uint4( stream,4 )) == -1)
     {
       error = FT_THROW( Invalid_File_Format );
       goto ErrExit;
     }
 
-printf("\nHi I am here in gf_load_font 3\n\n");
-
+printf("\nHi I am here in gf_load_font 5\n\n");
     /* goto post instr. and read it */
-    fseek(fp, ptr_post, SEEK_SET);
-    if (READ_UINT1(fp) != GF_POST)
+    /* fseek(fp, ptr_post, SEEK_SET); */
+    FT_STREAM_SEEK( ptr_post );
+
+    if (d=READ_UINT1( stream ) != GF_POST)
     {
       error = FT_THROW( Invalid_File_Format );
       goto ErrExit;
     }
 
-printf("\nHi I am here in gf_load_font 4\n\n");
-
-    ptr_p     = READ_UINT4(fp);
-    ds        = READ_UINT4(fp);
-    check_sum = READ_UINT4(fp);
-    hppp      = READ_UINT4(fp);
-    vppp      = READ_UINT4(fp);
-    min_m     = READ_INT4(fp);
-    max_m     = READ_INT4(fp);
-    min_n     = READ_INT4(fp);
-    max_n     = READ_INT4(fp);
-
-printf("\nHi I am here in gf_load_font 5\n\n");
-    gptr = ftell(fp);
 printf("\nHi I am here in gf_load_font 6\n\n");
+    ptr_p     = READ_UINT4( stream );
+    ds        = READ_UINT4( stream );
+    check_sum = READ_UINT4( stream );
+    hppp      = READ_UINT4( stream );
+    vppp      = READ_UINT4( stream );
+    min_m     = READ_INT4( stream );
+    max_m     = READ_INT4( stream );
+    min_n     = READ_INT4( stream );
+    max_n     = READ_INT4( stream );
+printf("\nHi I am here in gf_load_font 7\n\n");
+    #if 0
+      gptr = ftell(fp);
+    #endif
 
     #if 0
       /* read min & max char code */
@@ -429,19 +408,14 @@ printf("\nHi I am here in gf_load_font 6\n\n");
     #endif
 
     nchars = ec - bc + 1;
-    go= (GF_Glyph)malloc(sizeof(GF_GlyphRec)); /* FT_ALLOC(go, 
sizeof(GF_GlyphRec)); goto ErrExit; */
+    go= malloc(sizeof(GF_GlyphRec)); /* FT_ALLOC(go, sizeof(GF_GlyphRec)); 
goto ErrExit; */
                                                /* Returning unnecessary errors 
TO BE CHECKED */
 
-printf("\nHi I am here in gf_load_font 7\n\n");
-
     go->bm_table = (GF_Bitmap)malloc(nchars* sizeof(GF_BitmapRec));/* 
FT_ALLOC_MULT(go->bm_table, sizeof(GF_BitmapRec), nchars); goto ErrExit; */
                                                                    /* 
Returning unnecessary errors TO BE CHECKED */
-printf("\nHi I am here in gf_load_font 8\n\n");
-
-    /*for (i = 0; i < nchars; i++)
-      go->bm_table[i] = NULL;*/
 
-printf("\nHi I am here in gf_load_font 9\n\n");
+    for (i = 0; i < nchars; i++)
+      go->bm_table[i].bitmap = NULL;
 
     go->ds   = (double)ds/(1<<20);
     go->hppp = (double)hppp/(1<<16);
@@ -458,47 +432,51 @@ printf("\nHi I am here in gf_load_font 9\n\n");
       fseek(fp, gptr, SEEK_SET);
     #endif
 
-printf("\nHi I am here in gf_load_font 9.5\n");
-
     for (  ;  ;  )
     {
-      if ((instr = READ_UINT1(fp)) == GF_POST_POST)
+      if ((instr = READ_UINT1( stream )) == GF_POST_POST)
         break;
-        printf("\nHi I am here in gf_load_font 9.6 instr is %d\n\n", instr);
       switch ((int)instr)
       {
       case GF_CHAR_LOC:
-        code = READ_UINT1(fp);
-        dx   = (double)READ_INT4(fp)/(double)(1<<16);
-        dy   = (double)READ_INT4(fp)/(double)(1<<16);
-        w    = READ_INT4(fp);
-        ptr  = READ_INT4(fp);
+        code = READ_UINT1( stream );
+        dx   = (double)READ_INT4( stream )/(double)(1<<16);
+        dy   = (double)READ_INT4( stream )/(double)(1<<16);
+        w    = READ_INT4( stream );
+        ptr  = READ_INT4( stream );
         break;
-        printf("\nHi I am here in gf_load_font 9.7\n\n");
       case GF_CHAR_LOC0:
-        code = READ_UINT1(fp);
-        dx   = (double)READ_INT1(fp);
+        code = READ_UINT1( stream );
+        dx   = (double)READ_INT1( stream );
         dy   = (double)0;
-        w    = READ_INT4(fp);
-        ptr  = READ_INT4(fp);
+        w    = READ_INT4( stream );
+        ptr  = READ_INT4( stream );
         break;
       default:
         error = FT_THROW( Invalid_File_Format );
         goto ErrExit;
       }
-printf("\nHi I am here in gf_load_font 10\n\n");
-      optr = ft_ftell(fp);
-      ft_fseek(fp, ptr, SEEK_SET);
+
+      /* optr = ft_ftell(fp); */
+      optr = stream->pos;
+      /* ft_fseek(fp, ptr, SEEK_SET); */
+      FT_STREAM_SEEK( ptr );
 
       bm = &go->bm_table[code - bc];
-      if (gf_read_glyph(fp, bm) < 0)
+      if (gf_read_glyph( stream, bm ) < 0)
         goto ErrExit;
-printf("\nHi I am here in gf_load_font 11\n\n");
+
       bm->mv_x = dx;
       bm->mv_y = dy;
-      ft_fseek(fp, optr, SEEK_SET);
+      /* ft_fseek(fp, optr, SEEK_SET); */
+      FT_STREAM_SEEK( ptr );
     }
 
+    *goptr          = go;
+    tp = ( go->code_max );
+    printf("tp go->code_max %d\n",go->code_max);
+  return error;
+
                ErrExit:
       printf("*ERROR\n");
       if (go != NULL)
@@ -506,11 +484,11 @@ printf("\nHi I am here in gf_load_font 11\n\n");
         if (go->bm_table != NULL)
         {
           for (i = 0; i < nchars; i++){}
-           /* FT_FREE(go->bm_table[i].bitmap); */
+          /*  FT_FREE(go->bm_table[i].bitmap);*/
         }
-        /* FT_FREE(go->bm_table); */ /* Returning unnecessary errors TO BE 
CHECKED */
+       /* FT_FREE(go->bm_table);*/ /* Returning unnecessary errors TO BE 
CHECKED */
       }
-      /* FT_FREE(go); */ /* Returning unnecessary errors TO BE CHECKED */
+     /* FT_FREE(go); *//* Returning unnecessary errors TO BE CHECKED */
   }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]