Commit c31286153ab17cb67c3732e497abf6969b7a2da4

David Turner 2000-06-23T05:02:13

bugfixes in the Type1 drivers

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
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index aea6b32..37f752c 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -133,14 +133,10 @@
     psnames = (PSNames_Interface*)face->psnames;
     if ( !psnames )
     {
-      /* look-up the PSNames driver */
-      FT_Module  psnames_module;
-
-      psnames_module = FT_Get_Module( face->root.driver->root.library,
-                                      "psnames" );
-      if (psnames_module)                                      
-        face->psnames = (PSNames_Interface*)
-                          (psnames_module->clazz->module_interface);
+      psnames = (PSNames_Interface*)
+                FT_Get_Module_Interface( FT_FACE_LIBRARY(face), "psnames" );
+
+      face->psnames = psnames;
     }
 
     /* open the tokenizer; this will also check the font format */
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 1d455cc..4d8ad4b 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -195,7 +195,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    Load_Simple_Glyph                                                  */
+  /*    TT_Load_Simple_Glyph                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Loads a simple (i.e, non-composite) glyph.  This function is used  */
@@ -203,18 +203,16 @@
   /*    glyphs elements will be loaded with this routine.                  */
   /*                                                                       */
   static
-  FT_Error  Load_Simple( TT_Loader*  load,
-                         FT_UInt     byte_count,
-                         FT_Int      n_contours,
-                         FT_Bool     debug )
+  FT_Error  TT_Load_Simple_Glyph( TT_Loader*  load,
+                                  FT_UInt     byte_count,
+                                  FT_Int      n_contours )
   {
     FT_Error         error;
     FT_Stream        stream  = load->stream;
     FT_GlyphLoader*  gloader = load->gloader;
     FT_Outline*      outline;
-    TT_GlyphZone*    zone    = &load->zone;
-    TT_Face          face    = load->face;
-
+    TT_Face          face    = (TT_Face)load->face;
+    TT_GlyphSlot     slot    = (TT_GlyphSlot)load->glyph;
     FT_UShort        n_ins;
     FT_Int           n, n_points;
 
@@ -242,8 +240,10 @@
 
 
     /* reading the bytecode instructions */
+    slot->control_len  = 0;
+    slot->control_data = 0;
+    
     n_ins = GET_UShort();
-    load->face->root.glyph->control_len = n_ins;
 
     FT_TRACE5(( "  Instructions size: %d\n", n_ins ));
 
@@ -263,14 +263,13 @@
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
     if ( ( load->load_flags                               &
-         ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) ) == 0 )
+         ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) ) == 0 &&
+           load->instructions )
     {
-      MEM_Copy( load->exec->glyphIns, stream->cursor, n_ins );
-
-      error = TT_Set_CodeRange( load->exec, tt_coderange_glyph,
-                                load->exec->glyphIns, n_ins );
-      if ( error )
-        goto Fail;
+      slot->control_len  = n_ins;
+      slot->control_data = load->instructions;
+      
+      MEM_Copy( load->instructions, stream->cursor, n_ins );
     }
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
@@ -352,6 +351,46 @@
 
     FORGET_Frame();
 
+    /* clear the touch tags */
+    for ( n = 0; n < n_points; n++ )
+      outline->tags[n] &= FT_Curve_Tag_On;
+
+    outline->n_points   = n_points;
+    outline->n_contours = n_contours;
+          
+    return error;
+
+  Fail:
+    FORGET_Frame();
+    return error;
+  }
+
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    TT_Process_Simple_Glyph                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Once a simple glyph has been loaded, it needs to be processed.     */
+  /*    Usually, this means scaling and hinting through bytecode           */
+  /*    interpretation..                                                   */
+  /*                                                                       */
+  static
+  FT_Error   TT_Process_Simple_Glyph( TT_Loader*  load,
+                                      FT_Bool     debug )
+  {
+    FT_GlyphLoader*  gloader  = load->gloader;
+    FT_Outline*      outline  = &gloader->current.outline;
+    FT_UInt          n_points = outline->n_points;
+    FT_UInt          n_ins;
+    TT_GlyphZone*    zone     = &load->zone;
+    FT_Error         error    = FT_Err_Ok;
+
+    n_ins = load->glyph->control_len;
+
     /* add shadow points */
 
     /* Now add the two shadow points at n and n + 1.    */
@@ -361,7 +400,6 @@
       FT_Vector*  pp1;
       FT_Vector*  pp2;
 
-
       /* pp1 = xMin - lsb */
       pp1    = outline->points + n_points;
       pp1->x = load->bbox.xMin - load->left_bearing;
@@ -372,10 +410,6 @@
       pp2->x = pp1->x + load->advance;
       pp2->y = 0;
 
-      /* clear the touch tags */
-      for ( n = 0; n < n_points; n++ )
-        outline->tags[n] &= FT_Curve_Tag_On;
-
       outline->tags[n_points    ] = 0;
       outline->tags[n_points + 1] = 0;
     }
