Commit 04728a8bbeea7b6d73204f6a451b172ba68bbc60

Werner Lemberg 2002-04-02T14:50:31

Fixes from the stable branch: * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_OLD_CALCS): Removed. [FT_CONFIG_OPTION_OLD_CALCS]: Removed. * include/freetype/internal/ftcalc.h, src/base/ftcalc.c [FT_CONFIG_OPTION_OLD_CALCS]: Removed. * src/base/fttrigon.c (FT_Vector_Length): Change algorithm to match output of FreeType 1. * src/pshinter/pshglob.c (psh_globals_scale_widths): Fixed a small bug that created un-even stem widths when hinting Postscript fonts. formatting, updating copyright

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
885
886
887
888
889
890
891
892
893
diff --git a/ChangeLog b/ChangeLog
index 8f7cb69..15a547f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2002-04-02  Werner Lemberg  <wl@gnu.org>
 
+	Fixes from the stable branch:
+
+	* include/freetype/config/ftoption.h (FT_CONFIG_OPTION_OLD_CALCS):
+	Removed.
+	[FT_CONFIG_OPTION_OLD_CALCS]: Removed.
+	* include/freetype/internal/ftcalc.h, src/base/ftcalc.c
+	[FT_CONFIG_OPTION_OLD_CALCS]: Removed.
+
+	* src/base/fttrigon.c (FT_Vector_Length): Change algorithm to match
+	output of FreeType 1.
+
+	* src/pshinter/pshglob.c (psh_globals_scale_widths): Fixed a small
+	bug that created un-even stem widths when hinting Postscript fonts.
+
 	* src/type1/t1driver.c, src/type1/t1parse.c: 16bit fixes.
 
 2002-04-01  Werner Lemberg  <wl@gnu.org>
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 23efd0e..a54c844 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -279,16 +279,6 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
-  /* Computation Algorithms                                                */
-  /*                                                                       */
-  /*   Used for debugging, this configuration macro should disappear       */
-  /*   soon.                                                               */
-  /*                                                                       */
-#undef FT_CONFIG_OPTION_OLD_CALCS
-
-
-  /*************************************************************************/
-  /*                                                                       */
   /* The size in bytes of the render pool used by the scan-line converter  */
   /* to do all of its work.                                                */
   /*                                                                       */
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
index 4cdf40f..af1f640 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (specification).                             */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  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,       */
@@ -27,163 +27,9 @@
 FT_BEGIN_HEADER
 
 
