Commit 779afe4b91f579e6db0d59f23076a7c6d8c26a14

Werner Lemberg 2003-06-22T15:33:53

* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in computation of glyph_index. (FNT_Size_Set_Pixels): To find a strike, first check pixel_height only, then try to find a better hit by comparing pixel_width also. Without this fix it isn't possible to access all strikes. Also compute metrics.max_advance to be in sync with other bitmap drivers. * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code. (FT_Set_Pixel_Size): Assign value to `metrics' after validation of arguments. Synchronize computation of height and width for bitmap strikes. The `width' field in the FT_Bitmap_Size structure is now only useful to enumerate different strikes. The `max_advance' field of the FT_Size_Metrics structure should be used to get the (maximum) width of a strike. * src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single argument to function. * src/psnames/psmodule.c (ps_unicode_value): Handle `.' after `uniXXXX' and `uXXXX[X[X]]'. * src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/. * src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c: s/FT_Err_/FTC_Err_/. * src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/. * src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/. * src/psaux/t1cmap.c: Include psauxerr.h. s/FT_Err_/PSaux_Err_/. * src/pshinter/pshnterr.h: New file. * src/pshinter/rules.mk: Updated. * src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h. s/FT_Err_/PSH_Err_/. * src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c: s/FT_Err_/PFR_Err_/. * src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/. * src/truetype/ttgload.c: s/FT_Err_/TT_Err_/. * src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define FT_ERR_PREFIX and FT_ERR_BASE. s/FT_Err_/Gzip_Err_/.

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
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
diff --git a/ChangeLog b/ChangeLog
index d9d72fd..00d71ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,61 @@
+2003-06-21  Werner Lemberg  <wl@gnu.org>
+
+	* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
+	computation of glyph_index.
+	(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
+	only, then try to find a better hit by comparing pixel_width also. 
+	Without this fix it isn't possible to access all strikes.
+	Also compute metrics.max_advance to be in sync with other bitmap
+	drivers.
+
+	* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
+	(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
+	arguments.
+
+2003-06-20  Werner Lemberg  <wl@gnu.org>
+
+	Synchronize computation of height and width for bitmap strikes.  The
+	`width' field in the FT_Bitmap_Size structure is now only useful to
+	enumerate different strikes.  The `max_advance' field of the
+	FT_Size_Metrics structure should be used to get the (maximum) width
+	of a strike.
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
+	computing `available_sizes->width' but make it always equal to
+	`available_sizes->height'.
+
+	* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
+	computing `available_sizes->width' but make it always equal to
+	`available_sizes->height'.
+
+	* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
+	argument to function.
+
+	* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
+	`uniXXXX' and `uXXXX[X[X]]'.
+
+2003-06-19  Werner Lemberg  <wl@gnu.org>
+
+	* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
+	* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
+	s/FT_Err_/FTC_Err_/.
+	* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
+	* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
+	* src/psaux/t1cmap.c: Include psauxerr.h.
+	s/FT_Err_/PSaux_Err_/.
+	* src/pshinter/pshnterr.h: New file.
+	* src/pshinter/rules.mk: Updated.
+	* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
+	s/FT_Err_/PSH_Err_/.
+	* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
+	s/FT_Err_/PFR_Err_/.
+	* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
+	src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
+	* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
+	* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
+	FT_ERR_PREFIX and FT_ERR_BASE.
+	s/FT_Err_/Gzip_Err_/.
+
 2003-06-19  Dirck Blaskey  <listtarget@danbala.com>
 
 	* src/cff/cffload (cff_encoding_load): `nleft' must be FT_UInt,
@@ -376,7 +434,7 @@
 2003-05-30  Werner Lemberg  <wl@gnu.org>
 
 	Avoid overwriting of numeric font dictionary entries for synthetic
-	fonts. Additionally, some entries were handled as `integer' instead
+	fonts.  Additionally, some entries were handled as `integer' instead
 	of `number'.
 
 	* include/freetype/internal/psaux.h (T1_FieldType): Add
@@ -443,7 +501,7 @@
 	s/ps3/ps/.
 
 	* src/pshinter/pshrec.c, src/pshinter/pshinter.c: Updated.
-	* src/pshinter/rules.mk, src/pshinter/Jamfile: Updated
+	* src/pshinter/rules.mk, src/pshinter/Jamfile: Updated.
 
 	* src/pshinter/pshglob.[ch] (psh_dimension_snap_width): Commented
 	out.
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index eb1a713..241298f 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -218,7 +218,12 @@ FT_BEGIN_HEADER
   /* <Fields>                                                              */
   /*    height :: The character height in pixels.                          */
   /*                                                                       */
-  /*    width  :: The character width in pixels.                           */
+  /*    width  :: The character width in pixels.  For drivers which        */
+  /*              contain a single bitmap strike only (BDF, PCF) this      */
+  /*              field is always equal to `height'.  To get the           */
+  /*              (maximum) width of a bitmap strike use                   */
+  /*              `face->size->metrics.max_advance' after a call to        */
+  /*              @FT_Set_Pixel_Sizes.                                     */
   /*                                                                       */
   typedef struct  FT_Bitmap_Size_
   {
@@ -697,8 +702,8 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    num_fixed_sizes     :: The number of fixed sizes available in this */
   /*                           face.  This should be set to 0 for scalable */
-  /*                           fonts, unless its face includes a complete  */
-  /*                           set of glyphs (called a `strike') for the   */
+  /*                           fonts, unless its face includes a set of    */
+  /*                           glyphs (called a `strike') for the          */
   /*                           specified sizes.                            */
   /*                                                                       */
   /*    available_sizes     :: An array of sizes specifying the available  */
@@ -907,7 +912,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    FT_FACE_FLAG_GLYPH_NAMES ::                                        */
   /*      Indicates that the font contains glyph names that can be         */
-  /*      retrieved through @FT_Get_Glyph_Names.  Note that some TrueType  */
+  /*      retrieved through @FT_Get_Glyph_Name.  Note that some TrueType   */
   /*      fonts contain broken glyph name tables.  Use the function        */
   /*      @FT_Has_PS_Glyph_Name when needed.                               */
   /*                                                                       */
@@ -1056,7 +1061,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* @description:                                                         */
   /*    A macro that returns true whenever a face object contains some     */
-  /*    glyph names that can be accessed through @FT_Get_Glyph_Names.      */
+  /*    glyph names that can be accessed through @FT_Get_Glyph_Name.       */
   /*                                                                       */
 #define FT_HAS_GLYPH_NAMES( face ) \
           ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
@@ -1136,10 +1141,12 @@ FT_BEGIN_HEADER
   /*                    units to fractional (26.6) pixel coordinates.      */
   /*                                                                       */
   /*    ascender     :: The ascender, expressed in 26.6 fixed point        */
-  /*                    pixels.  Always positive.                          */
+  /*                    pixels.  Positive for ascenders above the          */
+  /*                    baseline.                                          */
   /*                                                                       */
   /*    descender    :: The descender, expressed in 26.6 fixed point       */
-  /*                    pixels.  Always negative.                          */
+  /*                    pixels.  Negative for descenders below the         */
+  /*                    baseline.                                          */
   /*                                                                       */
   /*    height       :: The text height, expressed in 26.6 fixed point     */
   /*                    pixels.  Always positive.                          */
@@ -1167,7 +1174,7 @@ FT_BEGIN_HEADER
     FT_UShort  y_ppem;      /* vertical pixels per EM                 */
 
     FT_Fixed   x_scale;     /* two scales used to convert font units  */
-    FT_Fixed   y_scale;     /* to 26.6 frac. pixel coordinates..      */
+    FT_Fixed   y_scale;     /* to 26.6 frac. pixel coordinates        */
 
     FT_Pos     ascender;    /* ascender in 26.6 frac. pixels          */
     FT_Pos     descender;   /* descender in 26.6 frac. pixels         */
@@ -1871,7 +1878,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Note>                                                                */
   /*    When dealing with fixed-size faces (i.e., non-scalable formats),   */
-  /*    use the function @FT_Set_Pixel_Sizes.                              */
+  /*    @FT_Set_Pixel_Sizes provides a more convenient interface.          */
   /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Set_Char_Size( FT_Face     face,
@@ -1920,6 +1927,10 @@ FT_BEGIN_HEADER
   /*    guarantee in any way that you will get glyph bitmaps that all fit  */
   /*    within an 8x8 cell (sometimes even far from it).                   */
   /*                                                                       */
+  /*    For bitmap fonts, `pixel_height' usually is a reliable value for   */
+  /*    the height of the bitmap cell.  Drivers for bitmap font formats    */
+  /*    which contain a single bitmap strike only (BDF, PCF) ignore        */
+  /*    `pixel_width'.                                                     */
   FT_EXPORT( FT_Error )
   FT_Set_Pixel_Sizes( FT_Face  face,
                       FT_UInt  pixel_width,
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index feac5ee..59169d4 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1994,6 +1994,7 @@
 
     driver  = face->driver;
     metrics = &face->size->metrics;
+    clazz   = driver->clazz;
 
     if ( !char_width )
       char_width = char_height;
@@ -2007,17 +2008,13 @@
     if ( !vert_resolution )
       vert_resolution = 72;
 
-    driver = face->driver;
-    clazz  = driver->clazz;
-
     /* default processing -- this can be overridden by the driver */
     if ( char_width  < 1 * 64 )
       char_width  = 1 * 64;
     if ( char_height < 1 * 64 )
       char_height = 1 * 64;
 
-    /* Compute pixel sizes in 26.6 units. we use rounding
-     */
+    /* Compute pixel sizes in 26.6 units with rounding */
     dim_x = ( ( char_width  * horz_resolution + (36+32*72) ) / 72 ) & -64;
     dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
 
@@ -2055,14 +2052,15 @@
     FT_Error          error = FT_Err_Ok;
     FT_Driver         driver;
     FT_Driver_Class   clazz;
-    FT_Size_Metrics*  metrics = &face->size->metrics;
+    FT_Size_Metrics*  metrics;
 
 
     if ( !face || !face->size || !face->driver )
       return FT_Err_Invalid_Face_Handle;
 
-    driver = face->driver;
-    clazz  = driver->clazz;
+    driver  = face->driver;
+    metrics = &face->size->metrics;
+    clazz   = driver->clazz;
 
     /* default processing -- this can be overridden by the driver */
     if ( pixel_width == 0 )
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index 3690399..0bd479c 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -65,7 +65,7 @@ THE SOFTWARE.
     cmap->num_encodings = face->bdffont->glyphs_used;
     cmap->encodings     = face->en_table;
 
-    return FT_Err_Ok;
+    return BDF_Err_Ok;
   }
 
 
@@ -305,15 +305,9 @@ THE SOFTWARE.
       if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
         goto Exit;
 
-      prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
-      if ( ( prop != NULL ) && ( prop->value.int32 >= 10 ) )
-        root->available_sizes->width = (short)( prop->value.int32 / 10 );
-
       prop = bdf_get_font_property( font, "PIXEL_SIZE" );
-      if ( prop != NULL ) {
-        root->available_sizes->height =
-        root->available_sizes->width  = (short) prop->value.int32;
-      }
+      if ( prop != NULL )
+        root->available_sizes->height = (short) prop->value.int32;
       else
       {
         prop = bdf_get_font_property( font, "POINT_SIZE" );
@@ -333,19 +327,17 @@ THE SOFTWARE.
         }
       }
 
-      if ( root->available_sizes->width == 0 )
+      if ( root->available_sizes->height == 0 )
       {
-        if ( root->available_sizes->height == 0 )
-        {
-          /* some fonts have broken SIZE declaration (jiskan24.bdf) */
-          FT_ERROR(( "BDF_Face_Init: reading size\n" ));
-          root->available_sizes->width = (FT_Short)font->point_size;
-        }
-        else
-          root->available_sizes->width = root->available_sizes->height;
+        /* some fonts have broken SIZE declaration (jiskan24.bdf) */
+        FT_ERROR(( "BDF_Face_Init: reading size\n" ));
+        root->available_sizes->height = (FT_Short)font->point_size;
       }
-      if ( root->available_sizes->height == 0 )
-          root->available_sizes->height = root->available_sizes->width;
+
+      /* `width' is just an enumeration value for different bitmap strikes */
+      /* in a single font.  Since a BDF font has a single strike only,     */
+      /* make this value the same as the height.                           */
+      root->available_sizes->width = root->available_sizes->height;
 
       /* encoding table */
       {
@@ -682,7 +674,7 @@ THE SOFTWARE.
     }
 
   Fail:
-    return FT_Err_Invalid_Argument;
+    return BDF_Err_Invalid_Argument;
   }
 
 
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index d4d83f4..cc01c39 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -173,7 +173,7 @@
       if ( *pnode == NULL )
       {
         FT_ERROR(( "ftc_node_hash_unlink: unknown node!\n" ));
-        return FT_Err_Ok;
+        return FTC_Err_Ok;
       }
 
       if ( *pnode == node )
@@ -551,7 +551,7 @@
                     FTC_Query   query,
                     FTC_Node   *anode )
   {
-    FT_Error     error = FT_Err_Ok;
+    FT_Error     error = FTC_Err_Ok;
     FTC_Manager  manager;
     FT_LruNode   lru;
     FT_UInt      free_count = 0;
@@ -743,7 +743,7 @@
       }
 
     Fail:
-      if ( error != FT_Err_Out_Of_Memory )
+      if ( error != FTC_Err_Out_Of_Memory )
         goto Exit;
 
      /* There is not enough memory; try to release some unused nodes
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 5e37f2c..7578ef8 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -216,7 +216,7 @@
       /* we mark unloaded glyphs with `sbit.buffer == 0' */
       /* and 'width == 255', 'height == 0'               */
       /*                                                 */
-      if ( error && error != FT_Err_Out_Of_Memory )
+      if ( error && error != FTC_Err_Out_Of_Memory )
       {
         sbit->width = 255;
         error       = 0;
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index 95c1292..b25d741 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -198,7 +198,7 @@
     * This loop will only exit when:
     *
     *   - a new node was successfully created, or an old node flushed
-    *   - an error other than FT_Err_Out_Of_Memory is detected
+    *   - an error other than FTC_Err_Out_Of_Memory is detected
     *   - the list of nodes is empty, and it isn't possible to create
     *     new nodes
     *
@@ -228,7 +228,7 @@
           if ( node == NULL )
           {
             FT_ASSERT( list->num_nodes == 0 );
-            error = FT_Err_Out_Of_Memory;
+            error = FTC_Err_Out_Of_Memory;
             goto Exit;
           }
 
@@ -298,7 +298,7 @@
         goto Exit;
   
       Fail:
-        if ( error != FT_Err_Out_Of_Memory )
+        if ( error != FTC_Err_Out_Of_Memory )
           goto Exit;
         
         drop_last = 1;
diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c
index 34af47e..5ed9d5d 100644
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -189,7 +189,7 @@
       {
         /* there are no unicode characters in here! */
         FT_FREE( cmap->pairs );
-        error = FT_Err_Invalid_Argument;
+        error = CFF_Err_Invalid_Argument;
       }
       else
       {
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index f58bec0..3bcee62 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -275,7 +275,6 @@
   }
 
 
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index ca734f3..0787d80 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -26,6 +26,17 @@
 #include FT_INTERNAL_DEBUG_H
 #include <string.h>
 
+
+#include FT_MODULE_ERRORS_H
+
+#undef __FTERRORS_H__
+
+#define FT_ERR_PREFIX  Gzip_Err_
+#define FT_ERR_BASE    FT_Mod_Err_Gzip
+
+#include FT_ERRORS_H
+
+
 #ifdef FT_CONFIG_OPTION_USE_ZLIB
 
 #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
@@ -181,7 +192,7 @@
          head[2] != Z_DEFLATED        ||
         (head[3] & FT_GZIP_RESERVED)  )
     {
-      error = FT_Err_Invalid_File_Format;
+      error = Gzip_Err_Invalid_File_Format;
       goto Exit;
     }
 
@@ -276,7 +287,7 @@
     if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK ||
          zstream->next_in == NULL                     )
     {
-      error = FT_Err_Invalid_File_Format;
+      error = Gzip_Err_Invalid_File_Format;
       goto Exit;
     }
 
