shithub: freetype+ttf2subf

Download patch

ref: d15bc0d13a163995e1ca11925349bd64d1c33617
parent: 0cc456aa1a0e0fcffcdd73b4a3094bf5c3a7da96
author: David Turner <[email protected]>
date: Fri Apr 12 05:31:48 EDT 2002

* README.UNX: updated the Unix-specific quick-compilation guide to
          warn about the GNU Make requirement at compile time..

        * include/freetype/config/ftstdlib.h,
          include/freetype/config/ftconfig.h,
          include/freetype/config/ftheader.h,
          include/freetype/internal/ftmemory.h,
          include/freetype/internal/ftobjs.h,

          src/autohint/ahoptim.c,

          src/base/ftdbgmem.c, src/base/ftdebug.c,
          src/base/ftmac.c,    src/base/ftobjs.c,
          src/base/ftsystem.c,

          src/cache/ftcimage.c, src/cache/ftcsbits.c,

          src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,

          src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,

          src/pcf/pcfdriver.c, src/pcf/pcfread.c,

          src/psaux/t1cmap.c, src/psaux/t1decode.c,

          src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
          src/pshinter/pshrec.c,

          src/psnames/psmodule.c,

          src/raster/ftraster.c,

          src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,

          src/smooth/ftgrays.c,

          src/type1/t1afm.c,  src/type1/t1driver.c, src/type1/t1gload.c,
          src/type1/t1load.c, src/type1/t1objs.c,   src/type1/t1parse.c:

            added the new configuration file "ftstdlib.h" used to define
            aliases for all ISO C library functions used by the engine
            (e.g. strlen, qsort, setjmp, etc...)

            this eases the porting of FreeType 2 to exotic environments like
            XFree86 modules/extensions..

            also removed many #include <string.h>, #include <stdlib.h>, etc...
            from the engine's sources where they're not needed..

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,72 @@
+2002-04-12  David Turner  <[email protected]>
+
+        * README.UNX: updated the Unix-specific quick-compilation guide to
+          warn about the GNU Make requirement at compile time..
+
+        * include/freetype/config/ftstdlib.h,
+          include/freetype/config/ftconfig.h,
+          include/freetype/config/ftheader.h,
+          include/freetype/internal/ftmemory.h,
+          include/freetype/internal/ftobjs.h,
+          
+          src/autohint/ahoptim.c,
+          
+          src/base/ftdbgmem.c, src/base/ftdebug.c,
+          src/base/ftmac.c,    src/base/ftobjs.c,
+          src/base/ftsystem.c,
+
+          src/cache/ftcimage.c, src/cache/ftcsbits.c,
+          
+          src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,
+          
+          src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,
+          
+          src/pcf/pcfdriver.c, src/pcf/pcfread.c,
+          
+          src/psaux/t1cmap.c, src/psaux/t1decode.c,
+          
+          src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
+          src/pshinter/pshrec.c,
+          
+          src/psnames/psmodule.c,
+          
+          src/raster/ftraster.c,
+          
+          src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
+          
+          src/smooth/ftgrays.c,
+          
+          src/type1/t1afm.c,  src/type1/t1driver.c, src/type1/t1gload.c,
+          src/type1/t1load.c, src/type1/t1objs.c,   src/type1/t1parse.c:
+          
+            added the new configuration file "ftstdlib.h" used to define
+            aliases for all ISO C library functions used by the engine
+            (e.g. strlen, qsort, setjmp, etc...)
+            
+            this eases the porting of FreeType 2 to exotic environments like
+            XFree86 modules/extensions..
+
+            also removed many #include <string.h>, #include <stdlib.h>, etc...
+            from the engine's sources where they're not needed..
+
+
+2002-04-12  Vincent Caron  <[email protected]>
+
+        * configure, builds/detect.mk: updated the build system to print
+          a warning message in case GNU Make isn't used to build the library.
+          Very nice !
+
+
 2002-04-11  David Turner  <[email protected]>
 
-	* README, docs/CHANGES: Updates for the 2.1.0 release.
+        * README, docs/CHANGES, Jamfile.in: updating for the 2.1.0 release
+
+        * docs/FTL.txt: updated license text to provide a preffered disclaimer
+          and adjust copyright dates/extents
+
+        * include/freetype/cache/ftcglyph.h: removing obsolete (and confusing
+          comment)
+
 	* Jamfile.in: New file.
 
 2002-04-11  Maxim Shemanarev  <[email protected]>
--- a/README.UNX
+++ b/README.UNX
@@ -8,8 +8,8 @@
 
 
 
