Commit baa662bbea83ce15b068d031cfc70b07a66fb613

Werner Lemberg 2005-03-03T23:05:29

* src/base/ftutil.c: Include FT_INTERNAL_OBJECTS_H.

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
diff --git a/ChangeLog b/ChangeLog
index b2fb719..5102593 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,6 @@
-2005-03-04  David Turner  <david@freetype.org>
+2005-03-04  Werner Lemberg  <wl@gnu.org>
 
-	* include/freetype/internal/{ftmemory.h,ftserv.h}: removing
-	compiler warnings with GCC 3.3 and above...
-
-	* include/freetype/internal/ftobjs.h, src/base/ftutil.c (ft_highpow2),
-	src/pfr/pfrload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h: implement
-	FT_OPTIMIZE_MEMORY, the kerning table is not loaded into the heap
-	anymore.
-
-	* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Introduce
-	temporary variable to avoid gcc warning.
-	(tt_face_load_sbit_image): Mark unused variables with FT_UNUSED.
-
-	* include/freetype/config/ftmodule.h: moving the order of drivers to
-	speed up font loading. the pcf and bdf loaders are still slow and
-	eat memory like crazy.
+	* src/base/ftutil.c: Include FT_INTERNAL_OBJECTS_H.
 
 2005-03-03  Werner Lemberg  <wl@gnu.org>
 
@@ -48,9 +34,49 @@
 
 	* src/truetype/ttgload.c: Include `ttpload.h'.
 
+2005-03-03  David Turner  <david@freetype.org>
+
+	* include/freetype/internal/ftmemory.h (FT_ALLOC, FT_REALLOC,
+	FT_QALLOC, FT_QREALLOC) [gcc >= 3.3]: Provide macro versions which
+	avoid compiler warnings.
+	(FT_NEW, FT_NEW_ARRAY, FT_RENEW_ARRAY, FT_QNEW, FT_QNEW_ARRAY,
+	FT_QRENEW_ARRAY, FT_ALLOC_ARRAY, FT_REALLOC_ARRAY): Updated.
+
+	* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE,
+	FT_FACE_FIND_GLOBAL_SERVICE, FT_FACE_LOOKUP_SERVICE) [__cpluscplus]:
+	Provide macro versions which avoid compiler warnings.
+
+	* src/base/ftutil.c (ft_highpow2): New utility function.
+
+	* include/freetype/internal/ftobjs.h: Updated.
+
+	* src/pfr/pfrload.c (pfr_get_gindex, pfr_compare_kern_pairs,
+	pfr_sort_kerning_pairs): Don't define if FT_OPTIMIZE_MEMORY is set.
+	(pfr_phy_font_done): Don't handle `kern_pairs' if FT_OPTIMIZE_MEMORY
+	is set.
+	(pfr_phy_font_load): Don't call `pfr_sort_kerning_pairs' if
+	FT_OPTIMIZE_MEMORY is set.
+
+	* src/pfr/pfrobjs.c (pfr_slot_load): Comment out some code which
+	doesn't work with broken fonts.
+	(pfr_face_get_kerning) [FT_OPTIMIZE_MEMORY]: Implement.
+
+	* src/pfr/pfrtypes.h (PFR_KernItemRec): Optimize member types.
+	(PFR_NEXT_KPAIR): New macro.
+	(PFR_PhyFontRec): Don't define `kern_pairs' if FT_OPTIMIZE_MEMORY is
+	set.
+
+	* src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Introduce
+	temporary variable to avoid gcc warning.
+	(tt_face_load_sbit_image): Mark unused variables with FT_UNUSED.
+
 	* src/truetype/ttpload.c (tt_face_load_loca) [FT_OPTIMIZE_MEMORY]:
 	Remove redundant variable.
 
+	* include/freetype/config/ftmodule.h: Moving the order of drivers to
+	speed up font loading.  The PCF and BDF loaders are still slow and
+	consume far too much memory.
+
 2005-03-03  Werner Lemberg  <wl@gnu.org>
 
 	* devel/ftoption.h: Updated to recent changes.
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index 0715b57..f0df054 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -369,46 +369,58 @@ FT_BEGIN_HEADER
   /*                                                                       */
 
 