@@ -347,7 +358,7 @@
       size = stream->read( stream, stream->pos, zip->input,
                            FT_GZIP_BUFFER_SIZE );
       if ( size == 0 )
-        return FT_Err_Invalid_Stream_Operation;
+        return Gzip_Err_Invalid_Stream_Operation;
     }
     else
     {
@@ -356,7 +367,7 @@
         size = FT_GZIP_BUFFER_SIZE;
 
       if ( size == 0 )
-        return FT_Err_Invalid_Stream_Operation;
+        return Gzip_Err_Invalid_Stream_Operation;
 
       FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
     }
@@ -398,12 +409,12 @@
       {
         zip->limit = zstream->next_out;
         if ( zip->limit == zip->cursor )
-          error = FT_Err_Invalid_Stream_Operation;
+          error = Gzip_Err_Invalid_Stream_Operation;
         break;
       }
       else if ( err != Z_OK )
       {
-        error = FT_Err_Invalid_Stream_Operation;
+        error = Gzip_Err_Invalid_Stream_Operation;
         break;
       }
     }
@@ -585,7 +596,7 @@
     FT_UNUSED( stream );
     FT_UNUSED( source );
 
-    return FT_Err_Unimplemented_Feature;
+    return Gzip_Err_Unimplemented_Feature;
   }
 
 #endif /* !FT_CONFIG_OPTION_USE_ZLIB */
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index a1dae7d..3681b1c 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -63,7 +63,7 @@ THE SOFTWARE.
     cmap->num_encodings = (FT_UInt)face->nencodings;
     cmap->encodings     = face->encodings;
 