-  I. Enable the TrueType bytecode hinter if you need it
-  -----------------------------------------------------
+  I. Enable the TrueType bytecode hinter if you need it:
+  ------------------------------------------------------
 
     The  TrueType  bytecode  interpreter  is disabled  in  all  public
     releases  of  the  FreeType  packages  for  patents  reasons  (see
@@ -34,8 +34,8 @@
 
 
 
-  II. Determine the correct installation path
-  -------------------------------------------
+  II. Determine the correct installation path:
+  --------------------------------------------
   
     By  default,  the  source  package  will install  the  library  in
     "/usr/local".   However, many Unix  distributions now  install the
@@ -48,10 +48,33 @@
        
     on the command line.  This  should return the installation path to
     use below  (e.g. "/usr"  or "/usr/local").  Otherwise,  simply use
-    "/usr".
+    "/usr" (or what you think is adequate for your installation).
 
-    Then, to build and install the library, type:
+
+
+  III. Ensure that you're using GNU Make:
+  ---------------------------------------
+
+    The FreeType build system _exclusively_ works with GNU Make. You will
+    not be able to compile the library with the following instructions with
+    any other alternative (including BSD Make !!).
+
+    Trying to compile the library with a different Make tool will print a
+    message like:
     
+      "Sorry, GNU make is required to build FreeType2."
+      
+    and the build will be aborted. If this happens, install GNU Make on your
+    system, and use the GNUMAKE environment variable to name it.
+    
+
+
+  IV. Build and install the library:
+  ----------------------------------
+  
+    The following should work on all Unix systems where the 'make' command
+    invokes GNU Make:
+  
       ./configure --prefix=<yourprefix>
       make
       make install           (as root)
@@ -60,9 +83,21 @@
     the "freetype-config" command.
 
 
+    When using a different command to invoke GNU Make, use the GNUMAKE
+    variable. For example, if 'gmake' is the command to use on your system,
+    do something like:
+    
+       GNUMAKE=gmake  ./configure  --prefix=<yourprefix>
+       gmake
+       gmake install  (as root)
 
-  III. Take care of XFree86 version 4
-  -----------------------------------
+
+    If this still doesn't work, read the detailed compilation procedure
+    available in the file "docs/BUILD" for troubleshooting..
+
+
+  V. Take care of XFree86 version 4:
+  ----------------------------------
   
     Certain recent Linux distributions will install _several_ versions
     of FreeType on your system.   For example, on a fresh Mandrake 8.1
--- a/builds/amiga/src/base/ftdebug.c
+++ b/builds/amiga/src/base/ftdebug.c
@@ -38,7 +38,7 @@
   /*                                                                       */
   /* - release mode:                                                       */
   /*                                                                       */
-  /*   No error message is sent or generated.  The code is free from any   */
+  /*   No error message is sent or generated.  The code is ft_free from any   */
   /*   debugging parts.                                                    */
   /*                                                                       */
   /*************************************************************************/
@@ -58,7 +58,6 @@
 
 #include <stdarg.h>
 #include <stdlib.h>
-#include <string.h>
 
 
   FT_EXPORT_DEF( void )
--- a/builds/detect.mk
+++ b/builds/detect.mk
@@ -127,7 +127,7 @@
 	@echo "If this does not correspond to your system or settings please remove the file"
 	@echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help."
 	@echo ""
-	@echo "Otherwise, simply type \`make' again to build the library."
+	@echo "Otherwise, simply type \`$(MAKE)' again to build the library."
 	@echo ""
 	@$(COPY) $(CONFIG_RULES) $(CONFIG_MK)
 
--- a/configure
+++ b/configure
@@ -8,4 +8,15 @@
 #   Jamfile
 #   install
 #
-CFG="$@" make setup unix
+
+if [ "x$GNUMAKE" = x ]; then
+  GNUMAKE=make
+fi
+
+if [ `$GNUMAKE -v 2>/dev/null|grep -ic gnu` -eq 0 ]; then
+  echo "Sorry, GNU make is required to build FreeType2." >&2
+  echo "Please try \`GNUMAKE=<GNU make command name> $0'." >&2
+  exit 1
+fi
+
+CFG="$@" $GNUMAKE setup unix
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -41,8 +41,8 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_OPTIONS_H
+#include FT_CONFIG_STANDARD_LIBRARY_H
 
-
 FT_BEGIN_HEADER
 
 
@@ -58,15 +58,12 @@
   /*************************************************************************/
 
 
-  /* We use <limits.h> values to know the sizes of the types.  */
-#include <limits.h>
-
   /* The number of bytes in an `int' type.  */
-#if   UINT_MAX == 0xFFFFFFFFUL
+#if   FT_UINT_MAX == 0xFFFFFFFFUL
 #define FT_SIZEOF_INT  4
-#elif UINT_MAX == 0xFFFFU
+#elif FT_UINT_MAX == 0xFFFFU
 #define FT_SIZEOF_INT  2
-#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU
+#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
 #define FT_SIZEOF_INT  8
 #else
 #error "Unsupported number of bytes in `int' type!"
@@ -73,9 +70,9 @@
 #endif
 
   /* The number of bytes in a `long' type.  */
-#if   ULONG_MAX == 0xFFFFFFFFUL
+#if   FT_ULONG_MAX == 0xFFFFFFFFUL
 #define FT_SIZEOF_LONG  4
-#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
+#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
 #define FT_SIZEOF_LONG  8
 #else
 #error "Unsupported number of bytes in `long' type!"
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -111,6 +111,21 @@
   /*************************************************************************/
   /*                                                                       */
   /* @macro:                                                               */
+  /*    FT_CONFIG_STANDARD_LIBRARY_H                                       */
+  /*                                                                       */
+  /* @description:                                                         */
+  /*    A macro used in #include statements to name the file containing    */
+  /*    FreeType 2 configuration data.                                     */
+  /*                                                                       */
+#ifndef FT_CONFIG_STANDARD_LIBRARY_H
+#define FT_CONFIG_STANDARD_LIBRARY_H  <freetype/config/ftstdlib.h>
+#endif
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* @macro:                                                               */
   /*    FT_CONFIG_OPTIONS_H                                                */
   /*                                                                       */
   /* @description:                                                         */
--- /dev/null
+++ b/include/freetype/config/ftstdlib.h
@@ -1,0 +1,116 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftstdlib.h                                                             */
+/*                                                                         */
+/*    ANSI-specific configuration file                                     */
+/*                                                                         */
+/*  Copyright 1996-2001, 2002 by                                           */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/*                                                                         */
+/*  This file is used to group all #includes to the ANSI C library         */
+/*  that FreeType normally requires. It also defines macros to rename      */
+/*  the standard functions within the FT source code                       */
+/*                                                                         */
+/*  (You're free to provide alternative when working in exotic             */
+/*   runtime environments :-)                                              */
+/*                                                                         */
+/***************************************************************************/
+
+#ifndef __FT_STANDARD_LIBRARY_H__
+#define __FT_STANDARD_LIBRARY_H__
+
+
+/************************************************************************/
+/*                                                                      */
+/*                            integer limits                            */
+/*                                                                      */
+/*  UINT_MAX and ULONG_MAX are used to automatically compute the size   */
+/*  of 'int' and 'long' in bytes at compile-time. So far, this works    */
+/*  for all platforms the library has been tested on.                   */
+/*                                                                      */
+/*  Note that on the extremely rare platforms that do not provide       */
+/*  integer types that are _exactly_ 16 and 32 bits wide (e.g. some     */
+/*  old Crays where 'int' is 36 bits !!), we do not make any guarantee  */
+/*  about the correct behaviour of FT2 with all fonts..                 */
+/*                                                                      */
+/*  in these case, "ftconfig.h" will refuse to compile anyway with a    */
+/*  message like "couldn't find 32-bit type" or something similar       */
+/*  anyway..                                                            */
+/*                                                                      */
+/*                                                                      */
+/*  IMPORTANT NOTE: We do not define aliases for heap management and    */
+/*                  i/o routines (i.e. malloc/free/fopen/fread/...)     */
+/*                  since these functions should all be encapsulated    */
+/*                  by platform-specific implementations of             */
+/*                  "ftsystem.c" anyway !!                              */
+/*                                                                      */
+/************************************************************************/
+
+#include <limits.h>
+#define  FT_UINT_MAX   UINT_MAX
+#define  FT_ULONG_MAX  ULONG_MAX
+
+
+/************************************************************************/
+/*                                                                      */
+/*                   character and string processing                    */
+/*                                                                      */
+/************************************************************************/
+
+#include <ctype.h>
+#define  ft_isalnum    isalnum
+#define  ft_isupper    isupper
+#define  ft_islower    islower
+
+
+#include <string.h>
+#define  ft_strlen     strlen
+#define  ft_strcmp     strcmp
+#define  ft_strncmp    strncmp
+#define  ft_memcpy     memcpy
+#define  ft_strcpy     strcpy
+#define  ft_strncpy    strncpy
+#define  ft_memset     memset
+#define  ft_memmove    memmove
+
+
+/************************************************************************/
+/*                                                                      */
+/*                               sorting                                */
+/*                                                                      */
+/************************************************************************/
+
+#include <stdlib.h>   /* for qsort() */
+#define  ft_qsort      qsort
+
+
+/************************************************************************/
+/*                                                                      */
+/*                           execution control                          */
+/*                                                                      */
+/************************************************************************/
+
+#include <setjmp.h>
+
+#define  ft_jmp_buf   jmp_buf   /* note: this cannot be a typedef since */
+                                /*       jmp_buf is defined as a macro  */
+                                /*       on certain platforms..         */
+
+#define  ft_setjmp   setjmp     /* same thing here */
+#define  ft_longjmp  longjmp    /*   "             */
+
+
+/* the following is only used for debugging purposes, i.e. when */
+/* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined     */
+/*                                                              */
+#include <stdarg.h>
+
+
+#endif /* __FT_STANDARD_LIBRARY_H__ */
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -172,15 +172,11 @@
            void**     P );
 
 
