Commit f41e71a199011bb01a42c83fb29429d77167b969

Werner Lemberg 2001-12-20T21:22:02

* src/base/ftobjs.c (FT_Done_Library): Remove compiler warning. Formatting.

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
diff --git a/ChangeLog b/ChangeLog
index cb1b2c2..f469e94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,39 +7,80 @@
 	ftc_family_table_free, FTC_Manager_Check): Ditto.
 	* src/cache/ftcsbits.c (ftc_sbit_node_load): Ditto.
 
-2001-12-20  David Turner  <david@freetype.org>
+	* src/base/ftobjs.c (FT_Done_Library): Remove compiler warning.
 
-	* include/freetype/config/ftoption.h: Disabling bytecode interpreter
-	for new release.
+2001-12-20  David Turner  <david@freetype.org>
 
-	* docs/CHANGES: Updated for 2.0.6 release.
+	Added PostScript hinter support to the CFF and CID drivers.
+
+	* include/freetype/internal/cfftypes.h (CFF_Font): New member
+	`pshinter'.
+	* src/cff/cffload.c (CFF_Get_Standard_Encoding): New function.
+	* src/cff/cffload.h: Updated.
+	* src/cff/cffgload.c (CFF_Init_Builder): Renamed to ...
+	(CFF_Builder_Init): This.
+	Added new argument `hinting'.
+	(CFF_Done_Builder): Renamed to ...
+	(CFF_Builder_Done): This.
+	(CFF_Init_Decoder): Added new argument `hinting'.
+	(CFF_Parse_CharStrings): Implement vstem support.
+	(CFF_Load_Glyph): Updated.
+	Add hinting support.
+	(cff_lookup_glyph_by_stdcharcode): Use CFF_Get_Standard_Encoding().
+	(cff_argument_counts): Updated.
+	* src/cff/cffgload.h: Updated.
+	* src/cff/cffobjs.c: Include FT_INTERNAL_POSTSCRIPT_HINTS_H.
+	(CFF_Size_Get_Globals_Funcs, CFF_Size_Done, CFF_Size_Init,
+	CFF_Size_Reset, CFF_GlyphSlot_Done, CFF_GLyphSlot_Init): New
+	functions.
+	(CFF_Init_Face): Renamed to ...
+	(CFF_Face_Init): This.
+	Add hinter support.
+	(CFF_Done_Face): Renamed to ...
+	(CFF_Face_Done): This.
+	(CFF_Init_Driver): Renamed to ...
+	(CFF_Driver_Init): This.
+	(CFF_Done_Driver): Renamed to ...
+	(CFF_Driver_Done): This.
+	* src/cff/cffobjs.h: Updated.
+	* src/cff/cffdrivr.c (cff_driver_class): Updated.
+
+	* include/freetype/internal/t1types.h (CID_FaceRec): New member
+	`pshinter'.
+	* src/cid/cidgload.c (CID_Load_Glyph): Add hinter support.
+	* src/cid/cidobjs.c: Include FT_INTERNAL_POSTSCRIPT_HINTS_H.
+	(CID_GlyphSlot_Done, CID_GlyphSlot_Init, CID_Size_Get_Globals_Funcs,
+	CID_Size_Done, CID_Size_Init, CID_Size_Reset): New functions.
+	(CID_Done_Face): Renamed to ...
+	(CID_Face_Done): This.
+	(CID_Init_Face): Renamed to ...
+	(CID_Face_Init): This.
+	Add hinting support.
+	(CID_Init_Driver): Renamed to ...
+	(CID_Driver_Init): This.
+	(CID_Done_Driver): Renamed to ...
+	(CID_Driver_Done): This.
+	* src/cid/cidobjs.h: Updated.
+	* src/cidriver.c: Updated.
+
+	* src/pshinter/pshrec.c (t2_hint_stems): Fixed.
+
+	* src/base/ftobjs.c (FT_Done_Library): Fixed a stupid bug that
+	crashed the library on exit.
+
+	* src/type1/t1gload.c (T1_Load_Glyph): Enable font matrix
+	transformation of hinted glyphs.
 
 	* src/cff/cffload.h, src/cff/cffload.c, src/cff/cffgload.c: Updated