-    return FT_Err_Ok;
+    return PCF_Err_Ok;
   }
 
 
@@ -245,7 +245,7 @@ THE SOFTWARE.
 
       /* this didn't work, try gzip support! */
       error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream );
-      if ( error2 == FT_Err_Unimplemented_Feature )
+      if ( error2 == PCF_Err_Unimplemented_Feature )
         goto Fail;
 
       error = error2;
@@ -454,9 +454,9 @@ THE SOFTWARE.
     slot->bitmap_left = metric->leftSideBearing;
     slot->bitmap_top  = metric->ascent;
 
-    slot->metrics.horiAdvance  = metric->characterWidth << 6 ;
-    slot->metrics.horiBearingX = metric->leftSideBearing << 6 ;
-    slot->metrics.horiBearingY = metric->ascent << 6 ;
+    slot->metrics.horiAdvance  = metric->characterWidth << 6;
+    slot->metrics.horiBearingX = metric->leftSideBearing << 6;
+    slot->metrics.horiBearingY = metric->ascent << 6;
     slot->metrics.width        = ( metric->rightSideBearing -
                                    metric->leftSideBearing ) << 6;
     slot->metrics.height       = bitmap->rows << 6;
@@ -499,7 +499,7 @@ THE SOFTWARE.
       return 0;
     }
 
