shithub: freetype+ttf2subf

Download patch

ref: 68e9f927105b22ec6952a5bc929cfabfc6b7e810
parent: b0b8df68d60d0e6d7f490d1506e938710656a857
author: Werner Lemberg <[email protected]>
date: Fri Sep 27 07:09:23 EDT 2002

* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.

* src/cff/cffobjs.c (cff_face_init): Ditto.

* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.

* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.

* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.

* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.

* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.

* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.

* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.

* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.

* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.

* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.

* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.

* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.

* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.

* builds/amiga/include/freetype/config/ftmodule.h: Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,106 @@
+2002-09-26  Werner Lemberg  <[email protected]>
+
+	* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
+	tt_face_get_ps_name): Replace switch statement with if clauses to
+	make it more portable.
+
+	* src/cff/cffobjs.c (cff_face_init): Ditto.
+
+	* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
+	`module_size'.
+	* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
+	`glyph_size'.
+
+	* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
+	`FT_Render_Mode'.
+	(FT_Render_Glyph_Internal): Change third parameter to
+	`FT_Render_Mode'.
+	* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
+	to `FT_Render_Mode'.
+
+	* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
+	to `FT_Render_Mode'.
+	* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
+	ft_smooth_render_lcd_v): Ditto.
+	(ft_smooth_render_generic): Change third and fifth parameter to
+	`FT_Render_Mode'.
+	
+	* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
+	include/freetype/ftglyph.h: Updated.
+
+	* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
+	(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
+	src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
+	(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
+	fourth parameter to `FT_Int32'.
+
+	* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
+	and declare them as unused.
+
+	* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
+
+	* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
+	value to FT_UInt32.
+	* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
+	Updated accordingly.
+
+2002-09-26  Wolfgang Domr�se  <[email protected]>
+
+	* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
+	(cff_get_glyph_name): Use cast for result of ft_strlen.
+	* src/cff/cffparse.c (cff_parse_real): User cast for assigning
+	`exp'.
+	* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
+	some local variables.
+	(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
+	switch statements.
+	(cff_font_load): Use cast in call to CFF_Load_FD_Select.
+	* src/cff/cffobjs.c (cff_size_init): Use more casts.
+	(cff_face_init): Use FT_Int32 for `flags'.
+	* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
+	`adx' and `ady'.
+	(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
+	Use more casts.
+	* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
+
+	* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
+	* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
+	`cid_get_offset'.
+
+	* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
+	cast for `num_points'.
+	(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
+
+	* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
+	* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
+	`FT_Int32' for fourth parameter.
+	* src/base/ftobjs.c (open_face): Use cast for calling
+	clazz->init_face.
+
+	* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
+	`1L'.
+	(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
+	* src/raster/ftrend1.c (ft_raster1_render): Ditto.
+
+	* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
+	constant.
+
+2002-09-26  Detlef W�rkner  <[email protected]>
+
+	* builds/amiga/include/freetype/config/ftmodule.h: Updated.
+
 2002-09-25  David Turner  <[email protected]>
 
-        * src/autohint/ahtypes.h: disabling metrics hinting in the auto-hinter.
-        this produces much better anti-aliased text
+	* src/autohint/ahtypes.h: Disabling metrics hinting in the
+	auto-hinter.  this produces much better anti-aliased text.
 
-        * docs/CHANGES: updating the changes documentation
+	* docs/CHANGES: Updating the changes documentation.
 
 2002-09-25  Anthony Fok  <[email protected]>
 
-        * src/sfnt/ttcmap0.c: added support for opens___.ttf (it contains
-        a charmap that uses offset=0xFFFFU instead of 0x0000 to indicate a
-        missing glyph)
+	* src/sfnt/ttcmap0.c: Added support for opens___.ttf (it contains a
+	charmap that uses offset=0xFFFFU instead of 0x0000 to indicate a
+	missing glyph).
 
 2002-09-21  Wolfgang Domr�se  <[email protected]>
 
--- a/builds/amiga/include/freetype/config/ftmodule.h
+++ b/builds/amiga/include/freetype/config/ftmodule.h
@@ -7,7 +7,7 @@
 //#define FT_USE_SMOOTH         // anti-aliasing rasterizer
 //#define FT_USE_TT             // truetype font driver
 //#define FT_USE_T1             // type1 font driver
-//#define FT_USE_T42            // type42 font driver           // yet unstable
+//#define FT_USE_T42            // type42 font driver
 //#define FT_USE_T1CID          // cid-keyed type1 font driver  // no cmap support
 //#define FT_USE_CFF            // opentype font driver
 //#define FT_USE_BDF            // bdf bitmap font driver
@@ -102,6 +102,8 @@
 
 #ifdef FT_USE_SMOOTH
 FT_USE_MODULE(ft_smooth_renderer_class)
+FT_USE_MODULE(ft_smooth_lcd_renderer_class)
+FT_USE_MODULE(ft_smooth_lcdv_renderer_class)
 #endif
 
 #ifdef FT_USE_TT
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2273,8 +2273,8 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_EXPORT( FT_Error )
-  FT_Render_Glyph( FT_GlyphSlot  slot,
-                   FT_UInt       render_mode );
+  FT_Render_Glyph( FT_GlyphSlot    slot,
+                   FT_Render_Mode  render_mode );
 
 
   /*************************************************************************/
--- a/include/freetype/ftglyph.h
+++ b/include/freetype/ftglyph.h
@@ -374,9 +374,9 @@
   /*    the_glyph   :: A pointer to a handle to the target glyph.          */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    render_mode :: A set of bit flags that describe how the data is    */
+  /*    render_mode :: An enumeration that describe how the data is        */
+  /*                   rendered.                                           */
   /*                                                                       */
-  /*                                                                       */
   /*    origin      :: A pointer to a vector used to translate the glyph   */
   /*                   image before rendering.  Can be 0 (if no            */
   /*                   translation).  The origin is expressed in           */
@@ -434,10 +434,10 @@
   /*    scalable.                                                          */
   /*                                                                       */
   FT_EXPORT( FT_Error )
-  FT_Glyph_To_Bitmap( FT_Glyph*   the_glyph,
-                      FT_ULong    render_mode,
-                      FT_Vector*  origin,
-                      FT_Bool     destroy );
+  FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,
+                      FT_Render_Mode  render_mode,
+                      FT_Vector*      origin,
+                      FT_Bool         destroy );
 
 
   /*************************************************************************/
--- a/include/freetype/ftmodule.h
+++ b/include/freetype/ftmodule.h
@@ -111,7 +111,7 @@
   typedef struct  FT_Module_Class_
   {
     FT_ULong               module_flags;
-    FT_Int                 module_size;
+    FT_Long                module_size;
     const FT_String*       module_name;
     FT_Fixed               module_version;
     FT_Fixed               module_requires;
--- a/include/freetype/ftrender.h
+++ b/include/freetype/ftrender.h
@@ -73,7 +73,7 @@
 
   struct  FT_Glyph_Class_
   {
-    FT_UInt                 glyph_size;
+    FT_Long                 glyph_size;
     FT_Glyph_Format         glyph_format;
     FT_Glyph_InitFunc       glyph_init;
     FT_Glyph_DoneFunc       glyph_done;
--- a/include/freetype/internal/ftdriver.h
+++ b/include/freetype/internal/ftdriver.h
@@ -68,7 +68,7 @@
   (*FT_Slot_LoadFunc)( FT_GlyphSlot  slot,
                        FT_Size       size,
                        FT_UInt       glyph_index,
-                       FT_Int        load_flags );
+                       FT_Int32      load_flags );
 
 
   typedef FT_UInt
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -723,9 +723,9 @@
                       FT_ListNode*     node );
 
   FT_BASE( FT_Error )
-  FT_Render_Glyph_Internal( FT_Library    library,
-                            FT_GlyphSlot  slot,
-                            FT_UInt       render_mode );
+  FT_Render_Glyph_Internal( FT_Library      library,
+                            FT_GlyphSlot    slot,
+                            FT_Render_Mode  render_mode );
 
   typedef const char*
   (*FT_Face_GetPostscriptNameFunc)( FT_Face  face );
--- a/include/freetype/internal/psnames.h
+++ b/include/freetype/internal/psnames.h
@@ -52,7 +52,7 @@
   /*    This function will not be compiled if the configuration macro      */
   /*    FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined.                    */
   /*                                                                       */
-  typedef FT_ULong
+  typedef FT_UInt32
   (*PS_Unicode_Value_Func)( const char*  glyph_name );
 
 
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -136,8 +136,8 @@
           
         if ( *p == ':' && p > q )
         {
-          int  n, i, len = p - q;
-          int  level = -1, found = -1;
+          FT_Int  n, i, len = (FT_Int)(p - q);
+          FT_Int  level = -1, found = -1;
 
 
           for ( n = 0; n < trace_count; n++ )
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -566,10 +566,10 @@
   /* documentation is in ftglyph.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FT_Glyph_To_Bitmap( FT_Glyph*   the_glyph,
-                      FT_ULong    render_mode,
-                      FT_Vector*  origin,
-                      FT_Bool     destroy )
+  FT_Glyph_To_Bitmap( FT_Glyph*       the_glyph,
+                      FT_Render_Mode  render_mode,
+                      FT_Vector*      origin,
+                      FT_Bool         destroy )
   {
     FT_GlyphSlotRec  dummy;
     FT_Error         error = FT_Err_Ok;
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -555,6 +555,7 @@
     {
       FT_Render_Mode  mode = FT_LOAD_TARGET_MODE( load_flags );
 
+
       if ( mode == FT_RENDER_MODE_NORMAL      &&
            (load_flags & FT_LOAD_MONOCHROME ) )
         mode = FT_RENDER_MODE_MONO;
@@ -745,7 +746,7 @@
 
     error = clazz->init_face( stream,
                               face,
-                              face_index,
+                              (FT_Int)face_index,
                               num_params,
                               params );
     if ( error )
@@ -1997,9 +1998,9 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Render_Glyph_Internal( FT_Library    library,
-                            FT_GlyphSlot  slot,
-                            FT_UInt       render_mode )
+  FT_Render_Glyph_Internal( FT_Library      library,
+                            FT_GlyphSlot    slot,
+                            FT_Render_Mode  render_mode )
   {
     FT_Error     error = FT_Err_Ok;
     FT_Renderer  renderer;
@@ -2058,8 +2059,8 @@
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FT_Render_Glyph( FT_GlyphSlot  slot,
-                   FT_UInt       render_mode )
+  FT_Render_Glyph( FT_GlyphSlot    slot,
+                   FT_Render_Mode  render_mode )
   {
     FT_Library  library;
 
@@ -2185,7 +2186,7 @@
     }
 
     /* allocate module object */
-    if ( FT_ALLOC( module,clazz->module_size ) )
+    if ( FT_ALLOC( module, clazz->module_size ) )
       goto Exit;
 
     /* base initialization */
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -478,7 +478,7 @@
   BDF_Glyph_Load( FT_GlyphSlot  slot,
                   FT_Size       size,
                   FT_UInt       glyph_index,
-                  FT_Int        load_flags )
+                  FT_Int32      load_flags )
   {
     BDF_Face        face   = (BDF_Face)FT_SIZE_FACE( size );
     FT_Error        error  = BDF_Err_Ok;
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -152,7 +152,7 @@
     cmap->num_pairs = 0;
     cmap->pairs     = NULL;
 
-    count = face->root.num_glyphs;
+    count = (FT_UInt)face->root.num_glyphs;
 
     if ( !FT_NEW_ARRAY( cmap->pairs, count ) )
     {
@@ -166,6 +166,7 @@
       {
         FT_UInt      sid   = charset->sids[n];
         const char*  gname;
+
 
         gname = cff_index_get_sid_string( &cff->string_index, sid, psnames );
          
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -118,7 +118,7 @@
 
       while ( left <= right )
       {
-        FT_Int    middle = left + ( ( right - left ) >> 1 );
+        FT_Long   middle = left + ( ( right - left ) >> 1 );
         FT_ULong  cur_pair;
 
 
@@ -177,7 +177,7 @@
   Load_Glyph( CFF_GlyphSlot  slot,
               CFF_Size       size,
               FT_UShort      glyph_index,
-              FT_UInt        load_flags )
+              FT_Int32       load_flags )
   {
     FT_Error  error;
 
@@ -257,7 +257,7 @@
 
     if ( buffer_max > 0 )
     {
-      FT_UInt  len = ft_strlen( gname );
+      FT_UInt  len = (FT_UInt)ft_strlen( gname );
 
 
       if ( len >= buffer_max )
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -702,8 +702,8 @@
       /* subglyph 1 = accent character */
       subg->index = achar_index;
       subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
-      subg->arg1  = adx;
-      subg->arg2  = ady;
+      subg->arg1  = (FT_Int)adx;
+      subg->arg2  = (FT_Int)ady;
 
       /* set up remaining glyph fields */
       glyph->num_subglyphs = 2;
@@ -796,7 +796,7 @@
   FT_LOCAL_DEF( FT_Error )
   cff_decoder_parse_charstrings( CFF_Decoder*  decoder,
                                  FT_Byte*      charstring_base,
-                                 FT_Int        charstring_len )
+                                 FT_ULong      charstring_len )
   {
     FT_Error           error;
     CFF_Decoder_Zone*  zone;
@@ -913,7 +913,7 @@
       else
       {
         FT_Fixed*  args     = decoder->top;
-        FT_Int     num_args = args - decoder->stack;
+        FT_Int     num_args = (FT_Int)( args - decoder->stack );
         FT_Int     req_args;
 
 
@@ -1676,8 +1676,8 @@
             /* grab up to the last argument */
             for ( count = 5; count > 0; count-- )
             {
-              dx += args[0];
-              dy += args[1];
+              dx += (FT_Int)args[0];
+              dy += (FT_Int)args[1];
               args += 2;
             }
 
@@ -1748,8 +1748,10 @@
           if ( num_args == 4 )
           {
             error = cff_operator_seac( decoder,
-                                       args[0] >> 16, args[1] >> 16,
-                                       args[2] >> 16, args[3] >> 16 );
+                                       args[0] >> 16,
+                                       args[1] >> 16,
+                                       (FT_Int)( args[2] >> 16 ),
+                                       (FT_Int)( args[3] >> 16 ) );
             args += 4;
           }
 
@@ -1886,7 +1888,7 @@
 
         case cff_op_index:
           {
-            FT_Int  idx = args[0] >> 16;
+            FT_Int  idx = (FT_Int)( args[0] >> 16 );
 
 
             FT_TRACE4(( " index" ));
--- a/src/cff/cffgload.h
+++ b/src/cff/cffgload.h
@@ -197,7 +197,7 @@
   FT_LOCAL( FT_Error )
   cff_decoder_parse_charstrings( CFF_Decoder*  decoder,
                                  FT_Byte*      charstring_base,
-                                 FT_Int        charstring_len );
+                                 FT_ULong      charstring_len );
 
   FT_LOCAL( FT_Error )
   cff_slot_load( CFF_GlyphSlot  glyph,
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1179,7 +1179,7 @@
   {
     FT_Error   error  = 0;
     FT_Memory  memory = idx->stream->memory;
-    FT_UInt    n, offset, old_offset;
+    FT_ULong   n, offset, old_offset;
     FT_Byte**  t;
 
 
@@ -1600,7 +1600,7 @@
 
       charset->offset = offset;  /* record charset type */
 
-      switch ( offset )
+      switch ( (FT_UInt)offset )
       {
       case 0:
         if ( num_glyphs != 229 )
@@ -1869,7 +1869,7 @@
 
       encoding->count = 256;
 
-      switch ( offset )
+      switch ( (FT_UInt)offset )
       {
       case 0:
         /* First, copy the code to SID mapping. */
@@ -2145,7 +2145,7 @@
 
       /* now load the FD Select array */
       error = CFF_Load_FD_Select( &font->fd_select,
-                                  dict->cid_count,
+                                  (FT_UInt)dict->cid_count,
                                   stream,
                                   base_offset + dict->cid_fd_select_offset );
 
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -131,8 +131,8 @@
           priv.family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
 
         priv.blue_scale = cpriv->blue_scale;
-        priv.blue_shift = cpriv->blue_shift;
-        priv.blue_fuzz  = cpriv->blue_fuzz;
+        priv.blue_shift = (FT_Int)cpriv->blue_shift;
+        priv.blue_fuzz  = (FT_Int)cpriv->blue_fuzz;
 
         priv.standard_width[0]  = (FT_UShort)cpriv->standard_width;
         priv.standard_height[0] = (FT_UShort)cpriv->standard_height;
@@ -335,7 +335,7 @@
       CFF_Font   cff;
       FT_Memory  memory = face->root.memory;
       FT_Face    root;
-      FT_UInt    flags;
+      FT_Int32   flags;
 
 
       if ( FT_NEW( cff ) )
@@ -499,24 +499,23 @@
           cmaprec.face        = root;
           cmaprec.platform_id = 7;  /* Adobe platform id */
 
-          switch( encoding->offset )
+          if ( encoding->offset == 0 )
           {
-            case 0:
-              cmaprec.encoding_id = 0;
-              cmaprec.encoding    = FT_ENCODING_ADOBE_STANDARD;
-              clazz               = &cff_cmap_encoding_class_rec;
-              break;
-
-            case 1:
-              cmaprec.encoding_id = 1;
-              cmaprec.encoding    = FT_ENCODING_ADOBE_EXPERT;
-              clazz               = &cff_cmap_encoding_class_rec;
-              break;
-
-            default:
-              cmaprec.encoding_id = 3;
-              cmaprec.encoding    = FT_ENCODING_ADOBE_CUSTOM;
-              clazz               = &cff_cmap_encoding_class_rec;
+            cmaprec.encoding_id = 0;
+            cmaprec.encoding    = FT_ENCODING_ADOBE_STANDARD;
+            clazz               = &cff_cmap_encoding_class_rec;
+          }
+          else if ( encoding->offset == 1 )
+          {
+            cmaprec.encoding_id = 1;
+            cmaprec.encoding    = FT_ENCODING_ADOBE_EXPERT;
+            clazz               = &cff_cmap_encoding_class_rec;
+          }
+          else
+          {
+            cmaprec.encoding_id = 3;
+            cmaprec.encoding    = FT_ENCODING_ADOBE_CUSTOM;
+            clazz               = &cff_cmap_encoding_class_rec;
           }
 
           FT_CMap_New( clazz, NULL, &cmaprec, NULL );
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -244,7 +244,7 @@
       if ( exp_sign )
         exp = -exp;
 
-      power_ten += exp;
+      power_ten += (FT_Int)exp;
     }
 
     /* raise to power of ten if needed */
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -107,7 +107,8 @@
       fd_select    = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
       off1         = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
       p           += cid->fd_bytes;
-      glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;
+      glyph_length = (FT_UInt) cid_get_offset(
+                                 &p, (FT_Byte)cid->gd_bytes ) - off1;
       FT_FRAME_EXIT();
 
       if ( glyph_length == 0 )
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -448,7 +448,7 @@
       /* set up pointers */
       for ( count = 1; count <= num_subrs; count++ )
       {
-        FT_UInt  len;
+        FT_ULong  len;
 
 
         len               = offsets[count] - offsets[count - 1];
@@ -460,7 +460,7 @@
       {
         for ( count = 0; count < num_subrs; count++ )
         {
-          FT_UInt  len;
+          FT_ULong  len;
 
 
           len = offsets[count + 1] - offsets[count];
--- a/src/cid/cidparse.h
+++ b/src/cid/cidparse.h
@@ -61,7 +61,7 @@
     FT_Stream     stream;
 
     FT_Byte*      postscript;
-    FT_Int        postscript_len;
+    FT_Long       postscript_len;
 
     FT_ULong      data_offset;
 
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -319,7 +319,7 @@
   PCF_Glyph_Load( FT_GlyphSlot  slot,
                   FT_Size       size,
                   FT_UInt       glyph_index,
-                  FT_Int        load_flags )
+                  FT_Int32      load_flags )
   {
     PCF_Face    face   = (PCF_Face)FT_SIZE_FACE( size );
     FT_Stream   stream = face->root.stream;
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -48,13 +48,18 @@
 
 
   FT_LOCAL_DEF( FT_Error )
-  pfr_face_init( FT_Stream  stream,
-                 PFR_Face   face,
-                 FT_Int     face_index )
+  pfr_face_init( FT_Stream      stream,
+                 PFR_Face       face,
+                 FT_Int         face_index,
+                 FT_Int         num_params,
+                 FT_Parameter*  params )
   {
     FT_Error  error;
 
+    FT_UNUSED( num_params );
+    FT_UNUSED( params );
 
+
     /* load the header and check it */
     error = pfr_header_load( &face->header, stream );
     if ( error )
@@ -223,7 +228,7 @@
   pfr_slot_load( PFR_Slot  slot,
                  PFR_Size  size,
                  FT_UInt   gindex,
-                 FT_Int    load_flags )
+                 FT_Int32  load_flags )
   {
     FT_Error     error;
     PFR_Face     face    = (PFR_Face)slot->root.face;
--- a/src/pfr/pfrobjs.h
+++ b/src/pfr/pfrobjs.h
@@ -57,9 +57,11 @@
 
 
   FT_LOCAL( FT_Error )
-  pfr_face_init( FT_Stream  stream,
-                 PFR_Face   face,
-                 FT_Int     face_index );
+  pfr_face_init( FT_Stream      stream,
+                 PFR_Face       face,
+                 FT_Int         face_index,
+                 FT_Int         num_params,
+                 FT_Parameter*  params );
 
   FT_LOCAL( void )
   pfr_face_done( PFR_Face  face );
@@ -83,7 +85,7 @@
   pfr_slot_load( PFR_Slot  slot,
                  PFR_Size  size,
                  FT_UInt   gindex,
-                 FT_Int    load_flags );
+                 FT_Int32  load_flags );
 
 
 FT_END_HEADER
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -675,7 +675,7 @@
               goto Syntax_Error;
             }
 
-            num_points = top[1] - 13 + ( top[1] == 18 );
+            num_points = (FT_UInt)top[1] - 13 + ( top[1] == 18 );
             if ( top[0] != (FT_Int)( num_points * blend->num_designs ) )
             {
               FT_ERROR(( "t1_decoder_parse_charstrings: " ));
@@ -1146,7 +1146,7 @@
 
     t1_builder_init( &decoder->builder, face, size, slot, hinting );
 
-    decoder->num_glyphs     = face->num_glyphs;
+    decoder->num_glyphs     = (FT_UInt)face->num_glyphs;
     decoder->glyph_names    = glyph_names;
     decoder->hint_flags     = face->internal->hint_flags;
     decoder->hint_mode      = hint_mode;
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -36,7 +36,7 @@
   /* we do deal with glyph variants by detecting a non-initial dot in    */
   /* the name, as in `A.swash' or `e.final', etc.                        */
   /*                                                                     */
-  static FT_ULong
+  static FT_UInt32
   ps_unicode_value( const char*  glyph_name )
   {
     FT_Int  n;
@@ -156,7 +156,7 @@
       FT_UInt     n;
       FT_UInt     count;
       PS_UniMap*  map;
-      FT_ULong    uni_char;
+      FT_UInt32   uni_char;
 
 
       map = table->maps;
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -539,7 +539,7 @@
 
     FT_TRACE6(( "Set_High_Precision(%s)\n", High ? "true" : "false" ));
 
-    ras.precision       = 1L << ras.precision_bits;
+    ras.precision       = 1 << ras.precision_bits;
     ras.precision_half  = ras.precision / 2;
     ras.precision_shift = ras.precision_bits - Pixel_Bits;
     ras.precision_mask  = -ras.precision;
@@ -702,7 +702,7 @@
     if ( n >= 0 && y > y_turns[n] )
       while ( n >= 0 )
       {
-        y2 = y_turns[n];
+        y2 = (Int)y_turns[n];
         y_turns[n] = y;
         y = y2;
         n--;
@@ -758,8 +758,8 @@
         switch ( p->flow )
         {
         case Flow_Down:
-          bottom     = p->start - p->height+1;
-          top        = p->start;
+          bottom     = (Int)( p->start - p->height + 1 );
+          top        = (Int)p->start;
           p->start   = bottom;
           p->offset += p->height - 1;
           break;
@@ -766,8 +766,8 @@
 
         case Flow_Up:
         default:
-          bottom = p->start;
-          top    = p->start + p->height - 1;
+          bottom = (Int)p->start;
+          top    = (Int)( p->start + p->height - 1 );
         }
 
         if ( Insert_Y_Turn( RAS_VARS bottom )   ||
@@ -922,20 +922,20 @@
     }
     else
     {
-      e1 = TRUNC( y1 );
-      f1 = FRAC( y1 );
+      e1 = (Int)TRUNC( y1 );
+      f1 = (Int)FRAC( y1 );
     }
 
     if ( y2 > maxy )
     {
       /* x2 += FMulDiv( Dx, maxy - y2, Dy );  UNNECESSARY */
-      e2  = TRUNC( maxy );
+      e2  = (Int)TRUNC( maxy );
       f2  = 0;
     }
     else
     {
-      e2 = TRUNC( y2 );
-      f2 = FRAC( y2 );
+      e2 = (Int)TRUNC( y2 );
+      f2 = (Int)FRAC( y2 );
     }
 
     if ( f1 > 0 )
@@ -3116,7 +3116,7 @@
           ( ( c << 2 ) & 0x0030 ) |
                    (c  & 0x0003 );
 
-      raster->count_table[n] = c;
+      raster->count_table[n] = (UInt)c;
     }
 
 #ifdef FT_RASTER_OPTION_ANTI_ALIASING
--- a/src/raster/ftrend1.c
+++ b/src/raster/ftrend1.c
@@ -95,10 +95,10 @@
 
   /* convert a slot's glyph image into a bitmap */
   static FT_Error
-  ft_raster1_render( FT_Renderer   render,
-                     FT_GlyphSlot  slot,
-                     FT_UInt       mode,
-                     FT_Vector*    origin )
+  ft_raster1_render( FT_Renderer     render,
+                     FT_GlyphSlot    slot,
+                     FT_Render_Mode  mode,
+                     FT_Vector*      origin )
   {
     FT_Error     error;
     FT_Outline*  outline;
@@ -145,8 +145,8 @@
     cbox.xMax  = ( cbox.xMax + 63 ) & -64;
     cbox.yMax  = ( cbox.yMax + 63 ) & -64;
 
-    width  = ( cbox.xMax - cbox.xMin ) >> 6;
-    height = ( cbox.yMax - cbox.yMin ) >> 6;
+    width  = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
+    height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
     bitmap = &slot->bitmap;
     memory = render->root.memory;
 
@@ -200,8 +200,8 @@
       goto Exit;
 
     slot->format      = FT_GLYPH_FORMAT_BITMAP;
-    slot->bitmap_left = cbox.xMin >> 6;
-    slot->bitmap_top  = cbox.yMax >> 6;
+    slot->bitmap_left = (FT_UInt)( cbox.xMin >> 6 );
+    slot->bitmap_top  = (FT_UInt)( cbox.yMax >> 6 );
 
   Exit:
     return error;
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -216,7 +216,7 @@
         if ( table.Length != 0x36                ||
              FT_STREAM_SEEK( table.Offset + 12 ) ||
              FT_READ_ULONG( magic )              ||
-             magic != 0x5F0F3CF5U                )
+             magic != 0x5F0F3CF5UL               )
           goto Bad_Format;
 
         if ( FT_STREAM_SEEK( offset + 28 + 16*nn ) )
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -356,19 +356,12 @@
       goto Exit;
 
     /* now read postscript table */
-    switch ( format )
-    {
-    case 0x00020000L:
+    if ( format == 0x00020000L )
       error = load_format_20( face, stream );
-      break;
-
-    case 0x00028000L:
+    else if ( format == 0x00028000L )
       error = load_format_25( face, stream );
-      break;
-
-    default:
+    else
       error = SFNT_Err_Invalid_File_Format;
-    }
 
     face->postscript_names.loaded = 1;
 
@@ -382,38 +375,35 @@
   {
     FT_Memory      memory = face->root.memory;
     TT_Post_Names  names  = &face->postscript_names;
+    FT_Fixed       format;
 
 
     if ( names->loaded )
     {
-      switch ( face->postscript.FormatType )
+      format = face->postscript.FormatType;
+
+      if ( format == 0x00020000L )
       {
-      case 0x00020000L:
-        {
-          TT_Post_20  table = &names->names.format_20;
-          FT_UShort   n;
+        TT_Post_20  table = &names->names.format_20;
+        FT_UShort   n;
 
 
-          FT_FREE( table->glyph_indices );
-          table->num_glyphs = 0;
+        FT_FREE( table->glyph_indices );
+        table->num_glyphs = 0;
 
-          for ( n = 0; n < table->num_names; n++ )
-            FT_FREE( table->glyph_names[n] );
+        for ( n = 0; n < table->num_names; n++ )
+          FT_FREE( table->glyph_names[n] );
 
-          FT_FREE( table->glyph_names );
-          table->num_names = 0;
-        }
-        break;
+        FT_FREE( table->glyph_names );
+        table->num_names = 0;
+      }
+      else if ( format == 0x00028000L )
+      {
+        TT_Post_25  table = &names->names.format_25;
 
-      case 0x00028000L:
-        {
-          TT_Post_25  table = &names->names.format_25;
 
-
-          FT_FREE( table->offsets );
-          table->num_glyphs = 0;
-        }
-        break;
+        FT_FREE( table->offsets );
+        table->num_glyphs = 0;
       }
     }
     names->loaded = 0;
@@ -448,6 +438,7 @@
   {
     FT_Error         error;
     TT_Post_Names    names;
+    FT_Fixed         format;
 
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
     PSNames_Service  psnames;
@@ -471,62 +462,58 @@
     /* `.notdef' by default */
     *PSname = MAC_NAME( 0 );
 
-    switch ( face->postscript.FormatType )
+    format = face->postscript.FormatType;
+
+    if ( format == 0x00010000L )
     {
-    case 0x00010000L:
       if ( idx < 258 )                    /* paranoid checking */
         *PSname = MAC_NAME( idx );
-      break;
+    }
+    else if ( format == 0x00020000L )
+    {
+      TT_Post_20  table = &names->names.format_20;
 
-    case 0x00020000L:
+
+      if ( !names->loaded )
       {
-        TT_Post_20  table = &names->names.format_20;
+        error = load_post_names( face );
+        if ( error )
+          goto End;
+      }
 
+      if ( idx < (FT_UInt)table->num_glyphs )
+      {
+        FT_UShort  name_index = table->glyph_indices[idx];
 
-        if ( !names->loaded )
-        {
-          error = load_post_names( face );
-          if ( error )
-            break;
-        }
 
-        if ( idx < (FT_UInt)table->num_glyphs )
-        {
-          FT_UShort  name_index = table->glyph_indices[idx];
+        if ( name_index < 258 )
+          *PSname = MAC_NAME( name_index );
+        else
+          *PSname = (FT_String*)table->glyph_names[name_index - 258];
+      }
+    }
+    else if ( format == 0x00028000L )
+    {
+      TT_Post_25  table = &names->names.format_25;
 
 
-          if ( name_index < 258 )
-            *PSname = MAC_NAME( name_index );
-          else
-            *PSname = (FT_String*)table->glyph_names[name_index - 258];
-        }
+      if ( !names->loaded )
+      {
+        error = load_post_names( face );
+        if ( error )
+          goto End;
       }
-      break;
 
-    case 0x00028000L:
+      if ( idx < (FT_UInt)table->num_glyphs )    /* paranoid checking */
       {
-        TT_Post_25  table = &names->names.format_25;
-
-
-        if ( !names->loaded )
-        {
-          error = load_post_names( face );
-          if ( error )
-            break;
-        }
-
-        if ( idx < (FT_UInt)table->num_glyphs )    /* paranoid checking */
-        {
-          idx    += table->offsets[idx];
-          *PSname = MAC_NAME( idx );
-        }
+        idx    += table->offsets[idx];
+        *PSname = MAC_NAME( idx );
       }
-      break;
-
-    case 0x00030000L:
-      break;                                /* nothing to do */
     }
+    
+    /* nothing to do for format == 0x00030000L */
 
+  End:
     return SFNT_Err_Ok;
   }
 
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -94,13 +94,13 @@
 
   /* convert a slot's glyph image into a bitmap */
   static FT_Error
-  ft_smooth_render_generic( FT_Renderer   render,
-                            FT_GlyphSlot  slot,
-                            FT_UInt       mode,
-                            FT_Vector*    origin,
-                            FT_UInt       required_mode,
-                            FT_Int        hmul,
-                            FT_Int        vmul )
+  ft_smooth_render_generic( FT_Renderer     render,
+                            FT_GlyphSlot    slot,
+                            FT_Render_Mode  mode,
+                            FT_Vector*      origin,
+                            FT_Render_Mode  required_mode,
+                            FT_Int          hmul,
+                            FT_Int          vmul )
   {
     FT_Error     error;
     FT_Outline*  outline = NULL;
@@ -231,10 +231,10 @@
 
   /* convert a slot's glyph image into a bitmap */
   static FT_Error
-  ft_smooth_render( FT_Renderer   render,
-                    FT_GlyphSlot  slot,
-                    FT_UInt       mode,
-                    FT_Vector*    origin )
+  ft_smooth_render( FT_Renderer     render,
+                    FT_GlyphSlot    slot,
+                    FT_Render_Mode  mode,
+                    FT_Vector*      origin )
   {
     return ft_smooth_render_generic( render, slot, mode, origin,
                                      FT_RENDER_MODE_NORMAL,
@@ -244,10 +244,10 @@
 
   /* convert a slot's glyph image into a horizontal LCD bitmap */
   static FT_Error
-  ft_smooth_render_lcd( FT_Renderer   render,
-                        FT_GlyphSlot  slot,
-                        FT_UInt       mode,
-                        FT_Vector*    origin )
+  ft_smooth_render_lcd( FT_Renderer     render,
+                        FT_GlyphSlot    slot,
+                        FT_Render_Mode  mode,
+                        FT_Vector*      origin )
   {
     FT_Error  error;
 
@@ -263,10 +263,10 @@
 
   /* convert a slot's glyph image into a vertical LCD bitmap */
   static FT_Error
-  ft_smooth_render_lcd_v( FT_Renderer   render,
-                          FT_GlyphSlot  slot,
-                          FT_UInt       mode,
-                          FT_Vector*    origin )
+  ft_smooth_render_lcd_v( FT_Renderer     render,
+                          FT_GlyphSlot    slot,
+                          FT_Render_Mode  mode,
+                          FT_Vector*      origin )
   {
     FT_Error  error;
 
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -147,7 +147,7 @@
                  T42_Face       face,
                  FT_Int         face_index,
                  FT_Int         num_params,
-                 FT_Parameter*  params)
+                 FT_Parameter*  params )
   {
     FT_Error          error;
     PSNames_Service   psnames;
@@ -595,7 +595,7 @@
   T42_GlyphSlot_Load( FT_GlyphSlot  glyph,
                       FT_Size       size,
                       FT_Int        glyph_index,
-                      FT_Int        load_flags )
+                      FT_Int32      load_flags )
   {
     FT_Error         error;
     T42_GlyphSlot    t42slot = (T42_GlyphSlot)glyph;
--- a/src/type42/t42objs.h
+++ b/src/type42/t42objs.h
@@ -103,7 +103,7 @@
   T42_GlyphSlot_Load( FT_GlyphSlot  glyph,
                       FT_Size       size,
                       FT_Int        glyph_index,
-                      FT_Int        load_flags );
+                      FT_Int32      load_flags );
 
   FT_LOCAL( void )
   T42_GlyphSlot_Done( T42_GlyphSlot slot );
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -563,7 +563,7 @@
   FNT_Load_Glyph( FT_GlyphSlot  slot,
                   FNT_Size      size,
                   FT_UInt       glyph_index,
-                  FT_Int        load_flags )
+                  FT_Int32      load_flags )
   {
     FNT_Font    font  = size->font;
     FT_Error    error = 0;