-	to mode the definition of encoding tables within "cffload.c" instead
-	of making them part of a shared header (causing problems in "multi"
-	builds).
-
-	* docs/TODO: Added "stem3 and counter hints support" to the TODO list
-	for the Postscript hinter.
+	to move the definition of encoding tables back within "cffload.c"
+	instead of making them part of a shared header (causing problems in
+	"multi" builds).  This reverts change 2001-08-08.
 
+	* docs/CHANGES: Updated for 2.0.6 release.
+	* docs/TODO: Added "stem3 and counter hints support" to the TODO
+	list for the Postscript hinter.
 	* docs/BUGS: Closed the AUTOHINT-NO-SBITS bug.
 
-	* src/pshinter/pshrec.c (t2_hint_stems), src/cff/cffobjs.h,
-	src/cff/cffobjs.c, src/cff/cffload.c, src/cff/cffload.h,
-	src/cff/cffgload.c, src/cff/cffgload.h, src/cff/cffdriver.c,
-	include/freetype/internal/cfftypes.h: added Postscript hinter support
-	to the CFF driver.
-
-	* src/base/ftobjs.c (FT_Done_Library): Fixed a stupid bug that crashed
-	the library on exit.
-
-	* src/type1/t1gload.c (T1_Load_Glyph): Enable font matrix transform
-	on hinted glyphs.
-
-	* src/cid/cidgload.c, src/cid/cidobjs.c, src/cid/cidobjs.h,
-	src/cid/cidriver.c, include/freetype/internal/t1types.h: Added
-	Postscript hinter support to the CID font driver.
-
 2001-12-19  David Turner  <david@freetype.org>
 
 	* include/freetype/cache/ftcache.h: Added comments to indicate that
diff --git a/docs/BUGS b/docs/BUGS
index a09adb1..50a3208 100644
--- a/docs/BUGS
+++ b/docs/BUGS
@@ -44,7 +44,7 @@ Identifier                Date         Closed by                Closure date
 ------------------------------------------------------------------------------
 BAD-TTNAMEID.H          12-09-2001     Antoine                   N/A
 BAD-T1-CHARMAP          15-06-2001     David                     2.0.5
-BAD-UNIXXX-NAMES        30-07-2001     David                     2.0.5
+BAD-UNIXXXX-NAMES       30-07-2001     David                     2.0.5
 GLYPH_TO_BITMAP-BUG     05-12-2001     David                     05-12-2001
 AUTOHINT-NO-SBITS       13-09-2001     David                     2.0.6
 
@@ -84,7 +84,7 @@ BAD-TTNAMEID.H
     Which one is correct?
 
   Antoine replied that this was a bug in the TT 1.66 specification, and that
-  FreeType followed the most recent TrueType/OpenType specification here!
+  FreeType followed the most recent TrueType/OpenType specification here.
 
 
 AUTOHINT-SBITS
@@ -98,9 +98,9 @@ AUTOHINT-SBITS
   efficiently without making a few important internal changes to the
   library's design (more importantly, to the font driver interface).
 
-  This has been corrected with a hack in FT_Load_Glyph. More important
-  internal changes should help get rid of it with a clean solution in
-  a further release like FreeType 2.1
+  This has been corrected with a hack in FT_Load_Glyph().  More important
+  internal changes should help get rid of it with a clean solution in a
+  further release like FreeType 2.1.
 
 
 BAD-TT-RENDERING
@@ -112,10 +112,10 @@ BAD-TT-RENDERING
   Tests and comparisons show a _major_ discrepancy of monochrome truetype
   bytecode-hinted glyphs!  Something seems to be really broken here!
 
-  Some of this has been fixed in 2.0.6, there was a bug in the TrueType
-  loader that prevented it from loading composites correctly. However, there
-  are still _subtle_ differences between FT1 and FT2 when it comes to
-  monochrome TrueType-hinted glyphs..
+  Some of this has been fixed in 2.0.6; there was a bug in the TrueType
+  loader that prevented it from loading composites correctly.  However,
+  there are still _subtle_ differences between FT1 and FT2 when it comes to
+  monochrome TrueType-hinted glyphs.
 
 
 BAD-THIN-LINES
@@ -143,7 +143,7 @@ BAD-T1-CHARMAP
   table of glyph names in 'src/psaux/pstables.h'.)
 
 
-BAD-UNIXXX-NAMES
+BAD-UNIXXXX-NAMES
 
   Glyph names like uniXXXX are not recognized as they should be.  It seems
   that code in psmodule.c for uniXXXX glyph names was never tested.  The