-    return FT_Err_Invalid_Argument;
+    return PCF_Err_Invalid_Argument;
   }
 
 
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 5a5a165..46002f9 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -919,7 +919,6 @@ THE SOFTWARE.
     {
       FT_Face       root = FT_FACE( face );
       PCF_Property  prop;
-      int           size_set = 0;
 
 
       root->num_faces = 1;
@@ -986,45 +985,32 @@ THE SOFTWARE.
 
       prop = pcf_find_property( face, "PIXEL_SIZE" );
       if ( prop != NULL )
-      {
-        root->available_sizes->height =
-        root->available_sizes->width  = (FT_Short)( prop->value.integer );
-
-        size_set = 1;
-      }
+        root->available_sizes->height = (FT_Short)( prop->value.integer );
       else
       {
         prop = pcf_find_property( face, "POINT_SIZE" );
         if ( prop != NULL )
         {
-          PCF_Property  xres, yres;
+          PCF_Property  yres;
 
 
-          xres = pcf_find_property( face, "RESOLUTION_X" );
           yres = pcf_find_property( face, "RESOLUTION_Y" );
-
-          if ( ( yres != NULL ) && ( xres != NULL ) )
-          {
+          if ( yres != NULL )
             root->available_sizes->height =
               (FT_Short)( prop->value.integer *
                           yres->value.integer / 720 );
-
-              root->available_sizes->width =
-                (FT_Short)( prop->value.integer *
-                            xres->value.integer / 720 );
-
-            size_set = 1;
-          }
         }
       }
 
-      if (size_set == 0 )
-      {
-        root->available_sizes->width  = 12;
+      if ( root->available_sizes->height == 0 )
         root->available_sizes->height = 12;
-      }
 
-      /* set-up charset */
+      /* `width' is just an enumeration value for different bitmap strikes */
+      /* in a single font.  Since a PCF font has a single strike only,     */
+      /* make this value the same as the height.                           */  
+      root->available_sizes->width = root->available_sizes->height;
+                        
+      /* set up charset */
       {
         PCF_Property  charset_registry = 0, charset_encoding = 0;
 
diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c
index 67989c5..3935e2e 100644
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -47,7 +47,7 @@
                                             phys->metrics_resolution );
     }
 