-  /* This `#include' is needed by the MEM_xxx() macros; it should be */
-  /* available on all platforms we know of.                          */
-#include <string.h>
+#define FT_MEM_SET( dest, byte, count )     ft_memset( dest, byte, count )
 
-#define FT_MEM_SET( dest, byte, count )     memset( dest, byte, count )
+#define FT_MEM_COPY( dest, source, count )  ft_memcpy( dest, source, count )
 
-#define FT_MEM_COPY( dest, source, count )  memcpy( dest, source, count )
-
-#define FT_MEM_MOVE( dest, source, count )  memmove( dest, source, count )
+#define FT_MEM_MOVE( dest, source, count )  ft_memmove( dest, source, count )
 
 
   /*************************************************************************/
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -132,7 +132,7 @@
     FT_ValidationLevel  level;  /* validation level                 */
     FT_Error            error;  /* error returned. 0 means success  */
 
-    jmp_buf             jump_buffer;  /* used for exception handling */
+    ft_jmp_buf             jump_buffer;  /* used for exception handling */
 
   } FT_ValidatorRec;
 
--- a/src/autohint/ahoptim.c
+++ b/src/autohint/ahoptim.c
@@ -61,7 +61,6 @@
 
 #include <stdarg.h>
 #include <stdlib.h>
-#include <string.h>
 
 #define FLOAT( x )  ( (float)( (x) / 64.0 ) )
 
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -30,7 +30,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 
 
   typedef struct FT_MemNodeRec_*   FT_MemNode;
@@ -122,9 +121,7 @@
   };
 
 
-#include <stdarg.h>
 
-
   extern void
   ft_mem_debug_panic( const char*  fmt, ... )
   {
@@ -547,7 +544,7 @@
         block, file_name, line_no );
 
     if ( node->size != cur_size )
-      ft_mem_debug_panic( "invalid realloc request for %p. cur_size is "
+      ft_mem_debug_panic( "invalid ft_realloc request for %p. cur_size is "
                           "%ld instead of %ld in (%s:%ld)",
                           block, cur_size, node->size, file_name, line_no );
 
@@ -555,7 +552,7 @@
     if ( new_block == NULL )
       return NULL;
 
-    memcpy( new_block, block, cur_size < new_size ? cur_size : new_size );
+    ft_memcpy( new_block, block, cur_size < new_size ? cur_size : new_size );
 
     table->file_name = file_name;
     table->line_no   = line_no;
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -47,12 +47,6 @@
 
 #if defined( FT_DEBUG_LEVEL_ERROR )
 
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-
   FT_EXPORT_DEF( void )
   FT_Message( const char*  fmt, ... )
   {
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -69,7 +69,6 @@
 #include <Files.h>
 #include <TextUtils.h>
 
-#include <ctype.h>  /* for isupper() and isalnum() */
 
 #include FT_MAC_H
 
@@ -90,7 +89,7 @@
     static char  cstr[256];
 
 
-    strncpy( cstr, (char*)pstr + 1, pstr[0] );
+    ft_strncpy( cstr, (char*)pstr + 1, pstr[0] );
     cstr[pstr[0]] = '\0';
     return cstr;
   }
@@ -106,11 +105,11 @@
 
 
     /* convert path to a pascal string */
-    path_len = strlen( pathname );
+    path_len = ft_strlen( pathname );
     if ( path_len > 255 )
       return -1;
     p_path[0] = (unsigned char)path_len;
-    strncpy( (char*)p_path + 1, pathname, path_len );
+    ft_strncpy( (char*)p_path + 1, pathname, path_len );
 
     if ( FSMakeFSSpec( 0, 0, p_path, spec ) != noErr )
       return -1;
@@ -172,7 +171,7 @@
           max = 3;
         count = 0;
       }