@@ -383,8 +417,6 @@
     /* Note that we return two more points that are not */
     /* part of the glyph outline.                       */
 
-    outline->n_points   = n_points;
-    outline->n_contours = n_contours;
     n_points           += 2;
 
     /* set up zone for hinting */
@@ -395,8 +427,8 @@
     {
       FT_Vector*  vec     = zone->cur;
       FT_Vector*  limit   = vec + n_points;
-      FT_Fixed    x_scale = load->size->root.metrics.x_scale;
-      FT_Fixed    y_scale = load->size->root.metrics.y_scale;
+      FT_Fixed    x_scale = load->size->metrics.x_scale;
+      FT_Fixed    y_scale = load->size->metrics.y_scale;
 
       /* first scale the glyph points */
       for ( ; vec < limit; vec++ )
@@ -424,6 +456,10 @@
       /* now consider hinting */
       if ( n_ins > 0 )
       {
+        error = TT_Set_CodeRange( load->exec, tt_coderange_glyph,
+                                  load->exec->glyphIns, n_ins );
+        if ( error ) goto Exit;
+          
         load->exec->is_composite     = FALSE;
         load->exec->pedantic_hinting = (FT_Bool)(load->load_flags &
                                                  FT_LOAD_PEDANTIC);
@@ -432,7 +468,9 @@
 
         error = TT_Run_Context( load->exec, debug );
         if ( error && load->exec->pedantic_hinting )
-          return error;
+          goto Exit;
+          
+        error = FT_Err_Ok;  /* ignore bytecode errors in non-pedantic mode */
       }
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
     }
@@ -444,14 +482,113 @@
       load->pp2 = zone->cur[n_points - 1];
     }
 
-    return FT_Err_Ok;
+  Exit:
+    return error;
+  }
+
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    TT_Load_Composite_Glyph                                            */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Loads a composite glyph.                                           */
+  /*                                                                       */
+  static
+  FT_Error  TT_Load_Composite_Glyph( TT_Loader*  loader,
+                                     FT_UInt     byte_count )
+  {
+    FT_Error         error;
+    FT_Stream        stream = loader->stream;
+    FT_GlyphLoader*  gloader   = loader->gloader;
+    FT_SubGlyph*     subglyph;
+    FT_UInt          num_subglyphs;
+
+    if ( ACCESS_Frame( byte_count ) )
+      goto Fail;
+
+    num_subglyphs = 0;
+    do
+    {
+      FT_Fixed  xx, xy, yy, yx;
+
+      /* check that we can load a new subglyph */
+      error = FT_GlyphLoader_Check_Subglyphs( gloader, num_subglyphs+1 );
+      if (error) goto Fail;
+      
+      subglyph = gloader->current.subglyphs + num_subglyphs;
+
+      subglyph->arg1 = subglyph->arg2 = 0;
+
+      subglyph->flags = GET_UShort();
+      subglyph->index = GET_UShort();
+
+      /* read arguments */
+      if ( subglyph->flags & ARGS_ARE_WORDS )
+      {
+        subglyph->arg1 = GET_Short();
+        subglyph->arg2 = GET_Short();
+      }
+      else
+      {
+        subglyph->arg1 = GET_Char();
+        subglyph->arg2 = GET_Char();
+      }
+
+      /* read transform */
+      xx = yy = 0x10000L;
+      xy = yx = 0;
+
+      if ( subglyph->flags & WE_HAVE_A_SCALE )
+      {
+        xx = (FT_Fixed)GET_Short() << 2;
+        yy = xx;
+      }
+      else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
+      {
+        xx = (FT_Fixed)GET_Short() << 2;
+        yy = (FT_Fixed)GET_Short() << 2;
+      }
+      else if ( subglyph->flags & WE_HAVE_A_2X2 )
+      {
+        xx = (FT_Fixed)GET_Short() << 2;
+        xy = (FT_Fixed)GET_Short() << 2;
+        yx = (FT_Fixed)GET_Short() << 2;
+        yy = (FT_Fixed)GET_Short() << 2;
+      }
+
+      subglyph->transform.xx = xx;
+      subglyph->transform.xy = xy;
+      subglyph->transform.yx = yx;
+      subglyph->transform.yy = yy;
+
+      num_subglyphs++;
+    }
+    while (subglyph->flags & MORE_COMPONENTS);
+
+    gloader->current.num_subglyphs = num_subglyphs;
+
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+    {
+      /* we must undo the ACCESS_Frame in order to point to the */
+      /* composite instructions, if we find some.               */
+      /* we will process them later...                          */
+      /*                                                        */
+      loader->ins_pos = FILE_Pos() + stream->cursor - stream->limit;
+    }
+#endif
 
-  Fail:
     FORGET_Frame();
+
+  Fail:
     return error;
   }
 
 