-    return FT_Err_Ok;
+    return PFR_Err_Ok;
   }
 
 
@@ -56,7 +56,7 @@
                    FT_UInt    gindex,
                    FT_Pos    *aadvance )
   {
-    FT_Error  error = FT_Err_Bad_Argument;
+    FT_Error  error = PFR_Err_Bad_Argument;
 
 
     *aadvance = 0;
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 3993eee..402db95 100644
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -296,7 +296,7 @@
 
     if ( load_flags & FT_LOAD_SBITS_ONLY )
     {
-      error = FT_Err_Invalid_Argument;
+      error = PFR_Err_Invalid_Argument;
       goto Exit;
     }
 
@@ -417,7 +417,7 @@
                         FT_UInt     glyph2,
                         FT_Vector*  kerning )
   {
-    FT_Error      error = FT_Err_Ok;
+    FT_Error      error    = PFR_Err_Ok;
     PFR_PhyFont   phy_font = &face->phy_font;
     PFR_KernItem  item     = phy_font->kern_items;
     FT_UInt32     idx      = PFR_KERN_INDEX( glyph1, glyph2 );
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 5dabfe7..84aeb7a 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -508,7 +508,7 @@
 
       default:
         FT_ERROR(( "pfr_read_bitmap_data: invalid image type\n" ));
-        error = FT_Err_Invalid_File_Format;
+        error = PFR_Err_Invalid_File_Format;
       }
     }
 