-      if ( count < max && ( isalnum( *q ) || *q == '_' ) )
+      if ( count < max && ( ft_isalnum( *q ) || *q == '_' ) )
       {
         *++p = *q;
         lwfn_file_name[0]++;
@@ -299,7 +298,7 @@
         p += names[i][0];
         p++;
       }
-      strcpy( ps_name, p2c_str( names[0] ) );  /* Family name */
+      ft_strcpy( ps_name, p2c_str( names[0] ) );  /* Family name */
 
       if ( style->indexes[0] > 1 )
       {
@@ -410,7 +409,7 @@
         }
       }
 
-      memcpy( p, *post_data + 2, post_size );
+      ft_memcpy( p, *post_data + 2, post_size );
       pfb_chunk_size += post_size;
       p += post_size;
       last_code = code;
@@ -595,7 +594,7 @@
     }
 
     HLock( sfnt );
-    memcpy( sfnt_data, *sfnt, sfnt_size );
+    ft_memcpy( sfnt_data, *sfnt, sfnt_size );
     HUnlock( sfnt );
     ReleaseResource( sfnt );
 
@@ -797,7 +796,7 @@
 
 
             /* build up a complete face name */
-            strcpy( fullName, famName );
+            ft_strcpy( fullName, famName );
             if ( style & bold )
               strcat( fullName, " Bold" );
             if ( style & italic )
@@ -804,7 +803,7 @@
               strcat( fullName, " Italic" );
 
             /* compare with the name we are looking for */
