Commit 4bdf4350f258c1de66e4afccdc746c18f896ba16

David Turner 2003-01-30T23:24:18

various improvements for 2.1.4. see ChangeLog, I've got problems with copy & paste on my desktop !!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
diff --git a/ChangeLog b/ChangeLog
index f063225..7aee5ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,28 @@
-2002-11-18  David Turner  <david@freetype.org>
+2002-01-31  David Turner  <david@freetype.org>
 
+    * src/gzip/adler32.c, src/gzip/ftgzip.c, src/gzip/infblock.c,
+    src/gzip/infcodes.c, src/gzip/inflate.c, src/gzip/inftrees.c,
+    src/gzip/infutil.c: removed old-style (K&R)function definitions. This
+    avoids warnings with Visual C++ at its most pedantic mode.
 
-	* Version 2.1.4 is released.
-	============================
+    * src/pfr/pfrsbit.c: removed compiler warnings
+
+    * src/cache/ftccmap.c: changed a FT_ERROR into a FT_TRACE1 since the
+    it caused "ftview" and others to dump too much junk when trying to
+    display a waterfall with a font without a Unicode charmap (e.g.
+    SYMBOL.TTF)
+
+    * src/autohint/ahtypes.h, src/autohint/ahhint.c, src/base/ftobjs.c,
+    src/truetype/ttobjs.c: implemented FT_CONFIG_CHESTER_BLUE_SCALE,
+    corresponding to the last patch from David Chester, but with a
+    much simpler (and saner) implementation.
+
+    * src/pshinter/pshalgo3.c: improved the Postscript hinter. Getting rid
+    of stem snapping seems to work well here (though the stems are still
+    slightly moved to increase contrast).
+
+    THIS IMPROVES ANTI-ALIASED RENDERING, BUT MONOCHROME AND LCD MODES
+    STILL SUCK... I need to work this a bit
 
 2003-01-22  David Chester  <davidchester@qmx.net>
 
diff --git a/Jamfile.in b/Jamfile.in
index 64ead8b..2ba53bd 100644
--- a/Jamfile.in
+++ b/Jamfile.in
@@ -65,7 +65,6 @@ FT2_COMPONENTS ?= gzip       # support for gzip-compressed files.
                   base       # base component (public APIs)
                   bdf        # BDF font driver
                   cache      # cache sub-system
-                  ccg        # Chinese Character Generator font driver
                   cff        # CFF/CEF font driver
                   cid        # Postscript CID-keyed font driver
                   pcf        # PCF font driver
@@ -101,7 +100,10 @@ if $(DEBUG_HINTER)
 # We need "freetype2/include" in the current include path in order to
 # compile any part of FreeType 2.
 #
-SubDirHdr += $(FT2_INCLUDE) ;
+HDRS += $(FT2_INCLUDE) ;
+
+
+#SubDirHdr += $(FT2_INCLUDE) ;
 
 # Uncomment the following line if you want to build individual source files
 # for each FreeType 2 module.
diff --git a/builds/win32/visualc/freetype.dsp b/builds/win32/visualc/freetype.dsp
index ce09c3e..1512059 100644
--- a/builds/win32/visualc/freetype.dsp
+++ b/builds/win32/visualc/freetype.dsp
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype211.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug"
 
@@ -78,7 +78,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype211_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214_D.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug Multithreaded"
 
@@ -103,7 +103,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"lib\freetype200b8_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype211MT_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214MT_D.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Release Multithreaded"
 
@@ -127,7 +127,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"lib\freetype200b8.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype211MT.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214MT.lib"
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Release Singlethreaded"
 
@@ -152,7 +152,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype206.lib"
-# ADD LIB32 /out:"..\..\..\objs\freetype211ST.lib"
+# ADD LIB32 /out:"..\..\..\objs\freetype214ST.lib"
 # SUBTRACT LIB32 /nologo
 
 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug Singlethreaded"
@@ -178,7 +178,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype206_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype211ST_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype214ST_D.lib"
 
 !ENDIF 
 