@@ -560,7 +560,7 @@
       }
 
       /* couldn't find it */
-      return FT_Err_Invalid_Argument;
+      return PFR_Err_Invalid_Argument;
     }
 
   Found_Strike:
@@ -593,7 +593,7 @@
       if ( gps_size == 0 )
       {
         /* Could not find a bitmap program string for this glyph */
-        error = FT_Err_Invalid_Argument;
+        error = PFR_Err_Invalid_Argument;
         goto Exit;
       }
     }
diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c
index 0ddd3f5..3fdf2ee 100644
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -20,6 +20,8 @@
 
 #include FT_INTERNAL_DEBUG_H
 
+#include "psauxerr.h"
+
 
   /*************************************************************************/
   /*************************************************************************/
@@ -320,7 +322,7 @@
       {
         /* there are no unicode characters in here! */
         FT_FREE( cmap->pairs );
-        error = FT_Err_Invalid_Argument;
+        error = PSaux_Err_Invalid_Argument;
       }
       else
       {
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index 21e82c3..3e76529 100644
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -21,6 +21,8 @@
 #include FT_INTERNAL_DEBUG_H
 #include "pshalgo.h"
 
+#include "pshnterr.h"
+
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_pshalgo2
@@ -1900,7 +1902,7 @@
 
     /* something to do? */
     if ( outline->n_points == 0 || outline->n_contours == 0 )
-      return FT_Err_Ok;
+      return PSH_Err_Ok;
 
 #ifdef DEBUG_HINTER
 
diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c
index a4b51fc..dfcfee7 100644
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -23,6 +23,8 @@
 #include "pshrec.h"
 #include "pshalgo.h"
 
+#include "pshnterr.h"
+
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_pshrec
 
@@ -820,7 +822,7 @@
       break;
 
     default:
-      hints->error     = FT_Err_Invalid_Argument;
+      hints->error     = PSH_Err_Invalid_Argument;
       hints->hint_type = hint_type;
 
       FT_ERROR(( "ps_hints_open: invalid charstring type!\n" ));
@@ -934,7 +936,7 @@
       else
       {
         FT_ERROR(( "ps_hints_t1stem3: called with invalid hint type!\n" ));
-        error = FT_Err_Invalid_Argument;
+        error = PSH_Err_Invalid_Argument;
         goto Fail;
       }
     }