-/* GCC 3.3 and beyond will generate tons of _stupid_ warnings if we
- * don't take special measures.
- */
-#if defined(__GNUC__) && ( __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) )
-
-#define FT_ALLOC( _pointer_, _size_ )                 \
-   ({                                                 \
-     void*  _tmp_ = NULL;                             \
-     error     = FT_MEM_ALLOC( _tmp_, _size_ );       \
-     _pointer_ = _tmp_;                               \
-     error != 0;                                      \
-   })
-
-#define FT_REALLOC( _pointer_, _cursize_, _newsize_ )            \
-   ({                                                            \
-     void*  _tmp_ = _pointer_;                                   \
-     error     = FT_MEM_REALLOC( _tmp_, _cursize_, _newsize_ );  \
-     _pointer_ = _tmp_;                                          \
-     error != 0;                                                 \
-   })
-
-#define FT_QALLOC( _pointer_, _size_ )                \
-   ({                                                 \
-     void*  _tmp_;                                    \
-     error     = FT_MEM_QALLOC( _tmp_, _size_ );      \
-     _pointer_ = _tmp_;                               \
-     error != 0;                                      \
-   })
-
-#define FT_QREALLOC( _pointer_, _cursize_, _newsize_ )            \
-   ({                                                             \
-     void*  _tmp_ = _pointer_;                                    \
-     error     = FT_MEM_QREALLOC( _tmp_, _cursize_, _newsize_ );  \
-     _pointer_ = _tmp_;                                           \
-     error != 0;                                                  \
-   })
+  /*
+   *  gcc 3.3 and newer will generate tons of _stupid_ warnings if we
+   *  don't take special measures.
+   */
+#if defined ( __GNUC__ )                                       && \
+    ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 3 ) )
+
+
+#define FT_ALLOC( _pointer_, _size_ )                  \
+          ({                                           \
+            void*  _tmp_ = NULL;                       \
+                                                       \
+                                                       \
+            error     = FT_MEM_ALLOC( _tmp_, _size_ ); \
+            _pointer_ = _tmp_;                         \
+            error != 0;                                \
+          })
+
+#define FT_REALLOC( _pointer_, _cursize_, _newsize_ )                  \
+          ({                                                           \
+            void*  _tmp_ = _pointer_;                                  \
+                                                                       \
+                                                                       \
+            error     = FT_MEM_REALLOC( _tmp_, _cursize_, _newsize_ ); \
+            _pointer_ = _tmp_;                                         \
+            error != 0;                                                \
+          })
+
+#define FT_QALLOC( _pointer_, _size_ )                  \
+          ({                                            \
+            void*  _tmp_;                               \
+                                                        \
+                                                        \
+            error     = FT_MEM_QALLOC( _tmp_, _size_ ); \
+            _pointer_ = _tmp_;                          \
+            error != 0;                                 \
+          })
+
+#define FT_QREALLOC( _pointer_, _cursize_, _newsize_ )                  \
+          ({                                                            \
+            void*  _tmp_ = _pointer_;                                   \
+                                                                        \
+                                                                        \
+            error     = FT_MEM_QREALLOC( _tmp_, _cursize_, _newsize_ ); \
+            _pointer_ = _tmp_;                                          \
+            error != 0;                                                 \
+          })
 
 
 #else /* !GCC || GCC < 3.3 */
 
+
 #define FT_ALLOC( _pointer_, _size_ )                       \
           FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, _size_ ) )
 
@@ -423,37 +435,38 @@ FT_BEGIN_HEADER
 
 #endif /* !GCC || GCC < 3.3 */
 
+
 #define FT_FREE( _pointer_ )       \
           FT_MEM_FREE( _pointer_ )
 
 
-#define FT_NEW( _pointer_ )  \
-          FT_ALLOC( _pointer_, sizeof(*(_pointer_)) )
+#define FT_NEW( _pointer_ )                              \
+          FT_ALLOC( _pointer_, sizeof ( *(_pointer_) ) )
 
-#define FT_NEW_ARRAY( _pointer_, _count_ )  \
-          FT_ALLOC( _pointer_, sizeof(*(_pointer_))*(_count_) )
+#define FT_NEW_ARRAY( _pointer_, _count_ )                           \
+          FT_ALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_count_) )
 
-#define FT_RENEW_ARRAY( _pointer_, _old_, _new_ )                \
-          FT_REALLOC( _pointer_, sizeof(*(_pointer_))*(_old_),   \
-                                 sizeof(*(_pointer_))*(_new_) )
+#define FT_RENEW_ARRAY( _pointer_, _old_, _new_ )                    \
+          FT_REALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_old_),  \
+                                 sizeof ( *(_pointer_) ) * (_new_) )
 