@@ -198,14 +198,14 @@ GLYPH_TO_BITMAP-BUG
   Calling FT_Glyph_To_Bitmap() sometimes modifies the original glyph
   outline, creating weird alignment artefacts.
   
-  This subtle bug was really in the file src/smooth/ftsmooth.c.  Basically,
-  the outline was shifted before rendering it into a new bitmap buffer.
-  However, it wasn't properly un-shifted after that operation.
+  This subtle bug was really in the file `src/smooth/ftsmooth.c'. 
+  Basically, the outline was shifted before rendering it into a new bitmap
+  buffer.  However, it wasn't properly un-shifted after that operation.
 
   This was only noticeable with certain glyphs or certain fonts; it crept in
   a long time ago.
                   
-  same bug in src/raster/ftrender1.c by the way..
+  The same bug has been fixed in src/raster/ftrender1.c also.
                   
 
 === end of file ===
diff --git a/docs/CHANGES b/docs/CHANGES
index cc371d5..7df3ec2 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -1,76 +1,80 @@
 LATEST CHANGES BETWEEN 2.0.6 and 2.0.5
 
- *** IMPORTANT BUG FIXES:
- 
-  - it wasn't possible to load embedded bitmaps when the auto-hinter was
-    used. This is now fixed..
- 
-  - the TrueType font driver didn't load some composites properly
-    (the sub-glyphs were slightly shifted, and this was only noticeable
-     when using monochrome rendering)
-
-  -  Various fixes to the auto-hinter.  They merely improve the output of
-     sans-serif fonts.  Note that there are still problems with serifed
-     fonts and composites (accented characters).
-
-  - all scalable font drivers mistakenly returned un-fitted glyph advances
-    when hinting was requested. This created problems for a number of layout
-    applications. This is a very old bug that got undetected mainly because
-    most test/demo program perform rounding explicitely or implicitely
-    (through the cache).
-
-  - FT_Glyph_ToBitmap did mistakenly modify the source glyph in certain cases.
-
-  - "glnames.py" still contained a bug that made FreeType return invalid
-    names for certain glyphs.
-
-
- *** IMPORTANT UPDATES & NEW FEATURES:
-
-  - important updates to the Mac-specific parts of the library. 
-
-  - The caching sub-system has been completely re-designed, and its API has
-    evolved (the old one is still supported for backwards).
-    
-    The documentation for it will be completed on the next release though..
-    For now, you're encouraged to continue using the old API
-
-  - A new charmap cache is provided too. See FTC_CMapCache. This is useful
-    to perform character code -> glyph index translations quickly, without
-    the need for an opened FT_Face..
-
-  - A NEW POSTSCRIPT HINTER module has been added to support native hints in
-    the following formats: Postscript Type 1, Postscript CID and CFF/CEF.
-
-    CHECK THIS OUT !! Note that the auto-hinter produces better results for
-    a number of badly-hinted fonts (mostly auto-generated ones) though..
-
-
-  - A memory debugger is now part of the standard FreeType sources. To
-    enable it, define FT_DEBUG_MEMORY in <freetype/config/ftoption.h>,
-    and recompile the library.
-    
-    Now, define the _environment_ variable FT_DEBUG_MEMORY and run any
-    program using FreeType. When the library is exited, a summary of
-    memory footprints and eventual leaks will be displayed..
-
-    this works transparently with _any_ program that uses FreeType..
-    you'll need _lots_ of memory to use this however (allocated blocks
-    are never released to the heap to detect double deletes easily)
-
- *** OTHER:
- 
-  - we're aware of subtle differences between the output of FT 1 and FT 2
-    when it comes to monochrome TrueType-hinted glyphs. These are most
-    probably due to small differences in the monochrome rasterizers and
-    will be worked out in an upcoming release.
-
-    
-  - the next release will be named FreeType 2.1, and will include a
-    _major_ rework of the library's internals, both to make the source
-    code more consistent, readable, etc.. as well as to implement new
-    features like:
-    
+  I. IMPORTANT BUG FIXES
+
+    - It wasn't possible to load embedded bitmaps when the auto-hinter was
+      used.  This is now fixed.
+
+    - The TrueType font driver didn't load some composites properly (the
+      sub-glyphs were slightly shifted, and this was only noticeable when
+      using monochrome rendering).
+
+    - Various fixes to the auto-hinter.  They merely improve the output of
+      sans-serif fonts.  Note that there are still problems with serifed
+      fonts and composites (accented characters).
+
+    - All scalable font drivers erroneously returned un-fitted glyph
+      advances when hinting was requested.  This created problems for a
+      number of layout applications.  This is a very old bug that got
+      undetected mainly because most test/demo program perform rounding
+      explicitly or implicitly (through the cache).
+
+    - FT_Glyph_To_Bitmap() did erroneously modify the source glyph in
+      certain cases.
+
+    - "glnames.py" still contained a bug that made FreeType return invalid
+      names for certain glyphs.
+
+
+  II. IMPORTANT UPDATES AND NEW FEATURES
+
+    - Important updates to the Mac-specific parts of the library.
+
+    - The caching sub-system has been completely re-designed, and its API
+      has evolved (the old one is still supported for backwards
+      compatibility).
+
+      The documentation for it is not yet completed, sorry.  For now, you
+      are encouraged to continue using the old API.  However, the ftview
+      demo program in the ft2demos package has already been updated to use
+      the new caching functions.
+
+    - A new charmap cache is provided too.  See FTC_CMapCache().  This is
+      useful to perform character code -> glyph index translations quickly,
+      without the need for an opened FT_Face.
+
+    - A NEW POSTSCRIPT HINTER module has been added to support native hints
+      in the following formats: PostScript Type 1, PostScript CID, and
+      CFF/CEF.
+
+      Please test!  Note that the auto-hinter produces better results for a
+      number of badly-hinted fonts (mostly auto-generated ones) though.
+
+    - A memory debugger is now part of the standard FreeType sources.  To
+      enable it, define FT_DEBUG_MEMORY in <freetype/config/ftoption.h>, and
+      recompile the library.
+
+      Additionally, define the _environment_ variable FT_DEBUG_MEMORY and
+      run any program using FreeType.  When the library is exited, a summary
+      of memory footprints and possible leaks will be displayed.
+
+      This works transparently with _any_ program that uses FreeType. 
+      However, you will need a lot of memory to use this (allocated blocks
+      are never released to the heap to detect double deletes easily).
+
+
+  III. MISCELLANEOUS
+
+    - We are aware of subtle differences between the output of FreeType
+      versions 1 and 2 when it comes to monochrome TrueType-hinted glyphs. 
+      These are most probably due to small differences in the monochrome
+      rasterizers and will be worked out in an upcoming release.
+
+    - The next release will be named FreeType 2.1, and will include a
+      _major_ rework of the library's internals, both to make the source
+      code more consistent, readable, etc. as well as to implement new
+      features like:
+
       - sub-pixel filtering ("ClearType" and "CoolType" like)
       - gamma-correction
       - dynamic version and features retrieval
@@ -78,9 +82,6 @@ LATEST CHANGES BETWEEN 2.0.6 and 2.0.5
       - important enhancements to the monochrome rasterizer
         (especially for Postscript-based formats)
 
-
-  Merry XMas :-)
-
 ============================================================================
 
 LATEST CHANGES BETWEEN 2.0.5 and 2.0.4
@@ -118,9 +119,9 @@ LATEST CHANGES BETWEEN 2.0.5 and 2.0.4
   - Added a new function named "FT_Get_Postscript_Name" to retrieve the
     "unique" Postscript font name of a given face.
 
-  - Added a new public header size named FT_SIZES_H (or <freetype/ftsizes.h>)
-    providing new FT_Size-management functions: FT_New_Size, FT_Activate_Size,
-    FT_Done_Size.
+  - Added a new public header size named FT_SIZES_H (or
+    <freetype/ftsizes.h>) providing new FT_Size-management functions:
+    FT_New_Size, FT_Activate_Size, FT_Done_Size.
 
   - Fixed a reallocation bug that generated a dangling pointer (and possibly
     memory leaks) with Postscript fonts (in src/psaux/psobjs.c).
diff --git a/docs/TODO b/docs/TODO
index 6094f60..cbcde59 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -6,4 +6,4 @@ not exactly bugs, but should be considered though:
 
 * Add synthesized Unicode charmap processing to the CFF driver.
 
-* Implement stem3/counter hints properly in the Postscript hinter
+* Implement stem3/counter hints properly in the Postscript hinter.
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index c8c87eb..e561acb 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -190,7 +190,7 @@ FT_BEGIN_HEADER
     CID_Subrs*  subrs;
     
     /* since FT 2.1 - interface to PostScript hinter */
-    void*          pshinter;
+    void*       pshinter;
 
   } CID_FaceRec;
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 618d45a..b11ab7f 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2633,7 +2633,6 @@
   FT_Done_Library( FT_Library  library )
   {
     FT_Memory  memory;
-    FT_UInt    n;
 
 
     if ( !library )
@@ -2646,19 +2645,24 @@
       library->generic.finalizer( library );
 
     /* Close all modules in the library */
-#if 1    
+#if 1
     while ( library->num_modules > 0 )
       FT_Remove_Module( library, library->modules[0] );
-#else    
-    for ( n = 0; n < library->num_modules; n++ )
+#else
     {
-      FT_Module  module = library->modules[n];
+      FT_UInt  n;
 
 
-      if ( module )
+      for ( n = 0; n < library->num_modules; n++ )
       {
-        Destroy_Module( module );
-        library->modules[n] = 0;
+        FT_Module  module = library->modules[n];
+
+
+        if ( module )
+        {
+          Destroy_Module( module );
+          library->modules[n] = 0;
+        }
       }
     }
 #endif
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 01e3b4c..2004b8a 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -543,7 +543,6 @@
     if ( charcode < 0 || charcode > 255 )
       return -1;
 
-
     /* Get code to SID mapping from `cff_standard_encoding'. */
     glyph_sid = CFF_Get_Standard_Encoding( (FT_UInt)charcode );
 
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index b66d29b..44e1fff 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -50,8 +50,8 @@
   /*                                                                       */
   /*                            SIZE FUNCTIONS                             */
   /*                                                                       */