-            if ( strcmp( fullName, fontName ) == 0 )
+            if ( ft_strcmp( fullName, fontName ) == 0 )
             {
               /* found it! */
               the_font = font;
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -25,10 +25,7 @@
 #include FT_TRUETYPE_TABLES_H
 #include FT_OUTLINE_H
 
-#include <string.h>     /* for strcmp() */
-#include <setjmp.h>     /* for setjmp() and longjmp() */
 
-
   FT_BASE_DEF( void )
   ft_validator_init( FT_Validator        valid,
                      const FT_Byte*      base,
@@ -2167,7 +2164,7 @@
     for ( nn = 0; nn < library->num_modules; nn++ )
     {
       module = library->modules[nn];
-      if ( strcmp( module->clazz->module_name, clazz->module_name ) == 0 )
+      if ( ft_strcmp( module->clazz->module_name, clazz->module_name ) == 0 )
       {
         /* this installed module has the same name, compare their versions */
         if ( clazz->module_version <= module->clazz->module_version )
@@ -2283,7 +2280,7 @@
     limit = cur + library->num_modules;
 
     for ( ; cur < limit; cur++ )
-      if ( strcmp( cur[0]->clazz->module_name, module_name ) == 0 )
+      if ( ft_strcmp( cur[0]->clazz->module_name, module_name ) == 0 )
       {
         result = cur[0];
         break;
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -34,7 +34,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 
 
   /*************************************************************************/
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -24,9 +24,6 @@
 
 #include "ftcerror.h"
 
-#include <string.h>     /* memcmp() */
-#include <stdlib.h>     /* labs()   */
-
 
   /* the FT_Glyph image node type */
   typedef struct  FTC_ImageNodeRec_
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -26,8 +26,6 @@
 
 #include "ftcerror.h"
 
-#include <string.h>         /* memcmp() */
-
 
 #define FTC_SBIT_ITEMS_PER_NODE  16
 
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -257,7 +257,7 @@
 
     if ( buffer_max > 0 )
     {
-      FT_UInt  len = strlen( gname );
+      FT_UInt  len = ft_strlen( gname );
 
 
       if ( len >= buffer_max )
@@ -410,7 +410,7 @@
       else
         name = (FT_String *)psnames->adobe_std_strings( sid );
 
-      result = strcmp( glyph_name, name );
+      result = ft_strcmp( glyph_name, name );
 
       if ( sid > 390 )
         FT_FREE( name );
@@ -444,10 +444,10 @@
 
 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
 
-    if ( strcmp( (const char*)interface, "glyph_name" ) == 0 )
+    if ( ft_strcmp( (const char*)interface, "glyph_name" ) == 0 )
       return (FT_Module_Interface)cff_get_glyph_name;
 
-    if ( strcmp( (const char*)interface, "name_index" ) == 0 )
+    if ( ft_strcmp( (const char*)interface, "name_index" ) == 0 )
       return (FT_Module_Interface)cff_get_name_index;
 
 #endif
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1332,7 +1332,7 @@
         FT_Error   error;
 
 
-        len = (FT_UInt)strlen( adobe_name );
+        len = (FT_UInt)ft_strlen( adobe_name );
         if ( !FT_ALLOC( name, len + 1 ) )
         {
           FT_MEM_COPY( name, adobe_name, len );
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -31,9 +31,7 @@
 
 #include "cfferrs.h"
 
-#include <string.h>         /* for strlen() */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -231,7 +229,7 @@
   {
     FT_Error    error;
     FT_String*  result = 0;
-    FT_Int      len = (FT_Int)strlen( source );
+    FT_Int      len = (FT_Int)ft_strlen( source );
 
 
     if ( !FT_ALLOC( result, len + 1 ) )
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -26,10 +26,7 @@
 
 #include "ciderrs.h"
 
-#include <stdio.h>
-#include <ctype.h>  /* for isspace(), isalnum() */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -285,7 +282,7 @@
   static int
   is_alpha( char  c )
   {
-    return ( isalnum( (int)c ) ||
+    return ( ft_isalnum( (int)c ) ||
              c == '.'          ||
              c == '_'          );
   }
@@ -313,7 +310,7 @@
       {
         /* look for `%ADOBeginFontDict' */
         if ( *cur == '%' && cur + 20 < limit &&
-             strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 )
+             ft_strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 )
         {
           cur += 17;
 
@@ -352,7 +349,7 @@
                 break;
 
               if ( cur[0] == name[0]                          &&
-                   len == (FT_Int)strlen( (const char*)name ) )
+                   len == (FT_Int)ft_strlen( (const char*)name ) )
               {
                 FT_Int  n;
 
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -26,9 +26,7 @@
 
 #include "ciderrs.h"
 
-#include <string.h>     /* for strncmp() */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -73,7 +71,7 @@
     if ( FT_FRAME_ENTER( 31 ) )
       goto Exit;
 
-    if ( strncmp( (char *)stream->cursor,
+    if ( ft_strncmp( (char *)stream->cursor,
                   "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
     {
       FT_TRACE2(( "[not a valid CID-keyed font]\n" ));
@@ -108,7 +106,7 @@
       /* look for `StartData' */
       for ( p = buffer; p < limit; p++ )
       {
-        if ( p[0] == 'S' && strncmp( (char*)p, "StartData", 9 ) == 0 )
+        if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 )
         {
           /* save offset of binary data after `StartData' */
           offset = (FT_ULong)( top_position - ( limit - p ) + 10 );
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -25,9 +25,7 @@
 
 #include "ciderrs.h"
 
-#include <string.h>         /* for strcmp() */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -58,7 +56,7 @@
     FT_UNUSED( driver );
     FT_UNUSED( interface );
 
-    if ( strcmp( (const char*)interface, "postscript_name" ) == 0 )
+    if ( ft_strcmp( (const char*)interface, "postscript_name" ) == 0 )
       return (FT_Module_Interface)cid_get_postscript_name;
 
     return 0;
@@ -175,7 +173,7 @@
 
 
             if ( gname && gname[0] == glyph_name[0] &&
-                 strcmp( gname, glyph_name ) == 0   )
+                 ft_strcmp( gname, glyph_name ) == 0   )
             {
               result = n;
               break;
@@ -275,7 +273,7 @@
 
 
             if ( gname && gname[0] == glyph_name[0] &&
-                 strcmp( gname, glyph_name ) == 0   )
+                 ft_strcmp( gname, glyph_name ) == 0   )
             {
               return charcode;
             }
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -315,9 +315,9 @@
       if ( ( charset_registry != NULL ) &&
            ( charset_encoding != NULL ) )
       {
-        if ( !strcmp( face->charset_registry, "ISO10646" ) ||
-           ( !strcmp( face->charset_registry, "ISO8859" ) &&
-             !strcmp( face->charset_encoding, "1" ) ) )
+        if ( !ft_strcmp( face->charset_registry, "ISO10646" ) ||
+           ( !ft_strcmp( face->charset_registry, "ISO8859" ) &&
+             !ft_strcmp( face->charset_encoding, "1" ) ) )
           unicode_charmap = 1;
       }
 
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -36,9 +36,7 @@
 
 #include "pcferror.h"
 
-#include <string.h>     /* strlen(), strcpy() */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -331,7 +329,7 @@
 
     for ( i = 0 ; i < face->nprops && !found; i++ )
     {
-      if ( !strcmp( properties[i].name, prop ) )
+      if ( !ft_strcmp( properties[i].name, prop ) )
         found = 1;
     }
 
@@ -433,9 +431,9 @@
     {
       /* XXX: make atom */
       if ( FT_NEW_ARRAY( properties[i].name,
-                         strlen( strings + props[i].name ) + 1 ) )
+                         ft_strlen( strings + props[i].name ) + 1 ) )
         goto Bail;
-      strcpy( properties[i].name,strings + props[i].name );
+      ft_strcpy( properties[i].name,strings + props[i].name );
 
       properties[i].isString = props[i].isString;
 
@@ -442,9 +440,9 @@
       if ( props[i].isString )
       {
         if ( FT_NEW_ARRAY( properties[i].value.atom,
-                           strlen( strings + props[i].value ) + 1 ) )
+                           ft_strlen( strings + props[i].value ) + 1 ) )
           goto Bail;
-        strcpy( properties[i].value.atom, strings + props[i].value );
+        ft_strcpy( properties[i].value.atom, strings + props[i].value );
       }
       else
         properties[i].value.integer = props[i].value;
@@ -952,12 +950,12 @@
       {
         if ( prop->isString )
         {
-          int  l = strlen( prop->value.atom ) + 1;
+          int  l = ft_strlen( prop->value.atom ) + 1;
 
 
           if ( FT_NEW_ARRAY( root->family_name, l ) )
             goto Exit;
-          strcpy( root->family_name, prop->value.atom );
+          ft_strcpy( root->family_name, prop->value.atom );
         }
       }
       else
@@ -1025,15 +1023,15 @@
                ( charset_encoding->isString ) )
           {
             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;
 
-            strcpy( face->charset_registry, charset_registry->value.atom );
-            strcpy( face->charset_encoding, charset_encoding->value.atom );
+            ft_strcpy( face->charset_registry, charset_registry->value.atom );
+            ft_strcpy( face->charset_encoding, charset_encoding->value.atom );
           }
         }
       }
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -17,7 +17,6 @@
 
 
 #include "t1cmap.h"
-#include <stdlib.h>     /* for qsort() */
 
 #include FT_INTERNAL_DEBUG_H
 
@@ -82,7 +81,7 @@
 
 
         if ( gname && gname[0] == glyph_name[0] &&
-             strcmp( gname, glyph_name ) == 0   )
+             ft_strcmp( gname, glyph_name ) == 0   )
         {
           result = n;
           break;
@@ -337,7 +336,7 @@
         }
 
         /* sort the pairs table to allow efficient binary searches */
-        qsort( cmap->pairs,
+        ft_qsort( cmap->pairs,
                new_count,
                sizeof ( T1_CMapUniPairRec ),
                t1_cmap_uni_pair_compare );
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -143,7 +143,7 @@
 
 
       if ( name && name[0] == glyph_name[0] &&
-           strcmp( name,glyph_name ) == 0 )
+           ft_strcmp( name,glyph_name ) == 0 )
         return n;
     }
 
--- a/src/pshinter/pshalgo1.c
+++ b/src/pshinter/pshalgo1.c
@@ -757,7 +757,7 @@
 
 
       /* initialize hints table */
-      memset( &hints, 0, sizeof ( hints ) );
+      ft_memset( &hints, 0, sizeof ( hints ) );
       error = psh1_hint_table_init( &hints,
                                     &dim->hints,
                                     &dim->masks,
--- a/src/pshinter/pshalgo2.c
+++ b/src/pshinter/pshalgo2.c
@@ -861,7 +861,7 @@
 
 
     /* clear all fields */
-    memset( glyph, 0, sizeof ( *glyph ) );
+    ft_memset( glyph, 0, sizeof ( *glyph ) );
 
     memory = globals->memory;
 
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -472,7 +472,7 @@
         PS_MaskRec  dummy = *mask2;
 
 
-        memmove( mask2, mask2 + 1, delta * sizeof ( PS_MaskRec ) );
+        ft_memmove( mask2, mask2 + 1, delta * sizeof ( PS_MaskRec ) );
 
         mask2[delta] = dummy;
       }
@@ -797,7 +797,7 @@
   ps_hints_init( PS_Hints   hints,
                  FT_Memory  memory )
   {
-    memset( hints, 0, sizeof ( *hints ) );
+    ft_memset( hints, 0, sizeof ( *hints ) );
     hints->memory = memory;
     return 0;
   }
@@ -1132,7 +1132,7 @@
   FT_LOCAL_DEF( void )
   t1_hints_funcs_init( T1_Hints_FuncsRec*  funcs )
   {
-    memset( (char*)funcs, 0, sizeof ( *funcs ) );
+    ft_memset( (char*)funcs, 0, sizeof ( *funcs ) );
 
     funcs->open  = (T1_Hints_OpenFunc)    t1_hints_open;
     funcs->close = (T1_Hints_CloseFunc)   ps_hints_close;
@@ -1197,7 +1197,7 @@
   FT_LOCAL_DEF( void )
   t2_hints_funcs_init( T2_Hints_FuncsRec*  funcs )
   {
-    memset( funcs, 0, sizeof ( *funcs ) );
+    ft_memset( funcs, 0, sizeof ( *funcs ) );
 
     funcs->open    = (T2_Hints_OpenFunc)   t2_hints_open;
     funcs->close   = (T2_Hints_CloseFunc)  ps_hints_close;
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -25,10 +25,7 @@
 
 #include "psnamerr.h"
 
-#include <stdlib.h>     /* for qsort()             */
-#include <string.h>     /* for strcmp(), strncpy() */
 
-
 #ifndef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES
 
 
@@ -106,7 +103,7 @@
 
       if ( *p && len < 64 )
       {
-        strncpy( temp, glyph_name, len );
+        ft_strncpy( temp, glyph_name, len );
         temp[len]  = 0;
         glyph_name = temp;
       }
@@ -118,7 +115,7 @@
       const char*  name = sid_standard_names[n];
 
 
-      if ( first == name[0] && strcmp( glyph_name, name ) == 0 )
+      if ( first == name[0] && ft_strcmp( glyph_name, name ) == 0 )
         return ps_names_to_unicode[n];
     }
 
@@ -127,7 +124,7 @@
   }
 
 
-  /* qsort callback to sort the unicode map */
+  /* ft_qsort callback to sort the unicode map */
   FT_CALLBACK_DEF( int )
   compare_uni_maps( const void*  a,
                     const void*  b )
@@ -198,7 +195,7 @@
       }
       else
         /* sort the table in increasing order of unicode values */
-        qsort( table->maps, count, sizeof ( PS_UniMap ), compare_uni_maps );
+        ft_qsort( table->maps, count, sizeof ( PS_UniMap ), compare_uni_maps );
 
       table->num_maps = count;
     }
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -187,7 +187,7 @@
 
 
 #ifndef FT_MEM_SET
-#define FT_MEM_SET( d, s, c )  memset( d, s, c )
+#define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )
 #endif
 
 
@@ -2094,7 +2094,7 @@
       {
         target[0] |= f1;
 
-        /* memset() is slower than the following code on many platforms. */
+        /* ft_memset() is slower than the following code on many platforms. */
         /* This is due to the fact that, in the vast majority of cases,  */
         /* the span length in bytes is relatively small.                 */
         c2--;
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -33,9 +33,7 @@
 #include "ttpost.h"
 #endif
 
-#include <string.h>     /* for strcmp() */
 
-
   static void*
   get_sfnt_table( TT_Face      face,
                   FT_Sfnt_Tag  tag )
@@ -97,7 +95,7 @@
     error = TT_Get_PS_Name( face, glyph_index, &gname );
     if ( !error && buffer_max > 0 )
     {
-      FT_UInt  len = (FT_UInt)( strlen( gname ) );
+      FT_UInt  len = (FT_UInt)( ft_strlen( gname ) );
 
 
       if ( len >= buffer_max )
@@ -201,15 +199,15 @@
   {
     FT_UNUSED( module );
 
-    if ( strcmp( interface, "get_sfnt" ) == 0 )
+    if ( ft_strcmp( interface, "get_sfnt" ) == 0 )
       return (FT_Module_Interface)get_sfnt_table;
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
-    if ( strcmp( interface, "glyph_name" ) == 0 )
+    if ( ft_strcmp( interface, "glyph_name" ) == 0 )
       return (FT_Module_Interface)get_sfnt_glyph_name;
 #endif
 
-    if ( strcmp( interface, "postscript_name" ) == 0 )
+    if ( ft_strcmp( interface, "postscript_name" ) == 0 )
       return (FT_Module_Interface)get_sfnt_postscript_name;
 
     return 0;
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -26,9 +26,7 @@
 
 #include "sferrors.h"
 
-#include <stdlib.h>  /* for qsort */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -1720,7 +1718,7 @@
           {
             if ( tt_kern_pair_compare( pair0, pair0 + 1 ) != -1 )
             {
-              qsort( (void*)face->kern_pairs, (int)num_pairs,
+              ft_qsort( (void*)face->kern_pairs, (int)num_pairs,
                      sizeof ( TT_Kern0_PairRec ), tt_kern_pair_compare );
               break;
             }
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -50,7 +50,7 @@
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
 
 
-#include <freetype/internal/psnames.h>
+#include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
 #define MAC_NAME( x )  ( (FT_String*)psnames->macintosh_name( x ) )
 
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -81,10 +81,7 @@
   /*************************************************************************/
 
 
-#include <string.h>             /* for memcpy() */
-#include <setjmp.h>
 
-
 /* experimental support for gamma correction within the rasterizer */
 #define xxxGRAYS_USE_GAMMA
 
@@ -101,8 +98,18 @@
 
 #define ErrRaster_MemoryOverflow   -4
 
+
+
+
+
+
+
 #ifdef _STANDALONE_
 
+#include <string.h>             /* for ft_memcpy() */
+#include <setjmp.h>
+#include <limits.h>
+#define  FT_UINT_MAX  UINT_MAX
 
 #define ErrRaster_Invalid_Mode     -2
 #define ErrRaster_Invalid_Outline  -1
@@ -146,7 +153,7 @@
 
 
 #ifndef FT_MEM_SET
-#define FT_MEM_SET( d, s, c )  memset( d, s, c )
+#define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )
 #endif
 
   /* define this to dump debugging information */
@@ -203,7 +210,7 @@
   /* increases the number of cells available in the render pool but slows  */
   /* down the rendering a bit.  It is useful if you have a really tiny     */
   /* render pool.                                                          */
-#define xxxGRAYS_COMPACT
+#undef  GRAYS_COMPACT
 
 
   /*************************************************************************/
@@ -229,9 +236,7 @@
 #else /* PIXEL_BITS >= 8 */
 
   /* approximately determine the size of integers using an ANSI-C header */
-#include <limits.h>
-
-#if UINT_MAX == 0xFFFFU
+#if FT_UINT_MAX == 0xFFFFU
   typedef long  TArea;
 #else
   typedef int  TArea;
@@ -308,7 +313,7 @@
     int  cubic_level;
 
     void*    memory;
-    jmp_buf  jump_buffer;
+    ft_jmp_buf  jump_buffer;
 
 #ifdef GRAYS_USE_GAMMA
     FT_Byte  gamma[257];
@@ -1083,7 +1088,7 @@
 #ifdef QUICK_SORT
 
   /* This is a non-recursive quicksort that directly process our cells     */
-  /* array.  It should be faster than calling the stdlib qsort(), and we   */
+  /* array.  It should be faster than calling the stdlib ft_qsort(), and we   */
   /* can even tailor our insertion threshold...                            */
 
 #define QSORT_THRESHOLD  9  /* below this size, a sub-array will be sorted */
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -20,9 +20,6 @@
 #include "t1afm.h"
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_TYPE1_TYPES_H
-#include <stdlib.h>  /* for qsort()   */
-#include <string.h>  /* for strcmp()  */
-#include <ctype.h>   /* for isalnum() */
 
 
   /*************************************************************************/
@@ -48,7 +45,7 @@
 #undef  IS_KERN_PAIR
 #define IS_KERN_PAIR( p )  ( p[0] == 'K' && p[1] == 'P' )
 
-#define IS_ALPHANUM( c )  ( isalnum( c ) || \
+#define IS_ALPHANUM( c )  ( ft_isalnum( c ) || \
                             c == '_'     || \
                             c == '.'     )
 
@@ -92,7 +89,7 @@
         char*  gname = (char*)type1->glyph_names[n];
 
 
-        if ( gname && gname[0] == temp[0] && strcmp( gname, temp ) == 0 )
+        if ( gname && gname[0] == temp[0] && ft_strcmp( gname, temp ) == 0 )
         {
           result = n;
           break;
@@ -229,7 +226,7 @@
     }
 
     /* now, sort the kern pairs according to their glyph indices */
-    qsort( afm->kern_pairs, count, sizeof ( T1_Kern_Pair ),
+    ft_qsort( afm->kern_pairs, count, sizeof ( T1_Kern_Pair ),
            compare_kern_pairs );
 
   Exit:
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -31,9 +31,7 @@
 #include FT_INTERNAL_STREAM_H
 #include FT_INTERNAL_POSTSCRIPT_NAMES_H
 
-#include <string.h>     /* for strcmp() */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -57,7 +55,7 @@
 
     if ( buffer_max > 0 )
     {
-      FT_UInt  len = (FT_UInt)( strlen( gname ) );
+      FT_UInt  len = (FT_UInt)( ft_strlen( gname ) );
 
 
       if (len >= buffer_max)
@@ -100,7 +98,7 @@
     {
       gname = face->type1.glyph_names[i];
 
-      if ( !strcmp( glyph_name, gname ) )
+      if ( !ft_strcmp( glyph_name, gname ) )
         return (FT_UInt)i;
     }
 
@@ -149,23 +147,23 @@
     FT_UNUSED( driver );
     FT_UNUSED( interface );
 
-    if ( strcmp( (const char*)interface, "glyph_name" ) == 0 )
+    if ( ft_strcmp( (const char*)interface, "glyph_name" ) == 0 )
       return (FT_Module_Interface)t1_get_glyph_name;
 
-    if ( strcmp( (const char*)interface, "name_index" ) == 0 )
+    if ( ft_strcmp( (const char*)interface, "name_index" ) == 0 )
       return (FT_Module_Interface)t1_get_name_index;
 
-    if ( strcmp( (const char*)interface, "postscript_name" ) == 0 )
+    if ( ft_strcmp( (const char*)interface, "postscript_name" ) == 0 )
       return (FT_Module_Interface)t1_get_ps_name;
 
 #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
-    if ( strcmp( (const char*)interface, "get_mm" ) == 0 )
+    if ( ft_strcmp( (const char*)interface, "get_mm" ) == 0 )
       return (FT_Module_Interface)T1_Get_Multi_Master;
 
-    if ( strcmp( (const char*)interface, "set_mm_design") == 0 )
+    if ( ft_strcmp( (const char*)interface, "set_mm_design") == 0 )
       return (FT_Module_Interface)T1_Set_MM_Design;
 
-    if ( strcmp( (const char*)interface, "set_mm_blend") == 0 )
+    if ( ft_strcmp( (const char*)interface, "set_mm_blend") == 0 )
       return (FT_Module_Interface)T1_Set_MM_Blend;
 #endif
     return 0;
@@ -333,7 +331,7 @@
 
 
             if ( gname && gname[0] == glyph_name[0] &&
-                 strcmp( gname, glyph_name ) == 0   )
+                 ft_strcmp( gname, glyph_name ) == 0   )
             {
               result = n;
               break;
@@ -448,7 +446,7 @@
 
 
             if ( gname && gname[0] == glyph_name[0] &&
-                 strcmp( gname, glyph_name ) == 0   )
+                 ft_strcmp( gname, glyph_name ) == 0   )
               return charcode;
           }
         }
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -25,8 +25,6 @@
 
 #include "t1errors.h"
 
-#include <string.h>     /* for strcmp() */
-
 
   /*************************************************************************/
   /*                                                                       */
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -68,11 +68,8 @@
 #include FT_INTERNAL_TYPE1_TYPES_H
 
 #include "t1load.h"
-
 #include "t1errors.h"
 
-#include <string.h>     /* for strncmp(), strcmp() */
-#include <ctype.h>      /* for isalnum()           */
 
 
   /*************************************************************************/
@@ -770,7 +767,7 @@
     /* Note: we must accept "+" as a valid character, as it is used in */
     /*       embedded type1 fonts in PDF documents.                    */
     /*                                                                 */
-    return ( isalnum( c ) || c == '.' || c == '_' || c == '-' || c == '+' );
+    return ( ft_isalnum( c ) || c == '.' || c == '_' || c == '-' || c == '+' );
   }
 
 
@@ -1076,15 +1073,15 @@
     else
     {
       if ( cur + 17 < limit &&
-           strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 )
+           ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 )
         face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD;
 
       else if ( cur + 15 < limit &&
-                strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
+                ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
         face->type1.encoding_type = T1_ENCODING_TYPE_EXPORT;
 
       else if ( cur + 18 < limit &&
-                strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 )
+                ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 )
         face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1;
 
       else
@@ -1139,7 +1136,7 @@
 
       /* If the next token isn't `dup', we are also done.  This */
       /* happens when there are `holes' in the Subrs array.     */
-      if ( strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
+      if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
         break;
 
       idx = T1_ToInt( parser );
@@ -1155,7 +1152,7 @@
       T1_Skip_Alpha( parser );    /* `NP' or `I' or `noaccess' */
       T1_Skip_Spaces( parser );
 
-      if ( strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 )
+      if ( ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 )
       {
         T1_Skip_Alpha( parser );  /* skip `put' */
         T1_Skip_Spaces( parser );
@@ -1296,7 +1293,7 @@
         name_table->elements[n][len] = '\0';
 
         /* record index of /.notdef              */
-        if ( strcmp( (const char*)".notdef",
+        if ( ft_strcmp( (const char*)".notdef",
                      (const char*)(name_table->elements[n]) ) == 0 )
         {
           notdef_index = n;
@@ -1336,7 +1333,7 @@
     loader->num_glyphs = n;
 
     /* if /.notdef is found but does not occupy index 0, do our magic.      */
-    if ( strcmp( (const char*)".notdef",
+    if ( ft_strcmp( (const char*)".notdef",
                  (const char*)name_table->elements[0] ) &&
          notdef_found                                      )
     {
@@ -1503,7 +1500,7 @@
       {
         /* look for `FontDirectory', which causes problems on some fonts */
         if ( *cur == 'F' && cur + 25 < limit                 &&
-             strncmp( (char*)cur, "FontDirectory", 13 ) == 0 )
+             ft_strncmp( (char*)cur, "FontDirectory", 13 ) == 0 )
         {
           FT_Byte*  cur2;
 
@@ -1514,7 +1511,7 @@
 
           /* lookup the `known' keyword */
           while ( cur < limit && *cur != 'k'        &&
-                  strncmp( (char*)cur, "known", 5 ) )
+                  ft_strncmp( (char*)cur, "known", 5 ) )
             cur++;
 
           if ( cur < limit )
@@ -1563,7 +1560,7 @@
                   break;
 
                 if ( cur[0] == name[0]                          &&
-                     len == (FT_Int)strlen( (const char*)name ) )
+                     len == (FT_Int)ft_strlen( (const char*)name ) )
                 {
                   FT_Int  n;
 
@@ -1732,7 +1729,7 @@
           for ( idx = 0; idx < type1->num_glyphs; idx++ )
           {
             glyph_name = (FT_Byte*)type1->glyph_names[idx];
-            if ( strcmp( (const char*)char_name,
+            if ( ft_strcmp( (const char*)char_name,
                          (const char*)glyph_name ) == 0 )
             {
               type1->encoding.char_index[charcode] = (FT_UShort)idx;
@@ -1740,7 +1737,7 @@
 
               /* Change min/max encoded char only if glyph name is */
               /* not /.notdef                                      */
-              if ( strcmp( (const char*)".notdef",
+              if ( ft_strcmp( (const char*)".notdef",
                            (const char*)glyph_name ) != 0 )
               {
                 if (charcode < min_char) min_char = charcode;
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -20,8 +20,6 @@
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
 
-#include <string.h>         /* strcmp() */
-
 #include "t1gload.h"
 #include "t1load.h"
 
@@ -382,8 +380,8 @@
         root->style_flags |= FT_STYLE_FLAG_ITALIC;
       if ( face->type1.font_info.weight )
       {
-        if ( !strcmp( face->type1.font_info.weight, "Bold"  ) ||
-             !strcmp( face->type1.font_info.weight, "Black" ) )
+        if ( !ft_strcmp( face->type1.font_info.weight, "Bold"  ) ||
+             !ft_strcmp( face->type1.font_info.weight, "Black" ) )
           root->style_flags |= FT_STYLE_FLAG_BOLD;
       }
 
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -43,9 +43,7 @@
 
 #include "t1errors.h"
 
-#include <string.h>     /* for strncmp() */
 
-
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
@@ -203,9 +201,9 @@
     /* or `%!FontType'                                       */
     {
       if ( size <= 16                                    ||
-           ( strncmp( (const char*)parser->base_dict,
+           ( ft_strncmp( (const char*)parser->base_dict,
                       "%!PS-AdobeFont-1", 16 )        &&
-             strncmp( (const char*)parser->base_dict,
+             ft_strncmp( (const char*)parser->base_dict,
                       "%!FontType", 10 )              )  )
       {
         FT_TRACE2(( "[not a Type1 font]\n" ));