-#define FT_QNEW( _pointer_ )  \
-          FT_QALLOC( _pointer_, sizeof(*(_pointer_)) )
+#define FT_QNEW( _pointer_ )                              \
+          FT_QALLOC( _pointer_, sizeof ( *(_pointer_) ) )
 
-#define FT_QNEW_ARRAY( _pointer_, _count_ )  \
-          FT_QALLOC( _pointer_, sizeof(*(_pointer_))*(_count_) )
+#define FT_QNEW_ARRAY( _pointer_, _count_ )                           \
+          FT_QALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_count_) )
 
-#define FT_QRENEW_ARRAY( _pointer_, _old_, _new_ )                \
-          FT_QREALLOC( _pointer_, sizeof(*(_pointer_))*(_old_),   \
-                                  sizeof(*(_pointer_))*(_new_) )
+#define FT_QRENEW_ARRAY( _pointer_, _old_, _new_ )                    \
+          FT_QREALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_old_),  \
+                                  sizeof ( *(_pointer_) ) * (_new_) )
 
 
-#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ )         \
-          FT_ALLOC( _pointer_, (_count_)*sizeof( _type_ ) )
+#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ )           \
+          FT_ALLOC( _pointer_, (_count_) * sizeof ( _type_ ) )
 
-#define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ )  \
-          FT_REALLOC( _pointer, (_old_) * sizeof ( _type_ ), \
-                                (_new_) * sizeof ( _type_ )  )
+#define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ )   \
+          FT_REALLOC( _pointer, (_old_) * sizeof ( _type_ ),  \
+                                (_new_) * sizeof ( _type_ ) )
 
  /* */
 
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 1a6130c..4b92aed 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType private base classes (specification).                   */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -80,12 +80,14 @@ FT_BEGIN_HEADER
 #define FT_PIX_CEIL( x )      FT_PIX_FLOOR( (x) + 63 )
 
 
- /* returns the highest power of 2 that is <= value, this correspond to
-  * the highest bit in a given 32-bit value
-  */
+  /*
+   *  Return the highest power of 2 that is <= value; this correspond to
+   *  the highest bit in a given 32-bit value.
+   */
   FT_BASE( FT_UInt32 )
   ft_highpow2( FT_UInt32  value );
 
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index fbf8654..9db9fa7 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType services (specification only).                          */
 /*                                                                         */
-/*  Copyright 2003, 2004 by                                                */
+/*  Copyright 2003, 2004, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -61,10 +61,11 @@ FT_BEGIN_HEADER
 
 #define FT_FACE_FIND_SERVICE( face, ptr, id )                               \
   FT_BEGIN_STMNT                                                            \
-    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );               \
+    FT_Module    module = FT_MODULE( FT_FACE( face )->driver );             \
     FT_Pointer   _tmp_  = NULL;                                             \
     FT_Pointer*  _pptr_ = (FT_Pointer*)&(ptr);                              \
                                                                             \
+                                                                            \
     if ( module->clazz->get_interface )                                     \
       _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
     *_pptr_ = _tmp_;                                                        \
@@ -74,8 +75,8 @@ FT_BEGIN_HEADER
 
 #define FT_FACE_FIND_SERVICE( face, ptr, id )                               \
   FT_BEGIN_STMNT                                                            \
-    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );               \
-    FT_Pointer   _tmp_  = NULL;                                             \
+    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );              \
+    FT_Pointer  _tmp_  = NULL;                                              \
                                                                             \
     if ( module->clazz->get_interface )                                     \
       _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
@@ -110,10 +111,11 @@ FT_BEGIN_HEADER
 
 #define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \
   FT_BEGIN_STMNT                                                   \
-    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );      \
+    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );     \
     FT_Pointer  _tmp_;                                             \
     FT_Pointer  _pptr_ = (FT_Pointer*)&(ptr);                      \
                                                                    \
+                                                                   \
     _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
     *_pptr_ = _tmp_;                                               \
   FT_END_STMNT
@@ -122,15 +124,17 @@ FT_BEGIN_HEADER
 
 #define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \
   FT_BEGIN_STMNT                                                   \
-    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );      \
+    FT_Module   module = FT_MODULE( FT_FACE( face )->driver );     \
     FT_Pointer  _tmp_;                                             \
                                                                    \
+                                                                   \
     _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
     ptr   = _tmp_;                                                 \
   FT_END_STMNT
 
 #endif /* !C++ */
 
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -229,45 +233,45 @@ FT_BEGIN_HEADER
    */
 #ifdef __cplusplus
 