-  /*  note that we store the global hints in the size's "internal" root    */
-  /*  field                                                                */
+  /*  Note that we store the global hints in the size's "internal" root    */
+  /*  field.                                                               */
   /*                                                                       */
   /*************************************************************************/
 
@@ -59,7 +59,7 @@
   static PSH_Globals_Funcs
   CFF_Size_Get_Globals_Funcs( CFF_Size  size )
   {
-    CFF_Face             face     = (CFF_Face) size->face;
+    CFF_Face             face     = (CFF_Face)size->face;
     CFF_Font*            font     = face->extra.data;
     PSHinter_Interface*  pshinter = font->pshinter;
     FT_Module            module;
@@ -69,7 +69,7 @@
                             "pshinter" );
     return ( module && pshinter && pshinter->get_globals_funcs )
            ? pshinter->get_globals_funcs( module )
-           : 0 ;
+           : 0;
   }
 
 
@@ -99,22 +99,24 @@
 
     if ( funcs )
     {
-      PSH_Globals  globals;
-      CFF_Face     face    = (CFF_Face)size->face;
-      CFF_Font*    font    = face->extra.data;
-      CFF_SubFont* subfont = &font->top_font;
+      PSH_Globals   globals;
+      CFF_Face      face    = (CFF_Face)size->face;
+      CFF_Font*     font    = face->extra.data;
+      CFF_SubFont*  subfont = &font->top_font;
 
-      CFF_Private* cpriv = &subfont->private_dict;
-      T1_Private   priv;
+      CFF_Private*  cpriv   = &subfont->private_dict;
+      T1_Private    priv;
 
-      /* IMPORTANT: the CFF and Type1 private dictionaries have */
-      /*            slightly different structures, we need to   */
-      /* synthetize a type1 dictionary on the fly here !!       */
+
+      /* IMPORTANT: The CFF and Type1 private dictionaries have    */
+      /*            slightly different structures; we need to      */
+      /*            synthetize a type1 dictionary on the fly here. */
 
       {
-        FT_UInt   n, count;
+        FT_UInt  n, count;
+
 
-        MEM_Set( &priv, 0, sizeof(priv) );
+        MEM_Set( &priv, 0, sizeof ( priv ) );
 
         count = priv.num_blue_values = cpriv->num_blue_values;
         for ( n = 0; n < count; n++ )
@@ -136,20 +138,20 @@
         priv.blue_shift = cpriv->blue_shift;
         priv.blue_fuzz  = cpriv->blue_fuzz;
 
-        priv.standard_width[0]  = (FT_UShort) cpriv->standard_width;
-        priv.standard_height[0] = (FT_UShort) cpriv->standard_height;
-        
+        priv.standard_width[0]  = (FT_UShort)cpriv->standard_width;
+        priv.standard_height[0] = (FT_UShort)cpriv->standard_height;
+
         count = priv.num_snap_widths = cpriv->num_snap_widths;
         for ( n = 0; n < count; n++ )
           priv.snap_widths[n] = cpriv->snap_widths[n];
-          
+
         count = priv.num_snap_heights = cpriv->num_snap_heights;
         for ( n = 0; n < count; n++ )
           priv.snap_heights[n] = cpriv->snap_heights[n];
 
-        priv.force_bold           = cpriv->force_bold;
-        priv.language_group       = cpriv->language_group;
-        priv.lenIV                = cpriv->lenIV;
+        priv.force_bold     = cpriv->force_bold;
+        priv.language_group = cpriv->language_group;
+        priv.lenIV          = cpriv->lenIV;
       }
 
       error = funcs->create( size->face->memory, &priv, &globals );
@@ -191,31 +193,34 @@
 
 
   FT_LOCAL_DEF FT_Error
-  CFF_GlyphSlot_Init( CFF_GlyphSlot   slot )
+  CFF_GlyphSlot_Init( CFF_GlyphSlot  slot )
   {
-    CFF_Face              face = (CFF_Face) slot->root.face;
-    CFF_Font*             font = face->extra.data;
-    PSHinter_Interface*   pshinter = font->pshinter;
+    CFF_Face             face     = (CFF_Face)slot->root.face;
+    CFF_Font*            font     = face->extra.data;
+    PSHinter_Interface*  pshinter = font->pshinter;
+
 
-    if (pshinter)
+    if ( pshinter )
     {
       FT_Module  module;
 
-      module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" );
-      if (module)
+
+      module = FT_Get_Module( slot->root.face->driver->root.library,
+                              "pshinter" );
+      if ( module )
       {
         T2_Hints_Funcs  funcs;
 
+
         funcs = pshinter->get_t2_funcs( module );
         slot->root.internal->glyph_hints = (void*)funcs;
       }
     }
+
     return 0;
   }
 
 
-
-
   /*************************************************************************/
   /*                                                                       */
   /*                           FACE  FUNCTIONS                             */
@@ -440,12 +445,12 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    FT_Error            error;
-    SFNT_Interface*     sfnt;
-    PSNames_Interface*  psnames;
-    PSHinter_Interface* pshinter;
-    FT_Bool             pure_cff    = 1;
-    FT_Bool             sfnt_format = 0;
+    FT_Error             error;
+    SFNT_Interface*      sfnt;
+    PSNames_Interface*   psnames;
+    PSHinter_Interface*  pshinter;
+    FT_Bool              pure_cff    = 1;
+    FT_Bool              sfnt_format = 0;
 
 
     sfnt = (SFNT_Interface*)FT_Get_Module_Interface(
@@ -534,13 +539,13 @@
         goto Exit;
 
       cff->pshinter = pshinter;
-      
+
       /* Complement the root flags with some interesting information. */
       /* Note that this is only necessary for pure CFF and CEF fonts. */
 
-      root = &face->root;
-      
+      root             = &face->root;
       root->num_glyphs = cff->num_glyphs;
+
       if ( pure_cff )
       {
         CFF_Font_Dict*  dict = &cff->top_font.font_dict;
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 9967f65..e2eb679 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -38,7 +38,6 @@
 #define FT_COMPONENT  trace_cidobjs
 
 
-
   /*************************************************************************/
   /*                                                                       */
   /*                            SLOT  FUNCTIONS                            */
@@ -54,28 +53,34 @@
 
   FT_LOCAL_DEF FT_Error
   CID_GlyphSlot_Init( CID_GlyphSlot   slot )
-  {  
+  {
     CID_Face             face;
     PSHinter_Interface*  pshinter;
-    
+
+
     face     = (CID_Face) slot->root.face;
     pshinter = face->pshinter;
-    if (pshinter)
+
+    if ( pshinter )
     {
       FT_Module  module;
-      
-      module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" );
-      if (module)
+
+
+      module = FT_Get_Module( slot->root.face->driver->root.library,
+                              "pshinter" );
+      if ( module )
       {
         T1_Hints_Funcs  funcs;
-        
+
+
         funcs = pshinter->get_t1_funcs( module );
-        slot->root.internal->glyph_hints = (void*)funcs;                   
+        slot->root.internal->glyph_hints = (void*)funcs;
       }
     }
+
     return 0;
   }
-  
+
 
   /*************************************************************************/
   /*                                                                       */
@@ -87,16 +92,16 @@
   static PSH_Globals_Funcs
   CID_Size_Get_Globals_Funcs( CID_Size  size )
   {
-    CID_Face              face     = (CID_Face) size->root.face;
+    CID_Face             face     = (CID_Face)size->root.face;
     PSHinter_Interface*  pshinter = face->pshinter;
     FT_Module            module;
-    
+
 
     module = FT_Get_Module( size->root.face->driver->root.library,
                             "pshinter" );
     return ( module && pshinter && pshinter->get_globals_funcs )
            ? pshinter->get_globals_funcs( module )
-           : 0 ;
+           : 0;
   }
 
 
@@ -106,7 +111,7 @@
     if ( size->root.internal )
     {
       PSH_Globals_Funcs  funcs;
-    
+
 
       funcs = CID_Size_Get_Globals_Funcs( size );
       if ( funcs )
@@ -122,21 +127,21 @@
   {
     FT_Error           error = 0;
     PSH_Globals_Funcs  funcs = CID_Size_Get_Globals_Funcs( size );
-    
+
 
     if ( funcs )
     {
-      PSH_Globals  globals;
-      CID_Face      face = (CID_Face)size->root.face;
-      CID_FontDict* dict = face->cid.font_dicts + face->root.face_index;
-      T1_Private*   priv = &dict->private_dict;
-      
+      PSH_Globals    globals;
+      CID_Face       face = (CID_Face)size->root.face;
+      CID_FontDict*  dict = face->cid.font_dicts + face->root.face_index;
+      T1_Private*    priv = &dict->private_dict;
+
 
       error = funcs->create( size->root.face->memory, priv, &globals );
       if ( !error )
         size->root.internal = (FT_Size_Internal)(void*)globals;
     }
-    
+
     return error;
   }
 
@@ -147,13 +152,13 @@
     PSH_Globals_Funcs  funcs = CID_Size_Get_Globals_Funcs( size );
     FT_Error           error = 0;
 
-    
+
     if ( funcs )
       error = funcs->set_scale( (PSH_Globals)size->root.internal,
                                  size->root.metrics.x_scale,
                                  size->root.metrics.y_scale,
                                  0, 0 );
-    return error;                                
+    return error;
   }
 
 
@@ -243,10 +248,10 @@
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
-    FT_Error            error;
-    PSNames_Interface*  psnames;
-    PSAux_Interface*    psaux;
-    PSHinter_Interface* pshinter;
+    FT_Error             error;
+    PSNames_Interface*   psnames;
+    PSAux_Interface*     psaux;
+    PSHinter_Interface*  pshinter;
 
     FT_UNUSED( num_params );
     FT_UNUSED( params );
@@ -269,22 +274,20 @@
     if ( !psaux )
     {
       psaux = (PSAux_Interface*)FT_Get_Module_Interface(
-                  FT_FACE_LIBRARY( face ), "psaux" );
+                FT_FACE_LIBRARY( face ), "psaux" );
 
       face->psaux = psaux;
     }
 
-
     pshinter = (PSHinter_Interface*)face->pshinter;
     if ( !pshinter )
     {
-      pshinter = (PSHinter_Interface*)
-                 FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" );
+      pshinter = (PSHinter_Interface*)FT_Get_Module_Interface(
+                   FT_FACE_LIBRARY( face ), "pshinter" );
 
       face->pshinter = pshinter;
     }
 
-
     /* open the tokenizer; this will also check the font format */
     if ( FILE_Seek( 0 ) )
       goto Exit;
diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c
index 85dd95e..140a952 100644
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -1177,8 +1177,8 @@
       }
 
       /* compute lengths */
-      for ( n = 0; n < count*2; n += 2 )
-        stems[n+1] = stems[n+1] - stems[n];
+      for ( n = 0; n < count * 2; n += 2 )
+        stems[n + 1] = stems[n + 1] - stems[n];
 
       /* add them to the current dimension */
       ps_hints_stem( (PS_Hints)hints, dimension, count, stems );