Commit c3dc56b85c96193a9c06829e5ac319c46cf356ce

Werner Lemberg 2004-04-19T06:13:50

* src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph), src/ttdriver.c (Load_Glyph): Change type of `glyph_index' to FT_UInt. From Lex Warners. * src/sfnt/ttload.c (tt_face_load_sfnt_header): Really fix change from 2004-03-19. * src/bdf/bdfdrivr.c (BDF_Face_Init): Use `ft_strlen'. * src/pcf/pcfutil.c, src/pcf/pcfutil.h: Decorate functions with `static.'. Remove unused function `RepadBitmap'. * src/pcf/pcfdrivr.c: Don't include pcfutil.h.

diff --git a/ChangeLog b/ChangeLog
index 779b516..72f977b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2004-04-18  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph),
+	src/ttdriver.c (Load_Glyph): Change type of `glyph_index' to
+	FT_UInt.  From Lex Warners.
+
+2004-04-17  Chisato Yamauchi  <cyamauch@a.phys.nagoya-u.ac.jp>
+
+	* src/sfnt/ttload.c (tt_face_load_sfnt_header): Really fix change
+	from 2004-03-19.
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `ft_strlen'.
+
+	* src/pcf/pcfutil.c, src/pcf/pcfutil.h: Decorate functions with
+	`static.'.
+	Remove unused function `RepadBitmap'.
+	* src/pcf/pcfdrivr.c: Don't include pcfutil.h.
+
 2004-04-16  Werner Lemberg  <wl@gnu.org>
 
 	* builds/unix/freetype-config.in (usage): Fix and improve usage
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index d757cba..2e8f93c 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -478,10 +478,10 @@ THE SOFTWARE.
 
 
             if ( FT_NEW_ARRAY( face->charset_encoding,
-                               strlen( charset_encoding->value.atom ) + 1 ) )
+                               ft_strlen( charset_encoding->value.atom ) + 1 ) )
               goto Exit;
             if ( FT_NEW_ARRAY( face->charset_registry,
-                               strlen( charset_registry->value.atom ) + 1 ) )
+                               ft_strlen( charset_registry->value.atom ) + 1 ) )
               goto Exit;
 
             ft_strcpy( face->charset_registry, charset_registry->value.atom );
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index 503daae..5cf83e9 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -37,7 +37,6 @@ THE SOFTWARE.
 
 #include "pcf.h"
 #include "pcfdrivr.h"
-#include "pcfutil.h"
 #include "pcfread.h"
 
 #include "pcferror.h"
diff --git a/src/pcf/pcfutil.c b/src/pcf/pcfutil.c
index eb911bb..ddaca35 100644
--- a/src/pcf/pcfutil.c
+++ b/src/pcf/pcfutil.c
@@ -25,6 +25,8 @@ in this Software without prior written authorization from The Open Group.
  * Author:  Keith Packard, MIT X Consortium
  */
 
+/* Modified for use with FreeType */
+
 
 #include <ft2build.h>
 #include "pcfutil.h"
@@ -72,7 +74,7 @@ in this Software without prior written authorization from The Open Group.
    *  Invert bit order within each BYTE of an array.
    */
 
-  void
+  static void
   BitOrderInvert( unsigned char*  buf,
                   int             nbytes )
   {
@@ -88,7 +90,7 @@ in this Software without prior written authorization from The Open Group.
    *  Invert byte order within each 16-bits of an array.
    */
 
-  void
+  static void
   TwoByteSwap( unsigned char*  buf,
                int             nbytes )
   {
@@ -107,7 +109,7 @@ in this Software without prior written authorization from The Open Group.
    *  Invert byte order within each 32-bits of an array.
    */
 
-  void
+  static void
   FourByteSwap( unsigned char*  buf,
                 int             nbytes )
   {
@@ -127,89 +129,4 @@ in this Software without prior written authorization from The Open Group.
   }
 
 
-  /*
-   *  Repad a bitmap.
-   */
-
-  int
-  RepadBitmap( char*         pSrc,
-               char*         pDst,
-               unsigned int  srcPad,
-               unsigned int  dstPad,
-               int           width,
-               int           height )
-  {
-    int   srcWidthBytes, dstWidthBytes;
-    int   row, col;
-    char  *pTmpSrc, *pTmpDst;
-
-
-    switch ( srcPad )
-    {
-    case 1:
-      srcWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      srcWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      srcWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      srcWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    switch ( dstPad )
-    {
-    case 1:
-      dstWidthBytes = ( width + 7 ) >> 3;
-      break;
-
-    case 2:
-      dstWidthBytes = ( ( width + 15 ) >> 4 ) << 1;
-      break;
-
-    case 4:
-      dstWidthBytes = ( ( width + 31 ) >> 5 ) << 2;
-      break;
-
-    case 8:
-      dstWidthBytes = ( ( width + 63 ) >> 6 ) << 3;
-      break;
-
-    default:
-      return 0;
-    }
-
-    width = srcWidthBytes;
-    if ( width > dstWidthBytes )
-      width = dstWidthBytes;
-
-    pTmpSrc= pSrc;
-    pTmpDst= pDst;
-
-    for ( row = 0; row < height; row++ )
-    {
-      for ( col = 0; col < width; col++ )
-        *pTmpDst++ = *pTmpSrc++;
-
-      while ( col < dstWidthBytes )
-      {
-        *pTmpDst++ = '\0';
-        col++;
-      }
-      pTmpSrc += srcWidthBytes - width;
-    }
-
-    return dstWidthBytes * height;
-  }
-
-
 /* END */
diff --git a/src/pcf/pcfutil.h b/src/pcf/pcfutil.h
index 32dd1ea..017c515 100644
--- a/src/pcf/pcfutil.h
+++ b/src/pcf/pcfutil.h
@@ -2,7 +2,7 @@
 
     FreeType font driver for pcf fonts
 
-  Copyright 2000-2001 by
+  Copyright 2000, 2001, 2004 by
   Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,25 +32,18 @@ THE SOFTWARE.
 #include <ft2build.h>
 
 
-  void
+  static void
   BitOrderInvert( unsigned char*  buf,
                   int             nbytes);
 
-  void
+  static void
   TwoByteSwap( unsigned char*  buf,
                int             nbytes);
 
-  void
+  static void
   FourByteSwap( unsigned char*  buf,
                 int             nbytes);
 
-  int
-  RepadBitmap( char*           pSrc,
-               char*           pDst,
-               unsigned int    srcPad,
-               unsigned int    dstPad,
-               int             width,
-               int             height);
 
 #endif /* __PCFUTIL_H__ */
 
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 00d2b79..d1b0b20 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -276,7 +276,7 @@
                             SFNT_Header  sfnt )
   {
     FT_Error   error;
-    FT_ULong   format_tag, offset;
+    FT_ULong   font_format_tag, format_tag, offset;
     FT_Memory  memory = stream->memory;
 
     static const FT_Frame_Field  sfnt_header_fields[] =
@@ -318,10 +318,12 @@
     /*                                                                    */
     offset = FT_STREAM_POS();
 
-    if ( FT_READ_ULONG( format_tag ) )
+    if ( FT_READ_ULONG( font_format_tag ) )
       goto Exit;
 
-    if ( format_tag == TTAG_ttcf )
+    format_tag = font_format_tag;
+
+    if ( font_format_tag == TTAG_ttcf )
     {
       FT_Int  n;
 
@@ -353,8 +355,8 @@
       /* seek to the appropriate TrueType file, then read tag */
       offset = face->ttc_header.offsets[face_index];
 
-      if ( FT_STREAM_SEEK( offset ) ||
-           FT_READ_LONG( format_tag )                             )
+      if ( FT_STREAM_SEEK( offset )   ||
+           FT_READ_LONG( format_tag ) )
         goto Exit;
     }
 
@@ -375,7 +377,7 @@
     }
 
     /* disallow face index values > 0 for non-TTC files */
-    if ( format_tag != TTAG_ttcf && face_index > 0 )
+    if ( font_format_tag != TTAG_ttcf && face_index > 0 )
       error = SFNT_Err_Bad_Argument;
 
   Exit:
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index e23fc35..a5b800d 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -293,7 +293,7 @@
   static FT_Error
   Load_Glyph( TT_GlyphSlot  slot,
               TT_Size       size,
-              FT_UShort     glyph_index,
+              FT_UInt       glyph_index,
               FT_Int32      load_flags )
   {
     FT_Error  error;
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index ffe0d73..00da0c2 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1729,7 +1729,7 @@
   FT_LOCAL_DEF( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
-                 FT_UShort     glyph_index,
+                 FT_UInt       glyph_index,
                  FT_Int32      load_flags )
   {
     SFNT_Service  sfnt;
@@ -1772,7 +1772,7 @@
 
       error = sfnt->load_sbit_image( face,
                                      (FT_ULong)size->strike_index,
-                                     (FT_UInt)glyph_index,
+                                     glyph_index,
                                      (FT_Int)load_flags,
                                      stream,
                                      &glyph->bitmap,
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index 36c93da..dfa2a60 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003 by                                     */
+/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -43,7 +43,7 @@ FT_BEGIN_HEADER
   FT_LOCAL( FT_Error )
   TT_Load_Glyph( TT_Size       size,
                  TT_GlyphSlot  glyph,
-                 FT_UShort     glyph_index,
+                 FT_UInt       glyph_index,
                  FT_Int32      load_flags );