@@ -975,7 +977,7 @@
       else
       {
         /* invalid hint type */
-        error = FT_Err_Invalid_Argument;
+        error = PSH_Err_Invalid_Argument;
         goto Fail;
       }
     }
diff --git a/src/pshinter/rules.mk b/src/pshinter/rules.mk
index be3257d..5777339 100644
--- a/src/pshinter/rules.mk
+++ b/src/pshinter/rules.mk
@@ -33,7 +33,8 @@ PSHINTER_DRV_SRC := $(PSHINTER_DIR)/pshrec.c  \
 
 # PSHINTER driver headers
 #
-PSHINTER_DRV_H := $(PSHINTER_DRV_SRC:%c=%h)
+PSHINTER_DRV_H := $(PSHINTER_DRV_SRC:%c=%h) \
+                  $(PSHINTER_DIR)/pshnterr.h
 
 
 # PSHINTER driver object(s)
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index f0be6e7..3b0c434 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -85,7 +85,7 @@
       }
 
       /* there must be exactly four hex digits */
-      if ( *p == '\0' && count == 0 )
+      if ( ( *p == '\0' || *p == '.' ) && count == 0 )
         return value;
     }
 
@@ -120,7 +120,7 @@
         value = ( value << 4 ) + d;
       }
 
-      if ( *p == '\0' && count <= 2 )
+      if ( ( *p == '\0' || *p == '.' ) && count <= 2 )
         return value;
     }
 
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 0e5f7e6..ea504bd 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -149,7 +149,7 @@
       FT_Memory         memory = face->root.memory;
       TT_NameEntryRec*  name   = face->name_table.names + found_win;
       FT_UInt           len    = name->stringLength / 2;
-      FT_Error          error  = FT_Err_Ok;
+      FT_Error          error  = SFNT_Err_Ok;
 
       FT_UNUSED( error );
 
@@ -191,7 +191,7 @@
       FT_Memory         memory = face->root.memory;
       TT_NameEntryRec*  name   = face->name_table.names + found_apple;
       FT_UInt           len    = name->stringLength;
-      FT_Error          error  = FT_Err_Ok;
+      FT_Error          error  = SFNT_Err_Ok;
 
       FT_UNUSED( error );
 
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 4dac94b..86c125f 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -258,7 +258,7 @@
     {
       if ( rec->string == NULL )
       {
-        FT_Error   error = FT_Err_Ok;
+        FT_Error   error  = SFNT_Err_Ok;
         FT_Stream  stream = face->name_table.stream;
 
         FT_UNUSED( error );
diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c
index 6c0e80e..4c9dadf 100644
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -1807,7 +1807,7 @@
 
 
     if ( p + 4 > limit )
-      return FT_Err_Invalid_Table;
+      return SFNT_Err_Invalid_Table;
 
     /* only recognize format 0 */
     if ( TT_NEXT_USHORT( p ) != 0 )
@@ -1815,7 +1815,7 @@
       p -= 2;
       FT_ERROR(( "tt_face_build_cmaps: unsupported `cmap' table format = %d\n",
                  TT_PEEK_USHORT( p ) ));
-      return FT_Err_Invalid_Table;
+      return SFNT_Err_Invalid_Table;
     }
 
     num_cmaps = TT_NEXT_USHORT( p );
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index f056bcc..bea78d4 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -235,7 +235,7 @@
     return  error;
 
   Bad_Format:
-    error = FT_Err_Unknown_File_Format;
+    error = SFNT_Err_Unknown_File_Format;
     goto Exit;
   }
 
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index a269d0e..638e406 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -242,11 +242,6 @@
   /*    A driver method used to reset a size's character sizes (horizontal */
   /*    and vertical) expressed in integer pixels.                         */
   /*                                                                       */
-  /* <Input>                                                               */
-  /*    pixel_width  :: The character width expressed in integer pixels.   */
-  /*                                                                       */
-  /*    pixel_height :: The character height expressed in integer pixels.  */
-  /*                                                                       */
   /* <InOut>                                                               */
   /*    size         :: A handle to the target size object.                */
   /*                                                                       */
@@ -254,13 +249,8 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static FT_Error
-  Set_Pixel_Sizes( TT_Size  size,
-                   FT_UInt  pixel_width,
-                   FT_UInt  pixel_height )
+  Set_Pixel_Sizes( TT_Size  size )
   {
-    FT_UNUSED( pixel_width );
-    FT_UNUSED( pixel_height );
-
     /* many things have been pre-computed by the base layer */
 
     size->metrics         = size->root.metrics;
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index deff1c0..a8b82ee 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1681,7 +1681,7 @@
 
     /* return immediately if we only want the embedded bitmaps */
     if ( load_flags & FT_LOAD_SBITS_ONLY )
-      return FT_Err_Invalid_Argument;
+      return TT_Err_Invalid_Argument;
 
     /* seek to the beginning of the glyph table.  For Type 42 fonts      */
     /* the table might be accessed from a Postscript stream or something */
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 15848b3..44da0e5 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -554,7 +554,7 @@
     T42_Face  t42face = (T42_Face)face;
 
 
-    FT_Activate_Size(size->ttsize);
+    FT_Activate_Size( size->ttsize );
 
     return FT_Set_Char_Size( t42face->ttf_face,
                              char_width,
@@ -573,7 +573,7 @@
     T42_Face  t42face = (T42_Face)face;
 
 
-    FT_Activate_Size(size->ttsize);
+    FT_Activate_Size( size->ttsize );
 
     return FT_Set_Pixel_Sizes( t42face->ttf_face,
                                pixel_width,
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 5b754dd..70d0972 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -402,7 +402,6 @@
   static FT_CMap_Class  fnt_cmap_class = &fnt_cmap_class_rec;
 
 
-
   static void
   FNT_Face_Done( FNT_Face  face )
   {
@@ -495,6 +494,7 @@
       {
         FT_CharMapRec  charmap;
 
+
         charmap.encoding    = FT_ENCODING_UNICODE;
         charmap.platform_id = 3;
         charmap.encoding_id = 1;
@@ -547,25 +547,41 @@
     FNT_Face  face  = (FNT_Face)FT_SIZE_FACE( size );
     FNT_Font  cur   = face->fonts;
     FNT_Font  limit = cur + face->num_fonts;
+    FNT_Font  hit;
 
 
     size->font = 0;
+    hit        = 0;
+
     for ( ; cur < limit; cur++ )
     {
-      /* we only compare the character height, as fonts used some strange */
-      /* values                                                           */
       if ( cur->header.pixel_height == size->root.metrics.y_ppem )
       {
-        size->font = cur;
+        hit = cur;
+        break;
+      }
+    }
 
-        size->root.metrics.ascender  = cur->header.ascent * 64;
-        size->root.metrics.descender = ( cur->header.pixel_height -
-                                           cur->header.ascent ) * 64;
-        size->root.metrics.height    = cur->header.pixel_height * 64;
+    /* try to find a better hit */
+    for ( ; cur < limit; cur++ )
+    {
+      if ( cur->header.pixel_height == size->root.metrics.y_ppem &&
+           cur->header.pixel_width  == size->root.metrics.x_ppem )
+      {
+        hit = cur;
         break;
       }
     }
 
+    if ( hit ) {
+      size->font                     = hit;
+      size->root.metrics.ascender    = hit->header.ascent * 64;
+      size->root.metrics.descender   = ( hit->header.pixel_height -
+                                           hit->header.ascent ) * 64;
+      size->root.metrics.height      = hit->header.pixel_height * 64;
+      size->root.metrics.max_advance = hit->header.max_width * 64;
+    }
+
     return ( size->font ? FNT_Err_Ok : FNT_Err_Invalid_Pixel_Size );
   }
 
@@ -597,7 +613,8 @@
     if ( glyph_index > 0 )
       glyph_index--;
     else
-      glyph_index = font->header.default_char - font->header.first_char;
+      glyph_index = font->header.default_char;
+    glyph_index -= font->header.first_char;
 
     new_format = FT_BOOL( font->header.version == 0x300 );
     len        = new_format ? 6 : 4;