-/* OLD 64-bits internal API */
-
-#ifdef FT_CONFIG_OPTION_OLD_CALCS
-
-#ifdef FT_LONG64
-
-  typedef FT_INT64  FT_Int64;
-
-#define ADD_64( x, y, z )  z = (x) + (y)
-#define MUL_64( x, y, z )  z = (FT_Int64)(x) * (y)
-#define DIV_64( x, y )     ( (x) / (y) )
-
-#define SQRT_64( z )  FT_Sqrt64( z )
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Sqrt64                                                          */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Computes the square root of a 64-bit value.  That sounds stupid,   */
-  /*    but it is needed to obtain maximal accuracy in the TrueType        */
-  /*    bytecode interpreter.                                              */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    l :: A 64-bit integer.                                             */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The 32-bit square-root.                                            */
-  /*                                                                       */
-  FT_EXPORT( FT_Int32 )
-  FT_Sqrt64( FT_Int64  l );
-
-
-#else /* !FT_LONG64 */
-
-
-  typedef struct  FT_Int64_
-  {
-    FT_UInt32  lo;
-    FT_UInt32  hi;
-
-  } FT_Int64;
-
-
-#define ADD_64( x, y, z )  FT_Add64( &x, &y, &z )
-#define MUL_64( x, y, z )  FT_MulTo64( x, y, &z )
-#define DIV_64( x, y )     FT_Div64by32( &x, y )
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Add64                                                           */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Add two Int64 values.                                              */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    x :: A pointer to the first value to be added.                     */
-  /*    y :: A pointer to the second value to be added.                    */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    z :: A pointer to the result of `x + y'.                           */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    Will be wrapped by the ADD_64() macro.                             */
-  /*                                                                       */
-  FT_EXPORT( void )
-  FT_Add64( FT_Int64*  x,
-            FT_Int64*  y,
-            FT_Int64  *z );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_MulTo64                                                         */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Multiplies two Int32 integers.  Returns an Int64 integer.          */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    x :: The first multiplier.                                         */
-  /*    y :: The second multiplier.                                        */
-  /*                                                                       */
-  /* <Output>                                                              */
-  /*    z :: A pointer to the result of `x * y'.                           */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    Will be wrapped by the MUL_64() macro.                             */
-  /*                                                                       */
-  FT_EXPORT( void )
-  FT_MulTo64( FT_Int32   x,
-              FT_Int32   y,
-              FT_Int64  *z );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Div64by32                                                       */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Divides an Int64 value by an Int32 value.  Returns an Int32        */
-  /*    integer.                                                           */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    x :: A pointer to the dividend.                                    */
-  /*    y :: The divisor.                                                  */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The result of `x / y'.                                             */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    Will be wrapped by the DIV_64() macro.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Int32 )
-  FT_Div64by32( FT_Int64*  x,
-                FT_Int32   y );
-
-
-#define SQRT_64( z )  FT_Sqrt64( &z )
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Sqrt64                                                          */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Computes the square root of a 64-bits value.  That sounds stupid,  */
-  /*    but it is needed to obtain maximal accuracy in the TrueType        */
-  /*    bytecode interpreter.                                              */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    z :: A pointer to a 64-bit integer.                                */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    The 32-bit square-root.                                            */
-  /*                                                                       */
-  FT_EXPORT( FT_Int32 )
-  FT_Sqrt64( FT_Int64*  x );
-
-
-#endif /* !FT_LONG64 */
-
-#endif /* FT_CONFIG_OPTION_OLD_CALCS */
-
-
-
   FT_EXPORT( FT_Int32 )  FT_SqrtFixed( FT_Int32  x );
 
 
-#ifndef FT_CONFIG_OPTION_OLD_CALCS
-
 #define SQRT_32( x )  FT_Sqrt32( x )
 
 
@@ -206,9 +52,6 @@ FT_BEGIN_HEADER
   FT_Sqrt32( FT_Int32  x );
 
 
-#endif /* !FT_CONFIG_OPTION_OLD_CALCS */
-
-
   /*************************************************************************/
   /*                                                                       */
   /* FT_MulDiv() and FT_MulFix() are declared in freetype.h.               */
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 7e1282a..6b78bc3 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -39,7 +39,6 @@
 
 
 /* we need to define a 64-bits data type here */
-#ifndef FT_CONFIG_OPTION_OLD_CALCS
 
 #ifdef FT_LONG64
 
@@ -56,8 +55,6 @@
 
 #endif /* FT_LONG64 */
 
-#endif /* !FT_CONFIG_OPTION_OLD_CALCS */
-
 
   /*************************************************************************/
   /*                                                                       */
@@ -70,7 +67,7 @@
 
 
   /* The following three functions are available regardless of whether */
-  /* FT_LONG64 or FT_CONFIG_OPTION_OLD_CALCS is defined.               */
+  /* FT_LONG64 is defined.                                             */
 
   /* documentation is in freetype.h */
 
@@ -102,27 +99,6 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_CALCS
-
-  static const FT_Long  ft_square_roots[63] =
-  {
-       1L,    1L,    2L,     3L,     4L,     5L,     8L,    11L,
-      16L,   22L,   32L,    45L,    64L,    90L,   128L,   181L,
-     256L,  362L,  512L,   724L,  1024L,  1448L,  2048L,  2896L,
-    4096L, 5892L, 8192L, 11585L, 16384L, 23170L, 32768L, 46340L,
-
-      65536L,   92681L,  131072L,   185363L,   262144L,   370727L,
-     524288L,  741455L, 1048576L,  1482910L,  2097152L,  2965820L,
-    4194304L, 5931641L, 8388608L, 11863283L, 16777216L, 23726566L,
-
-      33554432L,   47453132L,   67108864L,   94906265L,
-     134217728L,  189812531L,  268435456L,  379625062L,
-     536870912L,  759250125L, 1073741824L, 1518500250L,
-    2147483647L
-  };
-
-#else
-
   /* documentation is in ftcalc.h */
 
   FT_EXPORT_DEF( FT_Int32 )
@@ -152,11 +128,10 @@
     return root;
   }
 
-#endif /* FT_CONFIG_OPTION_OLD_CALCS */
-
 
 #ifdef FT_LONG64
 
+
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_Long )
@@ -222,51 +197,6 @@
   }
 
 
-#ifdef FT_CONFIG_OPTION_OLD_CALCS
-
-  /* a helper function for FT_Sqrt64() */
-
-  static int
-  ft_order64( FT_Int64  z )
-  {
-    int  j = 0;
-
-
-    while ( z )
-    {
-      z = (unsigned FT_INT64)z >> 1;
-      j++;
-    }
-    return j - 1;
-  }
-
-
-  /* documentation is in ftcalc.h */
-
-  FT_EXPORT_DEF( FT_Int32 )
-  FT_Sqrt64( FT_Int64  l )
-  {
-    FT_Int64  r, s;
-
-
-    if ( l <= 0 ) return 0;
-    if ( l == 1 ) return 1;
-
-    r = ft_square_roots[ft_order64( l )];
-
-    do
-    {
-      s = r;
-      r = ( r + l / r ) >> 1;
-
-    } while ( r > s || r * r > l );
-
-    return (FT_Int32)r;
-  }
-
-#endif /* FT_CONFIG_OPTION_OLD_CALCS */
-
-
 #else /* FT_LONG64 */
 
 
@@ -498,7 +428,9 @@
 
   /* apparently, the second version of this code is not compiled correctly */
   /* on Mac machines with the MPW C compiler..  tsss, tsss, tss...         */
+
 #if 1
+
   FT_EXPORT_DEF( FT_Int32 )
   FT_Div64by32( FT_Int64*  x,
                 FT_Int32   y )
@@ -550,7 +482,9 @@
 
     return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
   }
-#else
+
+#else /* 0 */
+
   FT_EXPORT_DEF( FT_Int32 )
   FT_Div64by32( FT_Int64*  x,
                 FT_Int32   y )
@@ -582,86 +516,8 @@
 
     return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
   }
-#endif
-
-
-#ifdef FT_CONFIG_OPTION_OLD_CALCS
-
-
-  /* two helper functions for FT_Sqrt64() */
-
-  static void
-  FT_Sub64( FT_Int64*  x,
-            FT_Int64*  y,
-            FT_Int64*  z )
-  {
-    register FT_UInt32  lo, hi;
-
-
-    lo = x->lo - y->lo;
-    hi = x->hi - y->hi - ( (FT_Int32)lo < 0 );
-
-    z->lo = lo;
-    z->hi = hi;
-  }
-
-
-  static int
-  ft_order64( FT_Int64*  z )
-  {
-    FT_UInt32  i;
-    int        j;
-
-
-    i = z->lo;
-    j = 0;
-    if ( z->hi )
-    {
-      i = z->hi;
-      j = 32;
-    }
-
-    while ( i > 0 )
-    {
-      i >>= 1;
-      j++;
-    }
-    return j - 1;
-  }
-
-
-  /* documentation is in ftcalc.h */
-
-  FT_EXPORT_DEF( FT_Int32 )
-  FT_Sqrt64( FT_Int64*  l )
-  {
-    FT_Int64  l2;
-    FT_Int32  r, s;
-
-
-    if ( (FT_Int32)l->hi < 0          ||
-         ( l->hi == 0 && l->lo == 0 ) )
-      return 0;
-
-    s = ft_order64( l );
-    if ( s == 0 )
-      return 1;
-
-    r = ft_square_roots[s];
-    do
-    {
-      s = r;
-      r = ( r + FT_Div64by32( l, r ) ) >> 1;
-      FT_MulTo64( r, r,   &l2 );
-      FT_Sub64  ( l, &l2, &l2 );
-
-    } while ( r > s || (FT_Int32)l2.hi < 0 );
-
-    return r;
-  }
-
 
-#endif /* FT_CONFIG_OPTION_OLD_CALCS */
+#endif /* 0 */
 
 
 #endif /* FT_LONG64 */
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index 8a2778b..155fc5f 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -417,7 +417,11 @@
     ft_trig_pseudo_polarize( &v );
 
     v.x = ft_trig_downscale( v.x );
-    return ( shift >= 0 ) ? ( v.x >> shift ) : ( v.x << -shift );
+
+    if ( shift > 0 )
+      return ( v.x + ( 1 << ( shift - 1 ) ) ) >> shift;
+
+    return v.x << -shift;
   }
 
 
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index b724bad..5aabfbc 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -380,10 +380,10 @@
           root->num_glyphs = cff->charstrings_index.count;
 
         /* set global bbox, as well as EM size */
-        root->bbox.xMin =  dict->font_bbox.xMin >> 16;
-        root->bbox.yMin =  dict->font_bbox.yMin >> 16;
-        root->bbox.xMax = (dict->font_bbox.xMax + 0xFFFFU) >> 16;
-        root->bbox.yMax = (dict->font_bbox.yMax + 0xFFFFU) >> 16;
+        root->bbox.xMin =   dict->font_bbox.xMin             >> 16;
+        root->bbox.yMin =   dict->font_bbox.yMin             >> 16;
+        root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
+        root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
 
 
         root->ascender  = (FT_Short)( root->bbox.yMax );
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index afe6b5c..f003a28 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -378,10 +378,10 @@
         root->num_fixed_sizes = 0;
         root->available_sizes = 0;
 
-        root->bbox.xMin =  face->cid.font_bbox.xMin >> 16;
-        root->bbox.yMin =  face->cid.font_bbox.yMin >> 16;
-        root->bbox.xMax = (face->cid.font_bbox.xMax + 0xFFFFU) >> 16;
-        root->bbox.yMax = (face->cid.font_bbox.yMax + 0xFFFFU) >> 16;
+        root->bbox.xMin =   face->cid.font_bbox.xMin             >> 16;
+        root->bbox.yMin =   face->cid.font_bbox.yMin             >> 16;
+        root->bbox.xMax = ( face->cid.font_bbox.xMax + 0xFFFFU ) >> 16;
+        root->bbox.yMax = ( face->cid.font_bbox.yMax + 0xFFFFU ) >> 16;
 
         if ( !root->units_per_EM )
           root->units_per_EM  = 1000;
diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c
index 9b32e9f..45cc067 100644
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -45,13 +45,35 @@
     PSH_Widths     stdw  = &dim->stdw;
     FT_UInt        count = stdw->count;
     PSH_Width      width = stdw->widths;
+    PSH_Width      stand = width;               /* standard width/height */
     FT_Fixed       scale = dim->scale_mult;
 
 
-    for ( ; count > 0; count--, width++ )
+    if ( count > 0 )
     {
       width->cur = FT_MulFix( width->org, scale );
       width->fit = FT_RoundFix( width->cur );
+
+      width++;
+      count--;
+
+      for ( ; count > 0; count--, width++ )
+      {
+        FT_Pos  w, dist;
+
+
+        w    = FT_MulFix( width->org, scale );
+        dist = w - stand->cur;
+
+        if ( dist < 0 )
+          dist = -dist;
+
+        if ( dist < 128 )
+          w = stand->cur;
+
+        width->cur = w;
+        width->fit = FT_RoundFix( w );
+      }
     }
   }
 
diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c
index ac0ba25..0429f80 100644
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -1599,7 +1599,7 @@
   /* in the current face                                                */
   /*                                                                    */
   FT_LOCAL_DEF( FT_Error )
-  TT_Build_CMaps( TT_Face   face )
+  TT_Build_CMaps( TT_Face  face )
   {
     FT_Byte*           table = face->cmap_table;
     FT_Byte*           limit = table + face->cmap_size;
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 36e3fda..b75dace 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -391,8 +391,8 @@
       root->num_fixed_sizes = 0;
       root->available_sizes = 0;
 
-      root->bbox.xMin =   face->type1.font_bbox.xMin >> 16;
-      root->bbox.yMin =   face->type1.font_bbox.yMin >> 16;
+      root->bbox.xMin =   face->type1.font_bbox.xMin             >> 16;
+      root->bbox.yMin =   face->type1.font_bbox.yMin             >> 16;
       root->bbox.xMax = ( face->type1.font_bbox.xMax + 0xFFFFU ) >> 16;
       root->bbox.yMax = ( face->type1.font_bbox.yMax + 0xFFFFU ) >> 16;
 
diff --git a/src/winfonts/descrip.mms b/src/winfonts/descrip.mms
index 773ae59..475cdbb 100644
--- a/src/winfonts/descrip.mms
+++ b/src/winfonts/descrip.mms
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 2001 by
+# Copyright 2001, 2002 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk
index 3574ad8..994eef8 100644
--- a/src/winfonts/rules.mk
+++ b/src/winfonts/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2001 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index eb9dbf3..26d1e0b 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  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,       */
@@ -112,7 +112,7 @@
 
 
   static void
-  fnt_font_done( FNT_Font  font,
+  fnt_font_done( FNT_Font   font,
                  FT_Stream  stream )
   {
     if ( font->fnt_frame )
@@ -124,10 +124,10 @@
 
 
   static FT_Error
-  fnt_font_load( FNT_Font  font,
+  fnt_font_load( FNT_Font   font,
                  FT_Stream  stream )
   {
-    FT_Error        error;
+    FT_Error       error;
     WinFNT_Header  header = &font->header;
 
 
@@ -169,10 +169,10 @@
   static void
   fnt_face_done_fonts( FNT_Face  face )
   {
-    FT_Memory  memory = FT_FACE(face)->memory;
-    FT_Stream  stream = FT_FACE(face)->stream;
-    FNT_Font  cur    = face->fonts;
-    FNT_Font  limit  = cur + face->num_fonts;
+    FT_Memory  memory = FT_FACE( face )->memory;
+    FT_Stream  stream = FT_FACE( face )->stream;
+    FNT_Font   cur    = face->fonts;
+    FNT_Font   limit  = cur + face->num_fonts;
 
 
     for ( ; cur < limit; cur++ )
@@ -186,9 +186,9 @@
   static FT_Error
   fnt_face_get_dll_fonts( FNT_Face  face )
   {
-    FT_Error      error;
-    FT_Stream     stream = FT_FACE(face)->stream;
-    FT_Memory     memory = FT_FACE(face)->memory;
+    FT_Error         error;
+    FT_Stream        stream = FT_FACE( face )->stream;
+    FT_Memory        memory = FT_FACE( face )->memory;
     WinMZ_HeaderRec  mz_header;
 
 
@@ -310,10 +310,10 @@
   }
 
 
-
 #ifdef FT_CONFIG_OPTION_USE_CMAPS
 
-  typedef struct FNT_CMapRec_
+
+  typedef struct  FNT_CMapRec_
   {
     FT_CMapRec  cmap;
     FT_UInt32   first;
@@ -325,11 +325,12 @@
   static FT_Error
   fnt_cmap_init( FNT_CMap  cmap )
   {
-    FNT_Face  face = (FNT_Face) FT_CMAP_FACE(cmap);
+    FNT_Face  face = (FNT_Face)FT_CMAP_FACE( cmap );
     FNT_Font  font = face->fonts;
 
-    cmap->first = (FT_UInt32) font->header.first_char;
-    cmap->count = (FT_UInt32)(font->header.last_char - cmap->first + 1);
+
+    cmap->first = (FT_UInt32)  font->header.first_char;
+    cmap->count = (FT_UInt32)( font->header.last_char - cmap->first + 1 );
 
     return 0;
   }
@@ -341,6 +342,7 @@
   {
     FT_UInt  gindex = 0;
 
+
     char_code -= cmap->first;
     if ( char_code < cmap->count )
       gindex = char_code + 1;
@@ -350,13 +352,14 @@
 
 
   static FT_UInt
-  fnt_cmap_char_next( FNT_CMap   cmap,
-                      FT_UInt32 *pchar_code )
+  fnt_cmap_char_next( FNT_CMap    cmap,
+                      FT_UInt32  *pchar_code )
   {
     FT_UInt    gindex = 0;
     FT_UInt32  result = 0;
     FT_UInt32  char_code = *pchar_code + 1;
 
+
     if ( char_code <= cmap->first )
     {
       result = cmap->first;
@@ -376,19 +379,23 @@
     return gindex;
   }
 
+
   static FT_CMap_ClassRec  fnt_cmap_class_rec =
   {
-    sizeof( FNT_CMapRec ),
-    (FT_CMap_InitFunc)        fnt_cmap_init,
-    (FT_CMap_DoneFunc)        NULL,
-    (FT_CMap_CharIndexFunc)   fnt_cmap_char_index,
-    (FT_CMap_CharNextFunc)    fnt_cmap_char_next
+    sizeof ( FNT_CMapRec ),
+
+    (FT_CMap_InitFunc)     fnt_cmap_init,
+    (FT_CMap_DoneFunc)     NULL,
+    (FT_CMap_CharIndexFunc)fnt_cmap_char_index,
+    (FT_CMap_CharNextFunc) fnt_cmap_char_next
   };
 
-  static FT_CMap_Class   fnt_cmap_class = &fnt_cmap_class_rec;
+  static FT_CMap_Class  fnt_cmap_class = &fnt_cmap_class_rec;
+
 
 #else /* !FT_CONFIG_OPTION_USE_CMAPS */
 
+
   static FT_UInt
   FNT_Get_Char_Index( FT_CharMap  charmap,
                       FT_Long     char_code )
@@ -399,8 +406,8 @@
     if ( charmap )
     {
       FNT_Font  font  = ((FNT_Face)charmap->face)->fonts;
-      FT_Long    first = font->header.first_char;
-      FT_Long    count = font->header.last_char - first + 1;
+      FT_Long   first = font->header.first_char;
+      FT_Long   count = font->header.last_char - first + 1;
 
 
       char_code -= first;
@@ -422,7 +429,7 @@
     if ( charmap )
     {
       FNT_Font  font  = ((FNT_Face)charmap->face)->fonts;
-      FT_Long    first = font->header.first_char;
+      FT_Long   first = font->header.first_char;
 
 
       if ( char_code < first )
@@ -473,6 +480,7 @@
       /* this didn't work, now try to load a single FNT font */
       FNT_Font  font;
 
+
       if ( FT_NEW( face->fonts ) )
         goto Exit;
 
@@ -490,7 +498,7 @@
     /* all right, one or more fonts were loaded; we now need to */
     /* fill the root FT_Face fields with relevant information   */
     {
-      FT_Face    root  = FT_FACE( face );
+      FT_Face   root  = FT_FACE( face );
       FNT_Font  fonts = face->fonts;
       FNT_Font  limit = fonts + face->num_fonts;
       FNT_Font  cur;
@@ -592,7 +600,7 @@
   FNT_Size_Set_Pixels( FNT_Size  size )
   {
     /* look up a font corresponding to the current pixel size */
-    FNT_Face   face  = (FNT_Face)FT_SIZE_FACE( size );
+    FNT_Face  face  = (FNT_Face)FT_SIZE_FACE( size );
     FNT_Font  cur   = face->fonts;
     FNT_Font  limit = cur + face->num_fonts;
 
@@ -624,7 +632,7 @@
                   FT_UInt       glyph_index,
                   FT_Int        load_flags )
   {
-    FNT_Font   font  = size->font;
+    FNT_Font    font  = size->font;
     FT_Error    error = 0;
     FT_Byte*    p;
     FT_Int      len;
@@ -653,12 +661,12 @@
     /* jump to glyph entry */
     p = font->fnt_frame + 118 + len * glyph_index;
 
-    bitmap->width = FT_NEXT_SHORT_LE(p);
+    bitmap->width = FT_NEXT_SHORT_LE( p );
 
     if ( new_format )
-      offset = FT_NEXT_ULONG_LE(p);
+      offset = FT_NEXT_ULONG_LE( p );
     else
-      offset = FT_NEXT_USHORT_LE(p);
+      offset = FT_NEXT_USHORT_LE( p );
 
     /* jump to glyph data */
     p = font->fnt_frame + /* font->header.bits_offset */ + offset;
@@ -730,32 +738,32 @@
     sizeof( FNT_SizeRec ),
     sizeof( FT_GlyphSlotRec ),
 
-    (FT_Face_InitFunc)     FNT_Face_Init,
-    (FT_Face_DoneFunc)     FNT_Face_Done,
-    (FT_Size_InitFunc)     0,
-    (FT_Size_DoneFunc)     0,
-    (FT_Slot_InitFunc)     0,
-    (FT_Slot_DoneFunc)     0,
+    (FT_Face_InitFunc)        FNT_Face_Init,
+    (FT_Face_DoneFunc)        FNT_Face_Done,
+    (FT_Size_InitFunc)        0,
+    (FT_Size_DoneFunc)        0,
+    (FT_Slot_InitFunc)        0,
+    (FT_Slot_DoneFunc)        0,
 
     (FT_Size_ResetPointsFunc) FNT_Size_Set_Pixels,
-    (FT_Size_ResetPixelsFunc)FNT_Size_Set_Pixels,
-    (FT_Slot_LoadFunc)    FNT_Load_Glyph,
+    (FT_Size_ResetPixelsFunc) FNT_Size_Set_Pixels,
+    (FT_Slot_LoadFunc)        FNT_Load_Glyph,
 
 #ifdef FT_CONFIG_OPTION_USE_CMAPS
-    (FT_CharMap_CharIndexFunc) 0,
+    (FT_CharMap_CharIndexFunc)0,
 #else
-    (FT_CharMap_CharIndexFunc) FNT_Get_Char_Index,
+    (FT_CharMap_CharIndexFunc)FNT_Get_Char_Index,
 #endif
     
 
-    (FT_Face_GetKerningFunc)   0,
-    (FT_Face_AttachFunc)   0,
-    (FT_Face_GetAdvancesFunc)  0,
+    (FT_Face_GetKerningFunc)  0,
+    (FT_Face_AttachFunc)      0,
+    (FT_Face_GetAdvancesFunc) 0,
 
 #ifdef FT_CONFIG_OPTION_USE_CMAPS
-    (FT_CharMap_CharNextFunc)  0
+    (FT_CharMap_CharNextFunc) 0
 #else
-    (FT_CharMap_CharNextFunc)  FNT_Get_Next_Char
+    (FT_CharMap_CharNextFunc) FNT_Get_Next_Char
 #endif    
   };
 
diff --git a/src/winfonts/winfnt.h b/src/winfonts/winfnt.h
index 7cf2cb9..4ba85e0 100644
--- a/src/winfonts/winfnt.h
+++ b/src/winfonts/winfnt.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001 by                                                 */
+/*  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,       */