Commit 0589e3c01212fc77470ddde13d379a16170af151

Ewald Hew 2017-09-25T06:10:20

Use the new objects. * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix switching between new and old engines. * src/cff/cffgload.c, src/cff/cffparse.c: Update calls. * src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h, src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all to use new objects.

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
diff --git a/ChangeLog b/ChangeLog
index 4de920b..a215fa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-09-25  Ewald Hew  <ewaldhew@gmail.com>
+
+	[psaux, cff] Use the new objects.
+
+	* include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix
+	switching between new and old engines.
+
+	* src/cff/cffgload.c, src/cff/cffparse.c: Update calls.
+
+	* src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h,
+	src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all
+	to use new objects.
+
 2017-09-24  Ewald Hew  <ewaldhew@gmail.com>
 
 	[psaux] Objects for new interpreter (part 2).
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index 3361b97..45013e4 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -1137,18 +1137,22 @@ FT_BEGIN_HEADER
                 CFF_Size      size,
                 FT_UInt       glyph_index );
 
-    FT_Error
-    (*parse_charstrings)( CFF_Decoder*  decoder,
-                          FT_Byte*      charstring_base,
-                          FT_ULong      charstring_len
 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
-/*TODO(ewaldhew): seems hacky, is there a better way to do this?*/
-                         ,FT_Bool       in_dict
+    FT_Error
+    (*parse_charstrings_old)( CFF_Decoder*  decoder,
+                              FT_Byte*      charstring_base,
+                              FT_ULong      charstring_len,
+                              FT_Bool       in_dict );
 #endif
-                          );
+
+    FT_Error
+    (*parse_charstrings)( PS_Decoder*  decoder,
+                          FT_Byte*     charstring_base,
+                          FT_ULong     charstring_len );
 
   } CFF_Decoder_FuncsRec;
 
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 92ca08b..12c8097 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -169,10 +169,10 @@
       {
         error = decoder_funcs->prepare( &decoder, size, glyph_index );
         if ( !error )
-          error = decoder_funcs->parse_charstrings( &decoder,
-                                                    charstring,
-                                                    charstring_len,
-                                                    0 );
+          error = decoder_funcs->parse_charstrings_old( &decoder,
+                                                        charstring,
+                                                        charstring_len,
+                                                        0 );
 
         cff_free_glyph_data( face, &charstring, &charstring_len );
       }