@@ -231,6 +231,10 @@ SOURCE=..\..\..\src\base\ftglyph.c
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\src\gzip\ftgzip.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\src\base\ftinit.c
 # SUBTRACT CPP /Fr
 # End Source File
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index c497890..4e3457f 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -258,8 +258,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*   Don't define any of these macros to compile in `release' mode!      */
   /*                                                                       */
- #define  FT_DEBUG_LEVEL_ERROR
- #define  FT_DEBUG_LEVEL_TRACE
+/* #define  FT_DEBUG_LEVEL_ERROR */
+/* #define  FT_DEBUG_LEVEL_TRACE */
 
 
   /*************************************************************************/
@@ -469,6 +469,13 @@ FT_BEGIN_HEADER
 
  /* */
 
+/*
+ * the FT_CONFIG_OPTION_CHESTER_XXXX macros are used to toggle some recent
+ * improvements to the auto-hinter contributed by David Chester. They will
+ * most likely disappear completely in the next release. For now, you should
+ * always keep them defined
+ *
+ */
 #define  FT_CONFIG_OPTION_CHESTER_HINTS
 
 #ifdef   FT_CONFIG_OPTION_CHESTER_HINTS
@@ -477,6 +484,7 @@ FT_BEGIN_HEADER
 #  define  FT_CONFIG_CHESTER_ASCENDER
 #  define  FT_CONFIG_CHESTER_SERIF
 #  define  FT_CONFIG_CHESTER_STEM
+#  define  FT_CONFIG_CHESTER_BLUE_SCALE
 
 #endif /* FT_CONFIG_OPTION_CHESTER_HINTS */
 
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index f69a626..59e55d8 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -1310,8 +1310,8 @@
     FT_Face           face     = hinter->face;
     FT_GlyphSlot      slot     = face->glyph;
     FT_Slot_Internal  internal = slot->internal;
-    FT_Fixed          x_scale  = face->size->metrics.x_scale;
-    FT_Fixed          y_scale  = face->size->metrics.y_scale;
+    FT_Fixed          x_scale  = hinter->globals->x_scale;
+    FT_Fixed          y_scale  = hinter->globals->y_scale;
     FT_Error          error;
     AH_Outline        outline  = hinter->glyph;
     AH_Loader         gloader  = hinter->loader;
@@ -1659,6 +1659,36 @@
 
     }
 