-#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )               \
-  FT_BEGIN_STMNT                                              \
-    FT_Pointer   svc;                                         \
-    FT_Pointer*  Pptr = (FT_Pointer*)&(ptr);                  \
-                                                              \
-                                                              \
-    svc = FT_FACE(face)->internal->services. service_ ## id;  \
-    if ( svc == FT_SERVICE_UNAVAILABLE )                      \
-      svc = NULL;                                             \
-    else if ( svc == NULL )                                   \
-    {                                                         \
-      FT_FACE_FIND_SERVICE( face, svc, id );                  \
-                                                              \
-      FT_FACE(face)->internal->services. service_ ## id =     \
-        (FT_Pointer)( svc != NULL ? svc                       \
-                                  : FT_SERVICE_UNAVAILABLE ); \
-    }                                                         \
-    *Pptr = svc;                                              \
+#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \
+  FT_BEGIN_STMNT                                               \
+    FT_Pointer   svc;                                          \
+    FT_Pointer*  Pptr = (FT_Pointer*)&(ptr);                   \
+                                                               \
+                                                               \
+    svc = FT_FACE( face )->internal->services. service_ ## id; \
+    if ( svc == FT_SERVICE_UNAVAILABLE )                       \
+      svc = NULL;                                              \
+    else if ( svc == NULL )                                    \
+    {                                                          \
+      FT_FACE_FIND_SERVICE( face, svc, id );                   \
+                                                               \
+      FT_FACE( face )->internal->services. service_ ## id =    \
+        (FT_Pointer)( svc != NULL ? svc                        \
+                                  : FT_SERVICE_UNAVAILABLE );  \
+    }                                                          \
+    *Pptr = svc;                                               \
   FT_END_STMNT
 
 #else /* !C++ */
 
-#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )               \
-  FT_BEGIN_STMNT                                              \
-    FT_Pointer   svc;                                         \
-                                                              \
-                                                              \
-    svc = FT_FACE(face)->internal->services. service_ ## id;  \
-    if ( svc == FT_SERVICE_UNAVAILABLE )                      \
-      svc = NULL;                                             \
-    else if ( svc == NULL )                                   \
-    {                                                         \
-      FT_FACE_FIND_SERVICE( face, svc, id );                  \
-                                                              \
-      FT_FACE(face)->internal->services. service_ ## id =     \
-        (FT_Pointer)( svc != NULL ? svc                       \
-                                  : FT_SERVICE_UNAVAILABLE ); \
-    }                                                         \
-    ptr = svc;                                                \
+#define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                \
+  FT_BEGIN_STMNT                                               \
+    FT_Pointer  svc;                                           \
+                                                               \
+                                                               \
+    svc = FT_FACE( face )->internal->services. service_ ## id; \
+    if ( svc == FT_SERVICE_UNAVAILABLE )                       \
+      svc = NULL;                                              \
+    else if ( svc == NULL )                                    \
+    {                                                          \
+      FT_FACE_FIND_SERVICE( face, svc, id );                   \
+                                                               \
+      FT_FACE( face )->internal->services. service_ ## id =    \
+        (FT_Pointer)( svc != NULL ? svc                        \
+                                  : FT_SERVICE_UNAVAILABLE );  \
+    }                                                          \
+    ptr = svc;                                                 \
   FT_END_STMNT
 
 #endif /* !C++ */
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index ca211f0..6f1a8a5 100644
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -283,4 +283,4 @@ FT_END_HEADER
 #endif /* __AFHINTS_H__ */
 
 
-/* END */
\ No newline at end of file
+/* END */
diff --git a/src/base/ftutil.c b/src/base/ftutil.c
index 317cd95..5b3aa8b 100644
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType utility file for memory and list management (body).         */
 /*                                                                         */