@@ -198,6 +198,7 @@
   {
     FT_Error     error;
     CFF_Decoder  decoder;
+    PS_Decoder   psdecoder;
     TT_Face      face = (TT_Face)glyph->root.face;
     FT_Bool      hinting, scaled, force_scaling;
     CFF_Font     cff  = (CFF_Font)face->extra.data;
@@ -427,14 +428,16 @@
 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
       /* choose which CFF renderer to use */
       if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
-        error = decoder_funcs->parse_charstrings( &decoder,
-                                                  charstring,
-                                                  charstring_len,
-                                                  0 );
+        error = decoder_funcs->parse_charstrings_old( &decoder,
+                                                      charstring,
+                                                      charstring_len,
+                                                      0 );
       else
 #endif
       {
-        error = decoder_funcs->parse_charstrings( &decoder,
+        psaux->ps_decoder_init( &decoder, FALSE, &psdecoder );
+
+        error = decoder_funcs->parse_charstrings( &psdecoder,
                                                   charstring,
                                                   charstring_len );
 
@@ -449,7 +452,7 @@
           force_scaling = TRUE;
           glyph->hint   = hinting;
 
-          error = decoder_funcs->parse_charstrings( &decoder,
+          error = decoder_funcs->parse_charstrings( &psdecoder,
                                                     charstring,
                                                     charstring_len );
         }
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 63f20a1..888b2d5 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -1299,6 +1299,11 @@
                   FT_Byte*    start,
                   FT_Byte*    limit )
   {
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+    PSAux_Service  psaux;
+#endif
+
+
     FT_Byte*    p       = start;
     FT_Error    error   = FT_Err_Ok;
     FT_Library  library = parser->library;
@@ -1397,11 +1402,11 @@
           error = FT_THROW( Missing_Module );
           goto Exit;
         }
-        
-        error = psaux->cff_decoder_funcs->parse_charstrings( &decoder,
-                                                             charstring_base,
-                                                             charstring_len,
-                                                             1 );
+
+        error = psaux->cff_decoder_funcs->parse_charstrings_old( &decoder,
+                                                                 charstring_base,
+                                                                 charstring_len,
+                                                                 1 );
 
         /* Now copy the stack data in the temporary decoder object,    */
         /* converting it back to charstring number representations     */
diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c
index d7223e2..bc7002a 100644
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -137,10 +137,9 @@
     cff_decoder_prepare,           /* prepare           */
 
 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
-    cff_decoder_parse_charstrings  /* parse_charstrings */
-#else
-    cf2_decoder_parse_charstrings
+    cff_decoder_parse_charstrings, /* parse_charstrings_old */
 #endif
+    cf2_decoder_parse_charstrings  /* parse_charstrings */
   };
 
 
diff --git a/src/psaux/psblues.c b/src/psaux/psblues.c
index b102b37..9c8b025 100644
--- a/src/psaux/psblues.c
+++ b/src/psaux/psblues.c
@@ -67,7 +67,7 @@
                   CF2_Font   font )
   {
     /* pointer to parsed font object */
-    CFF_Decoder*  decoder = font->decoder;
+    PS_Decoder*  decoder = font->decoder;
 
     CF2_Fixed  zoneHeight;
     CF2_Fixed  maxZoneHeight = 0;
diff --git a/src/psaux/psfont.c b/src/psaux/psfont.c
index 13cff73..bdcc356 100644
--- a/src/psaux/psfont.c
+++ b/src/psaux/psfont.c
@@ -243,7 +243,7 @@
                   const CF2_Matrix*  transform )
   {
     /* pointer to parsed font object */
-    CFF_Decoder*  decoder = font->decoder;
+    PS_Decoder*  decoder = font->decoder;
 
     FT_Bool  needExtraSetup = FALSE;
 
diff --git a/src/psaux/psfont.h b/src/psaux/psfont.h
index f7ce149..f88b131 100644
--- a/src/psaux/psfont.h
+++ b/src/psaux/psfont.h
@@ -90,7 +90,7 @@ FT_BEGIN_HEADER
 
     /* FreeType related members */
     CF2_OutlineRec  outline;       /* freetype glyph outline functions */
-    CFF_Decoder*    decoder;
+    PS_Decoder*     decoder;
     CFF_SubFont     lastSubfont;              /* FreeType parsed data; */
                                               /* top font or subfont   */
 
diff --git a/src/psaux/psft.c b/src/psaux/psft.c
index 2107100..a05f1f2 100644
--- a/src/psaux/psft.c
+++ b/src/psaux/psft.c
@@ -89,7 +89,7 @@
   cf2_setGlyphWidth( CF2_Outline  outline,
                      CF2_Fixed    width )
   {
-    CFF_Decoder*  decoder = outline->decoder;
+    PS_Decoder*  decoder = outline->decoder;
 
 
     FT_ASSERT( decoder );
@@ -128,8 +128,8 @@
                       const CF2_CallbackParams  params )
   {
     /* downcast the object pointer */
-    CF2_Outline   outline = (CF2_Outline)callbacks;
-    CFF_Builder*  builder;
+    CF2_Outline  outline = (CF2_Outline)callbacks;
+    PS_Builder*  builder;
 
     (void)params;        /* only used in debug mode */
 
@@ -140,7 +140,7 @@
     builder = &outline->decoder->builder;
 
     /* note: two successive moves simply close the contour twice */
-    cff_builder_close_contour( builder );
+    ps_builder_close_contour( builder );
     builder->path_begun = 0;
   }
 
@@ -152,8 +152,8 @@
     FT_Error  error;
 
     /* downcast the object pointer */
-    CF2_Outline   outline = (CF2_Outline)callbacks;
-    CFF_Builder*  builder;
+    CF2_Outline  outline = (CF2_Outline)callbacks;
+    PS_Builder*  builder;
 
 
     FT_ASSERT( outline && outline->decoder );
@@ -165,9 +165,9 @@
     {
       /* record the move before the line; also check points and set */
       /* `path_begun'                                               */
-      error = cff_builder_start_point( builder,
-                                       params->pt0.x,
-                                       params->pt0.y );
+      error = ps_builder_start_point( builder,
+                                      params->pt0.x,
+                                      params->pt0.y );
       if ( error )
       {
         if ( !*callbacks->error )
@@ -176,10 +176,10 @@
       }
     }
 
-    /* `cff_builder_add_point1' includes a check_points call for one point */
-    error = cff_builder_add_point1( builder,
-                                    params->pt1.x,
-                                    params->pt1.y );
+    /* `ps_builder_add_point1' includes a check_points call for one point */
+    error = ps_builder_add_point1( builder,
+                                   params->pt1.x,
+                                   params->pt1.y );
     if ( error )
     {
       if ( !*callbacks->error )
@@ -196,8 +196,8 @@
     FT_Error  error;
 
     /* downcast the object pointer */
-    CF2_Outline   outline = (CF2_Outline)callbacks;
-    CFF_Builder*  builder;
+    CF2_Outline  outline = (CF2_Outline)callbacks;
+    PS_Builder*  builder;
 
 
     FT_ASSERT( outline && outline->decoder );
@@ -209,9 +209,9 @@
     {
       /* record the move before the line; also check points and set */
       /* `path_begun'                                               */
-      error = cff_builder_start_point( builder,
-                                       params->pt0.x,
-                                       params->pt0.y );
+      error = ps_builder_start_point( builder,
+                                      params->pt0.x,
+                                      params->pt0.y );
       if ( error )
       {
         if ( !*callbacks->error )
@@ -221,7 +221,7 @@
     }
 
     /* prepare room for 3 points: 2 off-curve, 1 on-curve */
-    error = cff_check_points( builder, 3 );
+    error = ps_builder_check_points( builder, 3 );
     if ( error )
     {
       if ( !*callbacks->error )
@@ -229,15 +229,15 @@
       return;
     }
 
-    cff_builder_add_point( builder,
-                           params->pt1.x,
-                           params->pt1.y, 0 );
-    cff_builder_add_point( builder,
-                           params->pt2.x,
-                           params->pt2.y, 0 );
-    cff_builder_add_point( builder,
-                           params->pt3.x,
-                           params->pt3.y, 1 );
+    ps_builder_add_point( builder,
+                          params->pt1.x,
+                          params->pt1.y, 0 );
+    ps_builder_add_point( builder,
+                          params->pt2.x,
+                          params->pt2.y, 0 );
+    ps_builder_add_point( builder,
+                          params->pt3.x,
+                          params->pt3.y, 1 );
   }
 
 
@@ -259,11 +259,11 @@
 
   /* get scaling and hint flag from GlyphSlot */
   static void
-  cf2_getScaleAndHintFlag( CFF_Decoder*  decoder,
-                           CF2_Fixed*    x_scale,
-                           CF2_Fixed*    y_scale,
-                           FT_Bool*      hinted,
-                           FT_Bool*      scaled )
+  cf2_getScaleAndHintFlag( PS_Decoder*  decoder,
+                           CF2_Fixed*   x_scale,
+                           CF2_Fixed*   y_scale,
+                           FT_Bool*     hinted,
+                           FT_Bool*     scaled )
   {
     FT_ASSERT( decoder && decoder->builder.glyph );
 
@@ -290,7 +290,7 @@
   /* get units per em from `FT_Face' */
   /* TODO: should handle font matrix concatenation? */
   static FT_UShort
-  cf2_getUnitsPerEm( CFF_Decoder*  decoder )
+  cf2_getUnitsPerEm( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->builder.face );
     FT_ASSERT( decoder->builder.face->root.units_per_EM );
@@ -301,9 +301,9 @@
 
   /* Main entry point: Render one glyph. */
   FT_LOCAL_DEF( FT_Error )
-  cf2_decoder_parse_charstrings( CFF_Decoder*  decoder,
-                                 FT_Byte*      charstring_base,
-                                 FT_ULong      charstring_len )
+  cf2_decoder_parse_charstrings( PS_Decoder*  decoder,
+                                 FT_Byte*     charstring_base,
+                                 FT_ULong     charstring_len )
   {
     FT_Memory  memory;
     FT_Error   error = FT_Err_Ok;
@@ -344,8 +344,8 @@
     {
       /* build parameters for Adobe engine */
 
-      CFF_Builder*  builder = &decoder->builder;
-      CFF_Driver    driver  = (CFF_Driver)FT_FACE_DRIVER( builder->face );
+      PS_Builder*  builder = &decoder->builder;
+      CFF_Driver   driver  = (CFF_Driver)FT_FACE_DRIVER( builder->face );
 
       FT_Bool  no_stem_darkening_driver =
                  driver->no_stem_darkening;
@@ -423,7 +423,7 @@
 
   /* get pointer to current FreeType subfont (based on current glyphID) */
   FT_LOCAL_DEF( CFF_SubFont )
-  cf2_getSubfont( CFF_Decoder*  decoder )
+  cf2_getSubfont( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -433,7 +433,7 @@
 
   /* get pointer to VStore structure */
   FT_LOCAL_DEF( CFF_VStore )
-  cf2_getVStore( CFF_Decoder*  decoder )
+  cf2_getVStore( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->cff );
 
@@ -443,7 +443,7 @@
 
   /* get maxstack value from CFF2 Top DICT */
   FT_LOCAL_DEF( FT_UInt )
-  cf2_getMaxstack( CFF_Decoder*  decoder )
+  cf2_getMaxstack( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->cff );
 
@@ -457,7 +457,7 @@
   /*                                                          */
   /* Note: Uses FT_Fixed not CF2_Fixed for the vector.        */
   FT_LOCAL_DEF( FT_Error )
-  cf2_getNormalizedVector( CFF_Decoder*  decoder,
+  cf2_getNormalizedVector( PS_Decoder*  decoder,
                            CF2_UInt     *len,
                            FT_Fixed*    *vec )
   {
@@ -477,7 +477,7 @@
 
   /* get `y_ppem' from `CFF_Size' */
   FT_LOCAL_DEF( CF2_Fixed )
-  cf2_getPpemY( CFF_Decoder*  decoder )
+  cf2_getPpemY( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder                          &&
                decoder->builder.face            &&
@@ -501,7 +501,7 @@
   /* FreeType stores these as integer font units       */
   /* (note: variable names seem swapped)               */
   FT_LOCAL_DEF( CF2_Fixed )
-  cf2_getStdVW( CFF_Decoder*  decoder )
+  cf2_getStdVW( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -511,7 +511,7 @@
 
 
   FT_LOCAL_DEF( CF2_Fixed )
-  cf2_getStdHW( CFF_Decoder*  decoder )
+  cf2_getStdHW( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -522,10 +522,10 @@
 
   /* note: FreeType stores 1000 times the actual value for `BlueScale' */
   FT_LOCAL_DEF( void )
-  cf2_getBlueMetrics( CFF_Decoder*  decoder,
-                      CF2_Fixed*    blueScale,
-                      CF2_Fixed*    blueShift,
-                      CF2_Fixed*    blueFuzz )
+  cf2_getBlueMetrics( PS_Decoder*  decoder,
+                      CF2_Fixed*   blueScale,
+                      CF2_Fixed*   blueShift,
+                      CF2_Fixed*   blueFuzz )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -542,9 +542,9 @@
   /* get blue values counts and arrays; the FreeType parser has validated */
   /* the counts and verified that each is an even number                  */
   FT_LOCAL_DEF( void )
-  cf2_getBlueValues( CFF_Decoder*  decoder,
-                     size_t*       count,
-                     FT_Pos*      *data )
+  cf2_getBlueValues( PS_Decoder*  decoder,
+                     size_t*      count,
+                     FT_Pos*     *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -555,9 +555,9 @@
 
 
   FT_LOCAL_DEF( void )
-  cf2_getOtherBlues( CFF_Decoder*  decoder,
-                     size_t*       count,
-                     FT_Pos*      *data )
+  cf2_getOtherBlues( PS_Decoder*  decoder,
+                     size_t*      count,
+                     FT_Pos*     *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -568,9 +568,9 @@
 
 
   FT_LOCAL_DEF( void )
-  cf2_getFamilyBlues( CFF_Decoder*  decoder,
-                      size_t*       count,
-                      FT_Pos*      *data )
+  cf2_getFamilyBlues( PS_Decoder*  decoder,
+                      size_t*      count,
+                      FT_Pos*     *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -581,9 +581,9 @@
 
 
   FT_LOCAL_DEF( void )
-  cf2_getFamilyOtherBlues( CFF_Decoder*  decoder,
-                           size_t*       count,
-                           FT_Pos*      *data )
+  cf2_getFamilyOtherBlues( PS_Decoder*  decoder,
+                           size_t*      count,
+                           FT_Pos*     *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -594,7 +594,7 @@
 
 
   FT_LOCAL_DEF( CF2_Int )
-  cf2_getLanguageGroup( CFF_Decoder*  decoder )
+  cf2_getLanguageGroup( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -605,9 +605,9 @@
   /* convert unbiased subroutine index to `CF2_Buffer' and */
   /* return 0 on success                                   */
   FT_LOCAL_DEF( CF2_Int )
-  cf2_initGlobalRegionBuffer( CFF_Decoder*  decoder,
-                              CF2_Int       subrNum,
-                              CF2_Buffer    buf )
+  cf2_initGlobalRegionBuffer( PS_Decoder*  decoder,
+                              CF2_Int      subrNum,
+                              CF2_Buffer   buf )
   {
     CF2_UInt  idx;
 
@@ -633,9 +633,9 @@
   /* convert AdobeStandardEncoding code to CF2_Buffer; */
   /* used for seac component                           */
   FT_LOCAL_DEF( FT_Error )
-  cf2_getSeacComponent( CFF_Decoder*  decoder,
-                        CF2_Int       code,
-                        CF2_Buffer    buf )
+  cf2_getSeacComponent( PS_Decoder*  decoder,
+                        CF2_Int      code,
+                        CF2_Buffer   buf )
   {
     CF2_Int   gid;
     FT_Byte*  charstring;
@@ -680,8 +680,8 @@
 
 
   FT_LOCAL_DEF( void )
-  cf2_freeSeacComponent( CFF_Decoder*  decoder,
-                         CF2_Buffer    buf )
+  cf2_freeSeacComponent( PS_Decoder*  decoder,
+                         CF2_Buffer   buf )
   {
     FT_ASSERT( decoder );
 
@@ -692,9 +692,9 @@
 
 
   FT_LOCAL_DEF( CF2_Int )
-  cf2_initLocalRegionBuffer( CFF_Decoder*  decoder,
-                             CF2_Int       subrNum,
-                             CF2_Buffer    buf )
+  cf2_initLocalRegionBuffer( PS_Decoder*  decoder,
+                             CF2_Int      subrNum,
+                             CF2_Buffer   buf )
   {
     CF2_UInt  idx;
 
@@ -718,7 +718,7 @@
 
 
   FT_LOCAL_DEF( CF2_Fixed )
-  cf2_getDefaultWidthX( CFF_Decoder*  decoder )
+  cf2_getDefaultWidthX( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -728,7 +728,7 @@
 
 
   FT_LOCAL_DEF( CF2_Fixed )
-  cf2_getNominalWidthX( CFF_Decoder*  decoder )
+  cf2_getNominalWidthX( PS_Decoder*  decoder )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
@@ -740,7 +740,7 @@
   FT_LOCAL_DEF( void )
   cf2_outline_reset( CF2_Outline  outline )
   {
-    CFF_Decoder*  decoder = outline->decoder;
+    PS_Decoder*  decoder = outline->decoder;
 
 
     FT_ASSERT( decoder );
@@ -754,12 +754,12 @@
   FT_LOCAL_DEF( void )
   cf2_outline_close( CF2_Outline  outline )
   {
-    CFF_Decoder*  decoder = outline->decoder;
+    PS_Decoder*  decoder = outline->decoder;
 
 
     FT_ASSERT( decoder );
 
-    cff_builder_close_contour( &decoder->builder );
+    ps_builder_close_contour( &decoder->builder );
 
     FT_GlyphLoader_Add( decoder->builder.loader );
   }
diff --git a/src/psaux/psft.h b/src/psaux/psft.h
index bbb2cf7..1628970 100644
--- a/src/psaux/psft.h
+++ b/src/psaux/psft.h
@@ -50,85 +50,85 @@
 #include FT_SYSTEM_H
 
 #include "psglue.h"
-#include FT_INTERNAL_POSTSCRIPT_AUX_H    /* for CFF_Decoder */
+#include FT_INTERNAL_POSTSCRIPT_AUX_H    /* for PS_Decoder */
 
 
 FT_BEGIN_HEADER
 
 
   FT_LOCAL( FT_Error )
-  cf2_decoder_parse_charstrings( CFF_Decoder*  decoder,
-                                 FT_Byte*      charstring_base,
-                                 FT_ULong      charstring_len );
+  cf2_decoder_parse_charstrings( PS_Decoder*  decoder,
+                                 FT_Byte*     charstring_base,
+                                 FT_ULong     charstring_len );
 
   FT_LOCAL( CFF_SubFont )
-  cf2_getSubfont( CFF_Decoder*  decoder );
+  cf2_getSubfont( PS_Decoder*  decoder );
 
   FT_LOCAL( CFF_VStore )
-  cf2_getVStore( CFF_Decoder*  decoder );
+  cf2_getVStore( PS_Decoder*  decoder );
 
   FT_LOCAL( FT_UInt )
-  cf2_getMaxstack( CFF_Decoder*  decoder );
+  cf2_getMaxstack( PS_Decoder*  decoder );
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
   FT_LOCAL( FT_Error )
-  cf2_getNormalizedVector( CFF_Decoder*  decoder,
-                           CF2_UInt     *len,
-                           FT_Fixed*    *vec );
+  cf2_getNormalizedVector( PS_Decoder*  decoder,
+                           CF2_UInt    *len,
+                           FT_Fixed*   *vec );
 #endif
 
   FT_LOCAL( CF2_Fixed )
-  cf2_getPpemY( CFF_Decoder*  decoder );
+  cf2_getPpemY( PS_Decoder*  decoder );
   FT_LOCAL( CF2_Fixed )
-  cf2_getStdVW( CFF_Decoder*  decoder );
+  cf2_getStdVW( PS_Decoder*  decoder );
   FT_LOCAL( CF2_Fixed )
-  cf2_getStdHW( CFF_Decoder*  decoder );
+  cf2_getStdHW( PS_Decoder*  decoder );
 
   FT_LOCAL( void )
-  cf2_getBlueMetrics( CFF_Decoder*  decoder,
-                      CF2_Fixed*    blueScale,
-                      CF2_Fixed*    blueShift,
-                      CF2_Fixed*    blueFuzz );
+  cf2_getBlueMetrics( PS_Decoder*  decoder,
+                      CF2_Fixed*   blueScale,
+                      CF2_Fixed*   blueShift,
+                      CF2_Fixed*   blueFuzz );
   FT_LOCAL( void )
-  cf2_getBlueValues( CFF_Decoder*  decoder,
-                     size_t*       count,
-                     FT_Pos*      *data );
+  cf2_getBlueValues( PS_Decoder*  decoder,
+                     size_t*      count,
+                     FT_Pos*     *data );
   FT_LOCAL( void )
-  cf2_getOtherBlues( CFF_Decoder*  decoder,
-                     size_t*       count,
-                     FT_Pos*      *data );
+  cf2_getOtherBlues( PS_Decoder*  decoder,
+                     size_t*      count,
+                     FT_Pos*     *data );
   FT_LOCAL( void )
-  cf2_getFamilyBlues( CFF_Decoder*  decoder,
-                      size_t*       count,
-                      FT_Pos*      *data );
+  cf2_getFamilyBlues( PS_Decoder*  decoder,
+                      size_t*      count,
+                      FT_Pos*     *data );
   FT_LOCAL( void )
-  cf2_getFamilyOtherBlues( CFF_Decoder*  decoder,
-                           size_t*       count,
-                           FT_Pos*      *data );
+  cf2_getFamilyOtherBlues( PS_Decoder*  decoder,
+                           size_t*      count,
+                           FT_Pos*     *data );
 
   FT_LOCAL( CF2_Int )
-  cf2_getLanguageGroup( CFF_Decoder*  decoder );
+  cf2_getLanguageGroup( PS_Decoder*  decoder );
 
   FT_LOCAL( CF2_Int )
-  cf2_initGlobalRegionBuffer( CFF_Decoder*  decoder,
-                              CF2_Int       subrNum,
-                              CF2_Buffer    buf );
+  cf2_initGlobalRegionBuffer( PS_Decoder*  decoder,
+                              CF2_Int      subrNum,
+                              CF2_Buffer   buf );
   FT_LOCAL( FT_Error )
-  cf2_getSeacComponent( CFF_Decoder*  decoder,
-                        CF2_Int       code,
-                        CF2_Buffer    buf );
+  cf2_getSeacComponent( PS_Decoder*  decoder,
+                        CF2_Int      code,
+                        CF2_Buffer   buf );
   FT_LOCAL( void )
-  cf2_freeSeacComponent( CFF_Decoder*  decoder,
-                         CF2_Buffer    buf );
+  cf2_freeSeacComponent( PS_Decoder*  decoder,
+                         CF2_Buffer   buf );
   FT_LOCAL( CF2_Int )
-  cf2_initLocalRegionBuffer( CFF_Decoder*  decoder,
-                             CF2_Int       subrNum,
-                             CF2_Buffer    buf );
+  cf2_initLocalRegionBuffer( PS_Decoder*  decoder,
+                             CF2_Int      subrNum,
+                             CF2_Buffer   buf );
 
   FT_LOCAL( CF2_Fixed )
-  cf2_getDefaultWidthX( CFF_Decoder*  decoder );
+  cf2_getDefaultWidthX( PS_Decoder*  decoder );
   FT_LOCAL( CF2_Fixed )
-  cf2_getNominalWidthX( CFF_Decoder*  decoder );
+  cf2_getNominalWidthX( PS_Decoder*  decoder );
 
 
   /*
@@ -139,7 +139,7 @@ FT_BEGIN_HEADER
   typedef struct  CF2_OutlineRec_
   {
     CF2_OutlineCallbacksRec  root;        /* base class must be first */
-    CFF_Decoder*             decoder;
+    PS_Decoder*              decoder;
 
   } CF2_OutlineRec, *CF2_Outline;
 
diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index 1629d7b..d342d6a 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -476,7 +476,7 @@
     FT_Error  lastError = FT_Err_Ok;
 
     /* pointer to parsed font object */
-    CFF_Decoder*  decoder = font->decoder;
+    PS_Decoder*  decoder = font->decoder;
 
     FT_Error*  error  = &font->error;
     FT_Memory  memory = font->memory;