+#ifdef FT_CONFIG_CHESTER_BLUE_SCALE
+   /* try to optimize the y_scale so that the top of non-capital letters
+    * is aligned on a pixel boundary whenever possible
+    */
+    {
+      AH_Globals  design = &face_globals->design;
+      FT_Pos      shoot  = design->blue_shoots[ AH_BLUE_SMALL_TOP ];
+
+     /* the value of 'shoot' will be -1000 if the font doesn't have */
+     /* small latin letters; we simply check the sign here...       */
+      if ( shoot > 0 )
+      {
+        FT_Pos  scaled = FT_MulFix( shoot, y_scale );
+        FT_Pos  fitted = ( scaled + 32 ) & -64;
+
+        if ( scaled != fitted )
+        {
+         /* adjust y_scale
+          */
+          y_scale = FT_MulDiv( y_scale, fitted, scaled );
+
+         /* adust x_scale
+          */
+          if ( fitted < scaled )
+            x_scale -= x_scale/50;  /* x_scale*0.98 with integers */
+        }
+      }
+    }
+#endif /* FT_CONFIG_CHESTER_BLUE_SCALE */
+
     /* now, we must check the current character pixel size to see if we */
     /* need to rescale the global metrics                               */
     if ( face_globals->x_scale != x_scale ||
@@ -1668,8 +1698,8 @@
     ah_loader_rewind( hinter->loader );
 
     /* reset hinting flags according to load flags and current render target */
-    hinter->do_horz_hints = !FT_BOOL( load_flags & FT_LOAD_NO_AUTOHINT );
-    hinter->do_vert_hints = !FT_BOOL( load_flags & FT_LOAD_NO_AUTOHINT );
+    hinter->do_horz_hints = FT_BOOL( !(load_flags & FT_LOAD_NO_AUTOHINT) );
+    hinter->do_vert_hints = FT_BOOL( !(load_flags & FT_LOAD_NO_AUTOHINT) );
 
 #ifdef DEBUG_HINTER
     hinter->do_horz_hints = !ah_debug_disable_vert;  /* not a bug, the meaning */
diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h
index 33633b1..fb14586 100644
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -476,12 +476,12 @@ FT_BEGIN_HEADER
   /*                                                                       */
   typedef struct  AH_Face_GlobalsRec_
   {
-    FT_Face     face;
+    FT_Face        face;
     AH_GlobalsRec  design;
     AH_GlobalsRec  scaled;
-    FT_Fixed    x_scale;
-    FT_Fixed    y_scale;
-    FT_Bool     control_overshoot;
+    FT_Fixed       x_scale;
+    FT_Fixed       y_scale;
+    FT_Bool        control_overshoot;
 
   } AH_Face_GlobalsRec, *AH_Face_Globals;
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 130b809..2852d46 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1387,11 +1387,19 @@
       char_height = 1 * 64;
 
     /* Compute pixel sizes in 26.6 units */
+#ifdef FT_CONFIG_CHESTER_BLUE_SCALE
+    dim_x = ( char_width  * horz_resolution ) / 72;
+    dim_y = ( char_height * vert_resolution ) / 72;
+
+    metrics->x_ppem = (FT_UShort)( (dim_x+32) >> 6 );
+    metrics->y_ppem = (FT_UShort)( (dim_y+32) >> 6 );
+#else
     dim_x = ( ( ( char_width  * horz_resolution ) / 72 ) + 32 ) & -64;
     dim_y = ( ( ( char_height * vert_resolution ) / 72 ) + 32 ) & -64;
 
     metrics->x_ppem  = (FT_UShort)( dim_x >> 6 );
     metrics->y_ppem  = (FT_UShort)( dim_y >> 6 );
+#endif
 
     metrics->x_scale = 0x10000L;
     metrics->y_scale = 0x10000L;
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 8c982c3..4f575db 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -131,7 +131,7 @@
   ftc_cmap_node_weight( FTC_CMapNode  cnode )
   {
     FT_UNUSED( cnode );
-    
+
     return sizeof ( *cnode );
   }
 
@@ -227,7 +227,7 @@
     return error;
 
   Bad_Descriptor:
-    FT_ERROR(( "ftp_cmap_family_init: invalid charmap descriptor\n" ));
+    FT_TRACE1(( "ftp_cmap_family_init: invalid charmap descriptor\n" ));
     return FTC_Err_Invalid_Argument;
   }
 
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 708af16..66af469 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1538,10 +1538,10 @@
         {
           if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) )
             goto Exit;
-            
+
           for ( j = 1; j < num_glyphs; j++ )
             charset->sids[j] = FT_GET_USHORT();
-          
+
           FT_FRAME_EXIT();
         }
         break;
@@ -1748,7 +1748,7 @@
       case 0:
         {
           FT_Byte*  p;
-          
+
           /* by convention, GID 0 is always ".notdef" and is never */
           /* coded in the font. Hence, the number of codes found   */
           /* in the table is 'count+1'                             */
@@ -1759,7 +1759,7 @@
             goto Exit;
 
           p = (FT_Byte*)stream->cursor;
-          
+
           for ( j = 1; j <= count; j++ )
           {
             glyph_code = *p++;
@@ -1774,7 +1774,7 @@
               encoding->sids[glyph_code] = charset->sids[j];
             }
           }
-          
+
           FT_FRAME_EXIT();
         }
         break;
@@ -1801,11 +1801,11 @@
 
             /* Increment nleft, so we read `nleft + 1' codes/sids. */
             nleft++;
-            
+
             /* compute max number of character codes */
-            if ( nleft > encoding->count )
+            if ( (FT_UInt)nleft > encoding->count )
               encoding->count = nleft;
-            
+
             /* Fill in the range of codes/sids. */
             for ( k = i; k < nleft + i; k++, glyph_code++ )
             {
@@ -1820,7 +1820,7 @@
               }
             }
           }
-          
+
           /* simple check, one never knows what can be found in a font */
           if ( encoding->count > 256 )
             encoding->count = 256;
@@ -1896,7 +1896,7 @@
       Populate:
         /* Construct code to GID mapping from code to SID mapping */
         /* and charset.                                           */