+
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -467,9 +604,9 @@
   {
     FT_Stream        stream = loader->stream;
     FT_Error         error;
-    TT_Face          face   = loader->face;
+    TT_Face          face   = (TT_Face)loader->face;
     FT_ULong         offset;
-    FT_Int           num_subglyphs = 0, contours_count;
+    FT_Int           contours_count;
     FT_UInt          index, num_points, num_contours, count;
     FT_Fixed         x_scale, y_scale;
     FT_ULong         ins_offset;
@@ -493,8 +630,8 @@
     y_scale = 0x10000L;
     if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
     {
-      x_scale = loader->size->root.metrics.x_scale;
-      y_scale = loader->size->root.metrics.y_scale;
+      x_scale = loader->size->metrics.x_scale;
+      y_scale = loader->size->metrics.y_scale;
     }
 
     /* get horizontal metrics */
@@ -589,14 +726,17 @@
       error = FT_GlyphLoader_Check_Points( gloader, 0, contours_count );
       if (error) goto Fail;
 
+      error = TT_Load_Simple_Glyph( loader, count, contours_count );
+      if (error) goto Fail;
+      
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-      error = Load_Simple( loader,
-                           count,
-                           contours_count,
-                           (FT_Bool)( loader->size &&
-                                      loader->size->debug ) );
+      {
+        TT_Size size = (TT_Size)loader->size;
+        error = TT_Process_Simple_Glyph( loader,
+                                         (FT_Bool)( size && size->debug ) );
+      }
 #else
-      error = Load_Simple( loader, count, contours_count, 0 );
+      error = Process_Simple_Glyph( loader, 0 );
 #endif
       if ( error ) goto Fail;
 
@@ -613,89 +753,16 @@
     /* otherwise, load a composite! */
     else
     {
+      TT_GlyphSlot  glyph = (TT_GlyphSlot)loader->glyph;
+      FT_UInt       start_point, start_contour;
+      
       /* for each subglyph, read composite header */
-      TT_GlyphSlot     glyph     = loader->glyph;
-      FT_SubGlyph*     subglyph;
-      FT_UInt          num_base_subgs;
-      FT_UInt          start_point, start_contour;
-
       start_point   = gloader->base.outline.n_points;
       start_contour = gloader->base.outline.n_contours;
+    
       
-      if ( ACCESS_Frame( count ) )
-        goto Fail;
-
-      num_subglyphs = 0;
-      do
-      {
-        FT_Fixed  xx, xy, yy, yx;
-
-        /* check that we can load a new subglyph */
-        error = FT_GlyphLoader_Check_Subglyphs( gloader, num_subglyphs+1 );
-        if (error) goto Fail;
-        
-        subglyph = gloader->current.subglyphs + num_subglyphs;
-
-        subglyph->arg1 = subglyph->arg2 = 0;
-
-        subglyph->flags = GET_UShort();
-        subglyph->index = GET_UShort();
-
-        /* read arguments */
-        if ( subglyph->flags & ARGS_ARE_WORDS )
-        {
-          subglyph->arg1 = GET_Short();
-          subglyph->arg2 = GET_Short();
-        }
-        else
-        {
-          subglyph->arg1 = GET_Char();
-          subglyph->arg2 = GET_Char();
-        }
-
-        /* read transform */
-        xx = yy = 0x10000L;
-        xy = yx = 0;
-
-        if ( subglyph->flags & WE_HAVE_A_SCALE )
-        {
-          xx = (FT_Fixed)GET_Short() << 2;
-          yy = xx;
-        }
-        else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
-        {
-          xx = (FT_Fixed)GET_Short() << 2;
-          yy = (FT_Fixed)GET_Short() << 2;
-        }
-        else if ( subglyph->flags & WE_HAVE_A_2X2 )
-        {
-          xx = (FT_Fixed)GET_Short() << 2;
-          xy = (FT_Fixed)GET_Short() << 2;
-          yx = (FT_Fixed)GET_Short() << 2;
-          yy = (FT_Fixed)GET_Short() << 2;
-        }
-
-        subglyph->transform.xx = xx;
-        subglyph->transform.xy = xy;
-        subglyph->transform.yx = yx;
-        subglyph->transform.yy = yy;
-
-        num_subglyphs++;
-      }
-      while (subglyph->flags & MORE_COMPONENTS);
-
-      gloader->current.num_subglyphs = num_subglyphs;
-      
-#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-      {
-        /* we must undo the ACCESS_Frame in order to point to the */
-        /* composite instructions, if we find some.               */
-        /* we will process them later...                          */
-        /*                                                        */
-        ins_offset = FILE_Pos() + stream->cursor - stream->limit;
-      }
-#endif
-      FORGET_Frame();
+      error = TT_Load_Composite_Glyph( loader, count );
+      if (error) goto Fail;
 
       /* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
       /* `as is' in the glyph slot (the client application will be     */
@@ -721,10 +788,13 @@
       /*********************************************************************/
       /* Now, read each subglyph independently..                           */
       {
-        FT_Int  n, num_base_points, num_new_points;
-
-        num_base_subgs = gloader->base.num_subglyphs;
+        FT_Int        n, num_base_points, num_new_points;
+        FT_SubGlyph*  subglyph;
         
+        FT_UInt num_subglyphs  = gloader->current.num_subglyphs;
+        FT_UInt num_base_subgs = gloader->base.num_subglyphs;
+        
+
         FT_GlyphLoader_Add( gloader );
         
         for ( n = 0; n < num_subglyphs; n++ )
@@ -838,6 +908,7 @@
 
         if ( num_subglyphs > 0               &&
              loader->exec                    &&
+             loader->ins_pos > 0             &&
              subglyph->flags & WE_HAVE_INSTR )
         {
           FT_UShort       n_ins;
@@ -848,28 +919,30 @@
 
 
           /* read size of instructions */
-          if ( FILE_Seek( ins_offset ) ||
-               READ_UShort(n_ins)      )
+          if ( FILE_Seek( loader->ins_pos ) ||
+               READ_UShort(n_ins)         )
             goto Fail;
           FT_TRACE5(( "  Instructions size = %d\n", n_ins ));
 
+          /* in some fonts ?? */
+          if (n_ins == 0xFFFF)
+            n_ins = 0;
+
           /* check it */
           if ( n_ins > face->max_profile.maxSizeOfInstructions )
           {
-            FT_TRACE0(( "Too many instructions in composite glyph %ld\n",
-                        subglyph->index ));
+            FT_TRACE0(( "Too many instructions (%d) in composite glyph %ld\n",
+                        n_ins, subglyph->index ));
             return TT_Err_Too_Many_Ins;
           }
 
-          if ( exec )
-          {
-            /* XXX */
-          }
-
           /* read the instructions */
           if ( FILE_Read( exec->glyphIns, n_ins ) )
             goto Fail;
 
+          glyph->control_data = exec->glyphIns;
+          glyph->control_len  = n_ins;
+
           error = TT_Set_CodeRange( exec,
                                     tt_coderange_glyph,
                                     exec->glyphIns,
@@ -916,7 +989,7 @@
             exec->pedantic_hinting =
                 (FT_Bool)(loader->load_flags & FT_LOAD_PEDANTIC);
 
-            error = TT_Run_Context( exec, loader->size->debug );
+            error = TT_Run_Context( exec, ((TT_Size)loader->size)->debug );
             if ( error && exec->pedantic_hinting )
               goto Fail;
           }
@@ -948,10 +1021,10 @@
                                FT_UInt     glyph_index )
   {
     FT_BBox       bbox;
-    TT_Face       face = loader->face;
+    TT_Face       face = (TT_Face)loader->face;
     FT_Fixed      x_scale, y_scale;
     TT_GlyphSlot  glyph = loader->glyph;
-    TT_Size       size = loader->size;
+    TT_Size       size = (TT_Size)loader->size;
 
     x_scale = 0x10000L;
     y_scale = 0x10000L;
@@ -1267,6 +1340,7 @@
         return TT_Err_Could_Not_Find_Context;
 
       TT_Load_Context( loader.exec, face, size );
+      loader.instructions = loader.exec->glyphIns;
 
       /* load default graphics state - if needed */
       if ( size->GS.instruct_control & 2 )
@@ -1285,12 +1359,12 @@
 
     loader.load_flags    = load_flags;
 
-    loader.face   = face;
-    loader.size   = size;
-    loader.glyph  = glyph;
+    loader.face   = (FT_Face)face;
+    loader.size   = (FT_Size)size;
+    loader.glyph  = (FT_GlyphSlot)glyph;
     loader.stream = stream;
-
-    loader.glyf_offset = FILE_Pos();
+    
+    loader.glyf_offset  = FILE_Pos();
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index c20b4c6..a559f87 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -29,39 +29,6 @@
   extern "C" {
 #endif
 
-  typedef struct  TT_Loader_
-  {
-    TT_Face         face;
-    TT_Size         size;
-    TT_GlyphSlot    glyph;
-    FT_GlyphLoader* gloader;
-
-    FT_ULong        load_flags;
-    FT_UInt         glyph_index;
-
-    FT_Stream       stream;
-    FT_Int          byte_len;
-
-    FT_BBox         bbox;
-    FT_Int          left_bearing;
-    FT_Int          advance;
-    FT_Bool         preserve_pps;
-    FT_Vector       pp1;
-    FT_Vector       pp2;
-
-    FT_ULong        glyf_offset;
-
-    /* the zone where we load our glyphs */
-    TT_GlyphZone    base;
-    TT_GlyphZone    zone;
-
-#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-    TT_ExecContext  exec;
-    FT_Byte*        instructions;
-#endif
-
-  } TT_Loader;
-
 
   LOCAL_DEF
   void  TT_Get_Metrics( TT_HoriHeader*  header,
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index a9f900e..f160fd2 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -334,7 +334,6 @@
     {
       FT_Library  library = face->root.driver->root.library;
 
-
       face->interpreter = (TT_Interpreter)
                             library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
       if ( !face->interpreter )
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index 947be8c..ed189a6 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -106,44 +106,6 @@
 
   } TT_GraphicsState;
 
- /************************************************************************
-  *
-  *  <Struct>
-  *     TT_GlyphZone
-  *
-  *  <Description>
-  *     A glyph zone is used to load, scale and hint glyph outline
-  *     coordinates.
-  *
-  *  <Fields>
-  *     memory       :: handle to memory manager
-  *     max_points   :: max size in points of zone
-  *     max_contours :: max size in contours of zone
-  *     n_points     :: current number of points in zone
-  *     n_contours   :: current number of contours in zone
-  *     org          :: original glyph coordinates (font units/scaled)
-  *     cur          :: current glyph coordinates  (scaled/hinted)
-  *     tags         :: point control tags
-  *     contours     :: contour end points
-  *
-  ***********************************************************************/
-
-  typedef struct  TT_GlyphZone_
-  {
-    FT_Memory   memory;
-    FT_UShort   max_points;
-    FT_UShort   max_contours;
-    FT_UShort   n_points;   /* number of points in zone    */
-    FT_Short    n_contours; /* number of contours          */
-
-    FT_Vector*  org;        /* original point coordinates  */
-    FT_Vector*  cur;        /* current point coordinates   */
-
-    FT_Byte*    tags;       /* current touch flags         */
-    FT_UShort*  contours;   /* contour end points          */
-
-  } TT_GlyphZone;
-
   LOCAL_DEF void  TT_Done_GlyphZone( TT_GlyphZone*  zone );
 
   LOCAL_DEF FT_Error TT_New_GlyphZone( FT_Memory      memory,
@@ -335,16 +297,6 @@
   } TT_Size_Metrics;
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* FreeType execution context type.                                      */
-  /*                                                                       */
-  /* This is a forward declaration; the full specification is in the file  */
-  /* `ttinterp.h'.                                                         */
-  /*                                                                       */
-  typedef struct TT_ExecContextRec_*  TT_ExecContext;
-
-
   /***********************************************************************/
   /*                                                                     */
   /* TrueType size class.                                                */
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 49498fd..f8e4704 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -261,8 +261,9 @@
     {
       psnames = (PSNames_Interface*)
                  FT_Get_Module_Interface( FT_FACE_LIBRARY(face), "psnames" );
+                 
+      face->psnames = psnames;
     }
-    face->psnames = psnames;
     
     /* open the tokenizer, this will also check the font format */
     error = New_Tokenizer( stream, &tokenizer );
diff --git a/src/type1z/t1objs.c b/src/type1z/t1objs.c
index e4ef784..0bfa774 100644
--- a/src/type1z/t1objs.c
+++ b/src/type1z/t1objs.c
@@ -141,9 +141,13 @@
 
     psnames = (PSNames_Interface*)face->psnames;
     if (!psnames)
+    {
       psnames = (PSNames_Interface*)
                  FT_Get_Module_Interface( FT_FACE_LIBRARY(face), "psnames" );
 
+      face->psnames = psnames;
+    }
+
     /* open the tokenizer, this will also check the font format */
     error = T1_Open_Face( face );
     if (error) goto Exit;