-/*  Copyright 2002, 2004 by                                                */
+/*  Copyright 2002, 2004, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,6 +19,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_MEMORY_H
+#include FT_INTERNAL_OBJECTS_H
 #include FT_LIST_H
 
 
@@ -403,12 +404,14 @@
   {
     FT_UInt32  value2;
 
-   /* we simply clear the lowest bit in each iteration. when
-    * we reach 0, we now that the previous value was our result
-    */
+
+    /*
+     *  We simply clear the lowest bit in each iteration.  When
+     *  we reach 0, we know that the previous value was our result.
+     */
     for ( ;; )
     {
-      value2 = value & (value-1);  /* clear lowest bit */
+      value2 = value & (value - 1);  /* clear lowest bit */
       if ( value2 == 0 )
         break;
 
diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c
index 38a10c1..6961dc4 100644
--- a/src/pfr/pfrload.c
+++ b/src/pfr/pfrload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR loader (body).                                          */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004 by                                          */
+/*  Copyright 2002, 2003, 2004, 2005 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -610,11 +610,12 @@
 
 
 #ifndef FT_OPTIMIZE_MEMORY
- /*
-  *  The kerning data embedded in a PFR font are (charcode,charcode)
-  *  pairs; we need to translate them to (gindex,gindex) and sort
-  *  the resulting array.
-  */
+
+  /*
+   *  The kerning data embedded in a PFR font are (charcode,charcode)
+   *  pairs; we need to translate them to (gindex,gindex) and sort
+   *  the resulting array.
+   */
   static FT_UInt
   pfr_get_gindex( PFR_Char  chars,
                   FT_UInt   count,
@@ -671,14 +672,14 @@
     FT_UInt       count;
 
 
-   /* create kerning pairs array
-    */
+    /* create kerning pairs array */
     if ( FT_NEW_ARRAY( phy_font->kern_pairs, phy_font->num_kern_pairs ) )
       goto Exit;
 
-   /* load all kerning items into the array,
-    * converting character codes into glyph indices
-    */
+    /*
+     *  load all kerning items into the array,
+     *  converting character codes into glyph indices
+     */
     pairs = phy_font->kern_pairs;
     item  = phy_font->kern_items;
     count = 0;
@@ -732,8 +733,7 @@
       FT_FRAME_EXIT();
     }
 
-   /* sort the resulting array
-    */
+    /* sort the resulting array */
     ft_qsort( pairs, count,
               sizeof ( PFR_KernPairRec ),
               pfr_compare_kern_pairs );
@@ -748,8 +748,10 @@
 
     return error;
   }
+
 #endif /* !FT_OPTIMIZE_MEMORY */
 
+
   static const PFR_ExtraItemRec  pfr_phy_font_extra_items[] =
   {
     { 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info },
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 68e1bd9..a4eefb0 100644
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR object methods (body).                                  */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004 by                                          */
+/*  Copyright 2002, 2003, 2004, 2005 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -361,7 +361,7 @@
       metrics->vertBearingX = 0;
       metrics->vertBearingY = 0;
 
-#if 0 /* some fonts seem to be broken here !! */
+#if 0 /* some fonts seem to be broken here! */
 
       /* Apply the font matrix, if any.                 */
       /* TODO: Test existing fonts with unusual matrix  */
@@ -423,16 +423,18 @@
   /*************************************************************************/
 
 #ifdef FT_OPTIMIZE_MEMORY
+
   FT_LOCAL_DEF( FT_Error )
   pfr_face_get_kerning( FT_Face     pfrface,        /* PFR_Face */
                         FT_UInt     glyph1,
                         FT_UInt     glyph2,
                         FT_Vector*  kerning )
   {
-    PFR_Face      face     = (PFR_Face)pfrface;
-    FT_Error      error    = PFR_Err_Ok;
-    PFR_PhyFont   phy_font = &face->phy_font;
-    FT_UInt32     code1, code2, pair;
+    PFR_Face     face     = (PFR_Face)pfrface;
+    FT_Error     error    = PFR_Err_Ok;
+    PFR_PhyFont  phy_font = &face->phy_font;
+    FT_UInt32    code1, code2, pair;
+
 
     kerning->x = 0;
     kerning->y = 0;
@@ -450,13 +452,14 @@
 
     code1 = phy_font->chars[glyph1].char_code;
     code2 = phy_font->chars[glyph2].char_code;
-    pair  = PFR_KERN_INDEX(code1,code2);
+    pair  = PFR_KERN_INDEX( code1, code2 );
 
     /* now search the list of kerning items */
     {
       PFR_KernItem  item   = phy_font->kern_items;
       FT_Stream     stream = pfrface->stream;
 
+
       for ( ; item; item = item->next )
       {
         if ( pair >= item->pair1 && pair <= item->pair2 )
@@ -465,28 +468,30 @@
       goto Exit;
 
     FoundPair: /* we found an item, now parse it and find the value if any */
-      if ( FT_STREAM_SEEK( item->offset )                     ||
-           FT_FRAME_ENTER( item->pair_count*item->pair_size ) )
+      if ( FT_STREAM_SEEK( item->offset )                       ||
+           FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
         goto Exit;
 
       {
-        FT_UInt   count    = item->pair_count;
-        FT_UInt   size     = item->pair_size;
-        FT_UInt   power    = (FT_UInt)ft_highpow2( (FT_UInt32)count );
-        FT_UInt   probe    = power*size;
-        FT_UInt   extra    = count - power;
-        FT_Byte*  base     = stream->cursor;
-        FT_Bool   twobytes = item->flags & 1;
-        FT_Byte*  p;
-        FT_UInt32 cpair;
+        FT_UInt    count    = item->pair_count;
+        FT_UInt    size     = item->pair_size;
+        FT_UInt    power    = (FT_UInt)ft_highpow2( (FT_UInt32)count );
+        FT_UInt    probe    = power * size;
+        FT_UInt    extra    = count - power;
+        FT_Byte*   base     = stream->cursor;
+        FT_Bool    twobytes = item->flags & 1;
+        FT_Byte*   p;
+        FT_UInt32  cpair;
+
 
         if ( extra > 0 )
         {
-          p    = base + extra*size;
+          p = base + extra * size;
+
           if ( twobytes )
-            cpair = FT_NEXT_ULONG(p);
+            cpair = FT_NEXT_ULONG( p );
           else
-            cpair = PFR_NEXT_KPAIR(p);
+            cpair = PFR_NEXT_KPAIR( p );
 
           if ( cpair == pair )
             goto Found;
@@ -499,10 +504,11 @@
         {
           probe >>= 1;
           p       = base + probe;
+
           if ( twobytes )
-            cpair = FT_NEXT_ULONG(p);
+            cpair = FT_NEXT_ULONG( p );
           else
-            cpair = PFR_NEXT_KPAIR(p);
+            cpair = PFR_NEXT_KPAIR( p );
 
           if ( cpair == pair )
             goto Found;
@@ -512,18 +518,20 @@
         }
 
         p = base;
+
         if ( twobytes )
-          cpair = FT_NEXT_ULONG(p);
+          cpair = FT_NEXT_ULONG( p );
         else
-          cpair = PFR_NEXT_KPAIR(p);
+          cpair = PFR_NEXT_KPAIR( p );
 
         if ( cpair == pair )
         {
           FT_Int  value;
 
+
         Found:
           if ( item->flags & 2 )
-            value = FT_PEEK_SHORT(p);
+            value = FT_PEEK_SHORT( p );
           else
             value = p[0];
 
@@ -539,6 +547,7 @@
   }
 
 #else /* !FT_OPTIMIZE_MEMORY */
+
   FT_LOCAL_DEF( FT_Error )
   pfr_face_get_kerning( FT_Face     pfrface,        /* PFR_Face */
                         FT_UInt     glyph1,
@@ -580,6 +589,8 @@
 
     return error;
   }
+
 #endif /* !FT_OPTIMIZE_MEMORY */
 
+
 /* END */
diff --git a/src/pfr/pfrtypes.h b/src/pfr/pfrtypes.h
index db593f0..b8bd557 100644
--- a/src/pfr/pfrtypes.h
+++ b/src/pfr/pfrtypes.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR data structures (specification only).                   */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -206,13 +206,16 @@ FT_BEGIN_HEADER
 
   } PFR_KernItemRec;
 
-#define PFR_KERN_INDEX( g1, g2 ) \
-  ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) )
 
-#define PFR_KERN_PAIR_INDEX( pair )  \
+#define PFR_KERN_INDEX( g1, g2 )                          \
+          ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) )
+
+#define PFR_KERN_PAIR_INDEX( pair )                        \
           PFR_KERN_INDEX( (pair)->glyph1, (pair)->glyph2 )
 
-#define PFR_NEXT_KPAIR(p)  ( p+=2, ((FT_UInt32)p[-2] << 16) | p[-1] )
+#define PFR_NEXT_KPAIR( p )  ( p += 2,                              \
+                               ( (FT_UInt32)p[-2] << 16 ) | p[-1] )
+
 
   typedef struct  PFR_KernPairRec_
   {