-        
+
         encoding->count = 0;
 
 
@@ -1921,7 +1921,7 @@
             else
             {
               encoding->codes[j] = (FT_UShort)i;
-              
+
               /* update encoding count */
               if ( encoding->count < j+1 )
                 encoding->count = j+1;
diff --git a/src/gzip/adler32.c b/src/gzip/adler32.c
index 9549d07..706da26 100644
--- a/src/gzip/adler32.c
+++ b/src/gzip/adler32.c
@@ -18,10 +18,10 @@
 #define DO16(buf)   DO8(buf,0); DO8(buf,8);
 
 /* ========================================================================= */
-ZEXPORT(uLong) adler32(adler, buf, len)
-    uLong adler;
-    const Bytef *buf;
-    uInt len;
+ZEXPORT(uLong) adler32( /* adler, buf, len) */
+    uLong adler,
+    const Bytef *buf,
+    uInt len )
 {
     unsigned long s1 = adler & 0xffff;
     unsigned long s2 = (adler >> 16) & 0xffff;
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index a736ea8..768dcdc 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -96,10 +96,10 @@
 #ifndef FT_CONFIG_OPTION_SYSTEM_ZLIB
 
  local voidpf
- zcalloc (opaque, items, size)
-    voidpf opaque;
-    unsigned items;
-    unsigned size;
+ zcalloc ( /* opaque, items, size) */
+    voidpf opaque,
+    unsigned items,
+    unsigned size )
  {
    return ft_gzip_alloc( opaque, items, size );
  }
diff --git a/src/gzip/infblock.c b/src/gzip/infblock.c
index 63db030..8d3e210 100644
--- a/src/gzip/infblock.c
+++ b/src/gzip/infblock.c
@@ -64,10 +64,10 @@ local const uInt border[] = { /* Order of the bit length code lengths */
  */
 
 
-local void inflate_blocks_reset(s, z, c)
-inflate_blocks_statef *s;
-z_streamp z;
-uLongf *c;
+local void inflate_blocks_reset( /* s, z, c) */
+inflate_blocks_statef *s,
+z_streamp z,
+uLongf *c )
 {
   if (c != Z_NULL)
     *c = s->check;
@@ -85,10 +85,10 @@ uLongf *c;
 }
 
 
-local inflate_blocks_statef *inflate_blocks_new(z, c, w)
-z_streamp z;
-check_func c;
-uInt w;
+local inflate_blocks_statef *inflate_blocks_new( /* z, c, w) */
+z_streamp z,
+check_func c,
+uInt w )
 {
   inflate_blocks_statef *s;
 
@@ -116,10 +116,10 @@ uInt w;
 }
 
 
-local int inflate_blocks(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+local int inflate_blocks( /* s, z, r) */
+inflate_blocks_statef *s,
+z_streamp z,
+int r )
 {
   uInt t;               /* temporary storage */
   uLong b;              /* bit buffer */
@@ -371,9 +371,9 @@ int r;
 }
 
 
-local int inflate_blocks_free(s, z)
-inflate_blocks_statef *s;
-z_streamp z;
+local int inflate_blocks_free( /* s, z) */
+inflate_blocks_statef *s,
+z_streamp z )
 {
   inflate_blocks_reset(s, z, Z_NULL);
   ZFREE(z, s->window);
diff --git a/src/gzip/infcodes.c b/src/gzip/infcodes.c
index 0347fc2..f7bfd58 100644
--- a/src/gzip/infcodes.c
+++ b/src/gzip/infcodes.c
@@ -55,11 +55,11 @@ struct inflate_codes_state {
 };
 
 
-local inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-z_streamp z;
+local inflate_codes_statef *inflate_codes_new( /* bl, bd, tl, td, z) */
+uInt bl, uInt bd,
+inflate_huft *tl,
+inflate_huft *td, /* need separate declaration for Borland C++ */
+z_streamp z )
 {
   inflate_codes_statef *c;
 
@@ -77,10 +77,10 @@ z_streamp z;
 }
 
 
-local int inflate_codes(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+local int inflate_codes( /* s, z, r) */
+inflate_blocks_statef *s,
+z_streamp z,
+int r )
 {
   uInt j;               /* temporary storage */
   inflate_huft *t;      /* temporary pointer */
@@ -241,9 +241,9 @@ int r;
 }
 
 
-local void inflate_codes_free(c, z)
-inflate_codes_statef *c;
-z_streamp z;
+local void inflate_codes_free( /* c, z) */
+inflate_codes_statef *c,
+z_streamp z )
 {
   ZFREE(z, c);
   Tracev((stderr, "inflate:       codes free\n"));
diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c
index 2def8e2..8877fa3 100644
--- a/src/gzip/inflate.c
+++ b/src/gzip/inflate.c
@@ -51,8 +51,8 @@ struct internal_state {
 };
 
 
-ZEXPORT(int) inflateReset(z)
-z_streamp z;
+ZEXPORT(int) inflateReset( /* z) */
+z_streamp z )
 {
   if (z == Z_NULL || z->state == Z_NULL)
     return Z_STREAM_ERROR;
@@ -65,8 +65,8 @@ z_streamp z;
 }
 
 
-ZEXPORT(int) inflateEnd(z)
-z_streamp z;
+ZEXPORT(int) inflateEnd( /* z) */
+z_streamp z )
 {
   if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
     return Z_STREAM_ERROR;
@@ -79,11 +79,11 @@ z_streamp z;
 }
 
 
-ZEXPORT(int) inflateInit2_(z, w, version, stream_size)
-z_streamp z;
-int w;
-const char *version;
-int stream_size;
+ZEXPORT(int) inflateInit2_( /* z, w, version, stream_size) */
+z_streamp z,
+int w,
+const char *version,
+int stream_size )
 {
   if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
       stream_size != sizeof(z_stream))
@@ -144,9 +144,9 @@ int stream_size;
 #define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
 
 
-ZEXPORT(int) inflate(z, f)
-z_streamp z;
-int f;
+ZEXPORT(int) inflate( /* z, f) */
+z_streamp z,
+int f )
 {
   int r;
   uInt b;
diff --git a/src/gzip/inftrees.c b/src/gzip/inftrees.c
index 1ec13d9..c3fdc27 100644
--- a/src/gzip/inftrees.c
+++ b/src/gzip/inftrees.c
@@ -92,21 +92,22 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */
 /* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
 #define BMAX 15         /* maximum bit length of any code */
 
-local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
-uIntf *b;               /* code lengths in bits (all assumed <= BMAX) */
-uInt n;                 /* number of codes (assumed <= 288) */
-uInt s;                 /* number of simple-valued codes (0..s-1) */
-const uIntf *d;         /* list of base values for non-simple codes */
-const uIntf *e;         /* list of extra bits for non-simple codes */
-inflate_huft * FAR *t;  /* result: starting table */
-uIntf *m;               /* maximum lookup bits, returns actual */
-inflate_huft *hp;       /* space for trees */
-uInt *hn;               /* hufts used in space */
-uIntf *v;               /* working area: values in order of bit length */
+local int huft_build( /* b, n, s, d, e, t, m, hp, hn, v) */
+uIntf *b,               /* code lengths in bits (all assumed <= BMAX) */
+uInt n,                 /* number of codes (assumed <= 288) */
+uInt s,                 /* number of simple-valued codes (0..s-1) */
+const uIntf *d,         /* list of base values for non-simple codes */
+const uIntf *e,         /* list of extra bits for non-simple codes */
+inflate_huft * FAR *t,  /* result: starting table */
+uIntf *m,               /* maximum lookup bits, returns actual */
+inflate_huft *hp,       /* space for trees */
+uInt *hn,               /* hufts used in space */
+uIntf *v                /* working area: values in order of bit length */
 /* Given a list of code lengths and a maximum table size, make a set of
    tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
    if the given code set is incomplete (the tables are still built in this
    case), or Z_DATA_ERROR if the input is invalid. */
+)
 {
 
   uInt a;                       /* counter for codes of length k */
@@ -292,12 +293,13 @@ uIntf *v;               /* working area: values in order of bit length */
 }
 
 
-local int inflate_trees_bits(c, bb, tb, hp, z)
-uIntf *c;               /* 19 code lengths */
-uIntf *bb;              /* bits tree desired/actual depth */
-inflate_huft * FAR *tb; /* bits tree result */
-inflate_huft *hp;       /* space for trees */
-z_streamp z;            /* for messages */
+local int inflate_trees_bits( /* c, bb, tb, hp, z) */
+uIntf *c,               /* 19 code lengths */
+uIntf *bb,              /* bits tree desired/actual depth */
+inflate_huft * FAR *tb, /* bits tree result */
+inflate_huft *hp,       /* space for trees */
+z_streamp z             /* for messages */
+)
 {
   int r;
   uInt hn = 0;          /* hufts used in space */
@@ -319,16 +321,17 @@ z_streamp z;            /* for messages */
 }
 
 
-local int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
-uInt nl;                /* number of literal/length codes */
-uInt nd;                /* number of distance codes */
-uIntf *c;               /* that many (total) code lengths */
-uIntf *bl;              /* literal desired/actual bit depth */
-uIntf *bd;              /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-inflate_huft *hp;       /* space for trees */
-z_streamp z;            /* for messages */
+local int inflate_trees_dynamic( /* nl, nd, c, bl, bd, tl, td, hp, z) */
+uInt nl,                /* number of literal/length codes */
+uInt nd,                /* number of distance codes */
+uIntf *c,               /* that many (total) code lengths */
+uIntf *bl,              /* literal desired/actual bit depth */
+uIntf *bd,              /* distance desired/actual bit depth */
+inflate_huft * FAR *tl, /* literal/length tree result */
+inflate_huft * FAR *td, /* distance tree result */
+inflate_huft *hp,       /* space for trees */
+z_streamp z             /* for messages */
+)
 {
   int r;
   uInt hn = 0;          /* hufts used in space */
@@ -397,12 +400,13 @@ local inflate_huft *fixed_td;
 #endif
 
 
-local int inflate_trees_fixed(bl, bd, tl, td, z)
-uIntf *bl;               /* literal desired/actual bit depth */
-uIntf *bd;               /* distance desired/actual bit depth */
-inflate_huft * FAR *tl;  /* literal/length tree result */
-inflate_huft * FAR *td;  /* distance tree result */
-z_streamp z;             /* for memory allocation */
+local int inflate_trees_fixed( /* bl, bd, tl, td, z) */
+uIntf *bl,               /* literal desired/actual bit depth */
+uIntf *bd,               /* distance desired/actual bit depth */
+inflate_huft * FAR *tl,  /* literal/length tree result */
+inflate_huft * FAR *td,  /* distance tree result */
+z_streamp z              /* for memory allocation */
+)
 {
 #ifdef BUILDFIXED
   /* build fixed tables if not already */
diff --git a/src/gzip/infutil.c b/src/gzip/infutil.c
index 9a6b92f..87358d7 100644
--- a/src/gzip/infutil.c
+++ b/src/gzip/infutil.c
@@ -19,10 +19,10 @@ local uInt inflate_mask[17] = {
 
 
 /* copy as much as possible from the sliding window to the output area */
-local int inflate_flush(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+local int inflate_flush( /* s, z, r) */
+inflate_blocks_statef *s,
+z_streamp z,
+int r )
 {
   uInt n;
   Bytef *p;
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index b93c207..3a6e235 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -49,7 +49,7 @@
   static void
   pfr_bitwriter_init( PFR_BitWriter  writer,
                       FT_Bitmap*     target,
-                      FT_Bool        decreasing )
+                      FT_UInt        decreasing )
   {
     writer->line   = target->buffer;
     writer->pitch  = target->pitch;
@@ -107,7 +107,7 @@
       }
       else if ( mask == 0 )
       {
-        cur[0] = c;
+        cur[0] = (FT_Byte)c;
         mask   = 0x80;
         c      = 0;
         cur ++;
@@ -115,7 +115,7 @@
     }
 
     if ( mask != 0x80 )
-      cur[0] = c;
+      cur[0] = (FT_Byte) c;
   }
 
 
@@ -185,7 +185,7 @@
       }
       else if ( mask == 0 )
       {
-        cur[0] = c;
+        cur[0] = (FT_Byte) c;
         mask   = 0x80;
         c      = 0;
         cur ++;
@@ -249,7 +249,7 @@
       }
       else if ( mask == 0 )
       {
-        cur[0] = c;
+        cur[0] = (FT_Byte) c;
         c      = 0;
         mask   = 0x80;
         cur ++;
@@ -281,7 +281,7 @@
                           FT_ULong*  found_size )
   {
     FT_UInt   left, right, char_len;
-    FT_Bool   two = flags & 1;
+    FT_Bool   two = FT_BOOL( flags & 1 );
     FT_Byte*  buff;
 
 
@@ -583,7 +583,7 @@
       pfr_lookup_bitmap_data( stream->cursor,
                               stream->limit,
                               strike->num_bitmaps,
-                              strike->flags,
+                              (FT_Byte) strike->flags,
                               character->char_code,
                               &gps_offset,
                               &gps_size );
@@ -624,7 +624,7 @@
       if ( !error )
       {
         glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
-      
+
         /* Set up glyph bitmap and metrics */
         glyph->root.bitmap.width      = (FT_Int)xsize;
         glyph->root.bitmap.rows       = (FT_Int)ysize;
diff --git a/src/pshinter/pshalgo3.c b/src/pshinter/pshalgo3.c
index 39e9ca1..9480841 100644
--- a/src/pshinter/pshalgo3.c
+++ b/src/pshinter/pshalgo3.c
@@ -332,6 +332,7 @@
   /*************************************************************************/
   /*************************************************************************/
 
+#if 0
   static FT_Pos
   psh3_dimension_quantize_len( PSH_Dimension  dim,
                                FT_Pos         len,
@@ -380,6 +381,7 @@
 
     return  len;
   }
+#endif /* 0 */
 
 
 #ifdef DEBUG_HINTER
@@ -518,7 +520,7 @@
           hint->cur_pos = pos;
           hint->cur_len = fit_len;
 
-#if 0          
+#if 0
          /* stem adjustment tries to snap stem widths to standard
           * ones. this is important to prevent unpleasant rounding
           * artefacts...
@@ -535,7 +537,7 @@
 #else
              /* this seems to be a bug !! */
               pos = ( pos + ( (len >> 1) & -64 ) );
-#endif        
+#endif
               len = 64;
             }
             else
@@ -554,7 +556,7 @@
 
       if ( do_snapping )
       {
-        pos = hint->cur_pos;                   
+        pos = hint->cur_pos;
         len = hint->cur_len;
 
         if ( len < 64 )
@@ -620,7 +622,6 @@
       FT_Pos  pos = FT_MulFix( hint->org_pos, scale ) + delta;
       FT_Pos  len = FT_MulFix( hint->org_len, scale );
 
-      FT_Pos  fit_center;
       FT_Pos  fit_len;
 
       PSH_AlignmentRec  align;
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index c61c4eb..1f54488 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -192,7 +192,6 @@
   {
     FT_Size_Metrics*  metrics = &size->root.metrics;
     TT_Face           face    = (TT_Face)size->root.face;
-    FT_Long           dim_x, dim_y;
 
 
     /* This bit flag, when set, indicates that the pixel size must be */
@@ -204,9 +203,12 @@
     /* really don't know whether this is useful, but hey, that's the  */
     /* spec :-)                                                       */
     /*                                                                */
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
     if ( ( face->header.Flags & 8 ) == 0 )
     {
       /* Compute pixel sizes in 26.6 units */
+      FT_Long  dim_x, dim_y;
+
       dim_x = ( char_width  * horz_resolution + 36 ) / 72;
       dim_y = ( char_height * vert_resolution + 36 ) / 72;
 
@@ -216,6 +218,15 @@
       metrics->x_ppem  = (FT_UShort)( dim_x >> 6 );
       metrics->y_ppem  = (FT_UShort)( dim_y >> 6 );
     }
+#else
+	FT_UNUSED( vert_resolution );
+	FT_UNUSED( horz_resolution );
+	FT_UNUSED( char_height );
+	FT_UNUSED( char_width );
+
+	FT_UNUSED( face );
+	FT_UNUSED( metrics );
+#endif
 
     size->ttmetrics.valid = FALSE;
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS