Commit 8d1f6049933da50d1ee106f92ff05c2d1793c73f

Tom Kacvinsky 2001-01-03T00:21:59

Changed to use cffgload.{c,h} instead of t2gload.{c,h}. Also, all occurences of t2_ (T2_) were replaced with cff_ (CFF_, resp.).

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
diff --git a/src/cff/cff.c b/src/cff/cff.c
index 5af5698..2c6c1df 100644
--- a/src/cff/cff.c
+++ b/src/cff/cff.c
@@ -23,7 +23,7 @@
 #include FT_SOURCE_FILE(cff,cffparse.c)
 #include FT_SOURCE_FILE(cff,cffload.c)
 #include FT_SOURCE_FILE(cff,cffobjs.c)
-#include FT_SOURCE_FILE(cff,t2gload.c)
+#include FT_SOURCE_FILE(cff,cffgload.c)
 
 
 /* END */
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index f8853d6..f5a0814 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -25,7 +25,7 @@
 #include FT_INTERNAL_CFF_ERRORS_H
 
 #include FT_SOURCE_FILE(cff,cffdrivr.h)
-#include FT_SOURCE_FILE(cff,t2gload.h)
+#include FT_SOURCE_FILE(cff,cffgload.h)
 
 
   /*************************************************************************/
@@ -35,7 +35,7 @@
   /* messages during execution.                                            */
   /*                                                                       */
 #undef  FT_COMPONENT
-#define FT_COMPONENT  trace_t2driver
+#define FT_COMPONENT  trace_cffdriver
 
 
   /*************************************************************************/
@@ -98,7 +98,7 @@
 
 
     if ( !face )
-      return T2_Err_Invalid_Face_Handle;
+      return CFF_Err_Invalid_Face_Handle;
 
     kerning->x = 0;
     kerning->y = 0;
@@ -133,7 +133,7 @@
     }
 
   Exit:
-    return T2_Err_Ok;
+    return CFF_Err_Ok;
 
   Found:
     kerning->x = pair->value;
@@ -171,8 +171,8 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   static
-  FT_Error  Load_Glyph( T2_GlyphSlot  slot,
-                        T2_Size       size,
+  FT_Error  Load_Glyph( CFF_GlyphSlot  slot,
+                        CFF_Size       size,
                         FT_UShort     glyph_index,
                         FT_UInt       load_flags )
   {
@@ -180,7 +180,7 @@
 
 
     if ( !slot )
-      return T2_Err_Invalid_Glyph_Handle;
+      return CFF_Err_Invalid_Glyph_Handle;
 
     /* check whether we want a scaled outline or bitmap */
     if ( !size )
@@ -194,11 +194,11 @@
     {
       /* these two object must have the same parent */
       if ( size->face != slot->root.face )
-        return T2_Err_Invalid_Face_Handle;
+        return CFF_Err_Invalid_Face_Handle;
     }
 
     /* now load the glyph outline if necessary */
-    error = T2_Load_Glyph( slot, size, glyph_index, load_flags );
+    error = CFF_Load_Glyph( slot, size, glyph_index, load_flags );
 
     /* force drop-out mode to 2 - irrelevant now */
     /* slot->outline.dropout_mode = 2; */
@@ -235,16 +235,16 @@
   /*    Glyph index.  0 means `undefined character code'.                  */
   /*                                                                       */
   static
-  FT_UInt  t2_get_char_index( TT_CharMap  charmap,
+  FT_UInt  cff_get_char_index( TT_CharMap  charmap,
                               FT_Long     charcode )
   {
     FT_Error       error;
-    T2_Face        face;
+    CFF_Face        face;
     TT_CMapTable*  cmap;
 
 
     cmap = &charmap->cmap;
-    face = (T2_Face)charmap->root.face;
+    face = (CFF_Face)charmap->root.face;
 
     /* Load table if needed */
     if ( !cmap->loaded )
@@ -277,7 +277,7 @@
 
 
   static
-  FT_Module_Interface  t2_get_interface( T2_Driver    driver,
+  FT_Module_Interface  cff_get_interface( CFF_Driver    driver,
                                          const char*  interface )
   {
     FT_Module  sfnt;
@@ -298,25 +298,25 @@
     /* begin with the FT_Module_Class fields */
     {
       ft_module_font_driver | ft_module_driver_scalable,
-      sizeof( T2_DriverRec ),
+      sizeof( CFF_DriverRec ),
       "cff",
       0x10000L,
       0x20000L,
 
       0,   /* module-specific interface */
 
-      (FT_Module_Constructor)T2_Init_Driver,
-      (FT_Module_Destructor) T2_Done_Driver,
-      (FT_Module_Requester)  t2_get_interface,
+      (FT_Module_Constructor)CFF_Init_Driver,
+      (FT_Module_Destructor) CFF_Done_Driver,
+      (FT_Module_Requester)  cff_get_interface,
     },
 
     /* now the specific driver fields */
     sizeof( TT_FaceRec ),
     sizeof( FT_SizeRec ),
-    sizeof( T2_GlyphSlotRec ),
+    sizeof( CFF_GlyphSlotRec ),
 
-    (FTDriver_initFace)     T2_Init_Face,
-    (FTDriver_doneFace)     T2_Done_Face,
+    (FTDriver_initFace)     CFF_Init_Face,
+    (FTDriver_doneFace)     CFF_Done_Face,
     (FTDriver_initSize)     0,
     (FTDriver_doneSize)     0,
     (FTDriver_initGlyphSlot)0,
@@ -326,7 +326,7 @@
     (FTDriver_setPixelSizes)0,
 
     (FTDriver_loadGlyph)    Load_Glyph,
-    (FTDriver_getCharIndex) t2_get_char_index,
+    (FTDriver_getCharIndex) cff_get_char_index,
 
     (FTDriver_getKerning)   Get_Kerning,
     (FTDriver_attachFile)   0,
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 5ce05da..0fa8210 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -35,7 +35,7 @@
   /* messages during execution.                                            */
   /*                                                                       */
 #undef  FT_COMPONENT
-#define FT_COMPONENT  trace_t2load
+#define FT_COMPONENT  trace_cffload
 
 
   static
@@ -1257,7 +1257,7 @@
       }
     }
     else
-      error = T2_Err_Invalid_Argument;
+      error = CFF_Err_Invalid_Argument;
 
   Exit:
     return error;
@@ -1398,7 +1398,7 @@
       break;
 
     default:    /* hmm... that's wrong */
-      error = T2_Err_Invalid_File_Format;
+      error = CFF_Err_Invalid_File_Format;
     }
 
   Exit:
@@ -2112,7 +2112,7 @@
     {
       FT_ERROR(( "CFF_Load_Font: incorrect face index = %d\n",
                  face_index ));
-      error = T2_Err_Invalid_Argument;
+      error = CFF_Err_Invalid_Argument;
     }
 
     /* in case of a font format check, simply exit now */
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 321f417..cb2fe5c 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -39,7 +39,7 @@
   /* messages during execution.                                            */
   /*                                                                       */
 #undef  FT_COMPONENT
-#define FT_COMPONENT  trace_t2objs
+#define FT_COMPONENT  trace_cffobjs
 
 
   /*************************************************************************/
@@ -49,7 +49,7 @@
   /*************************************************************************/
 
   static
-  FT_String*  T2_StrCopy( FT_Memory         memory,
+  FT_String*  CFF_StrCopy( FT_Memory         memory,
                           const FT_String*  source )
   {
     FT_Error    error;
@@ -71,7 +71,7 @@
   /* this function is used to build a Unicode charmap from the glyph names */
   /* in a file                                                             */
   static
-  FT_Error  CFF_Build_Unicode_Charmap( T2_Face             face,
+  FT_Error  CFF_Build_Unicode_Charmap( CFF_Face             face,
                                        FT_ULong            base_offset,
                                        PSNames_Interface*  psnames )
   {
@@ -90,7 +90,7 @@
     if ( !charset_offset )
     {
       FT_ERROR(( "CFF_Build_Unicode_Charmap: charset table is missing\n" ));
-      error = T2_Err_Invalid_File_Format;
+      error = CFF_Err_Invalid_File_Format;
       goto Exit;
     }
 
@@ -118,7 +118,7 @@
           goto Fail;
 
         for ( ; gname < limit; gname++ )
-          gname[0] = T2_Get_String( &font->string_index,
+          gname[0] = CFF_Get_String( &font->string_index,
                                     GET_UShort(),
                                     psnames );
         FORGET_Frame();
@@ -155,7 +155,7 @@
 
           for ( ; count > 0; count-- )
           {
-            gname[0] = T2_Get_String( &font->string_index,
+            gname[0] = CFF_Get_String( &font->string_index,
                                       first,
                                       psnames );
             gname++;
@@ -167,7 +167,7 @@
 
     default:   /* unknown charset format! */
       FT_ERROR(( "CFF_Build_Unicode_Charmap: unknown charset format!\n" ));
-      error = T2_Err_Invalid_File_Format;
+      error = CFF_Err_Invalid_File_Format;
       goto Fail;
     }
 
@@ -239,7 +239,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    T2_Init_Face                                                       */
+  /*    CFF_Init_Face                                                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Initializes a given OpenType face object.                          */
@@ -260,8 +260,8 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_LOCAL
-  FT_Error  T2_Init_Face( FT_Stream      stream,
-                          T2_Face        face,
+  FT_Error  CFF_Init_Face( FT_Stream      stream,
+                          CFF_Face        face,
                           FT_Int         face_index,
                           FT_Int         num_params,
                           FT_Parameter*  params )
@@ -297,7 +297,7 @@
 
       /* if we are performing a simple font format check, exit immediately */
       if ( face_index < 0 )
-        return T2_Err_Ok;
+        return CFF_Err_Ok;
 
       sfnt_format = 1;
 
@@ -370,7 +370,7 @@
         /* we need the `PSNames' module for pure-CFF and CEF formats */
         if ( !psnames )
         {
-          FT_ERROR(( "T2_Init_Face:" ));
+          FT_ERROR(( "CFF_Init_Face:" ));
           FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
           FT_ERROR(( "             " ));
           FT_ERROR(( " without the `PSNames' module\n" ));
@@ -396,7 +396,7 @@
         /* retrieve font family & style name */
         root->family_name  = CFF_Get_Name( &cff->name_index, face_index );
         if ( dict->cid_registry )
-          root->style_name = T2_StrCopy( memory, "Regular" );  /* XXXX */
+          root->style_name = CFF_StrCopy( memory, "Regular" );  /* XXXX */
         else
           root->style_name = CFF_Get_String( &cff->string_index,
                                              dict->weight,
@@ -496,7 +496,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    T2_Done_Face                                                       */
+  /*    CFF_Done_Face                                                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Finalizes a given face object.                                     */
@@ -505,7 +505,7 @@
   /*    face :: A pointer to the face object to destroy.                   */
   /*                                                                       */
   FT_LOCAL
-  void  T2_Done_Face( T2_Face  face )
+  void  CFF_Done_Face( CFF_Face  face )
   {
     FT_Memory        memory = face->root.memory;
     SFNT_Interface*  sfnt   = (SFNT_Interface*)face->sfnt;
@@ -530,7 +530,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    T2_Init_Driver                                                     */
+  /*    CFF_Init_Driver                                                     */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Initializes a given OpenType driver object.                        */
@@ -542,7 +542,7 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_LOCAL_DEF
-  FT_Error  T2_Init_Driver( T2_Driver  driver )
+  FT_Error  CFF_Init_Driver( CFF_Driver  driver )
   {
     /* init extension registry if needed */
 
@@ -554,7 +554,7 @@
 
     FT_UNUSED( driver );
 
-    return T2_Err_Ok;
+    return CFF_Err_Ok;
 
 #endif
   }
@@ -563,7 +563,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    T2_Done_Driver                                                     */
+  /*    CFF_Done_Driver                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    Finalizes a given OpenType driver.                                 */
@@ -572,7 +572,7 @@
   /*    driver :: A handle to the target OpenType driver.                  */
   /*                                                                       */
   FT_LOCAL_DEF
-  void  T2_Done_Driver( T2_Driver  driver )
+  void  CFF_Done_Driver( CFF_Driver  driver )
   {
     /* destroy extensions registry if needed */
 
diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h
index 8b1dcf1..05cee14 100644
--- a/src/cff/cffobjs.h
+++ b/src/cff/cffobjs.h
@@ -33,36 +33,36 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /*                                                                       */
   /* <Type>                                                                */
-  /*    T2_Driver                                                          */
+  /*    CFF_Driver                                                          */
   /*                                                                       */
   /* <Description>                                                         */
   /*    A handle to an OpenType driver object.                             */
   /*                                                                       */
-  typedef struct T2_DriverRec_*  T2_Driver;
+  typedef struct CFF_DriverRec_*  CFF_Driver;
 
-  typedef TT_Face  T2_Face;
+  typedef TT_Face  CFF_Face;
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Type>                                                                */
-  /*    T2_Size                                                            */
+  /*    CFF_Size                                                            */
   /*                                                                       */
   /* <Description>                                                         */
   /*    A handle to an OpenType size object.                               */
   /*                                                                       */
-  typedef FT_Size  T2_Size;
+  typedef FT_Size  CFF_Size;
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Type>                                                                */
-  /*    T2_GlyphSlot                                                       */
+  /*    CFF_GlyphSlot                                                       */
   /*                                                                       */
   /* <Description>                                                         */
   /*    A handle to an OpenType glyph slot object.                         */
   /*                                                                       */
-  typedef struct T2_GlyphSlotRec_
+  typedef struct CFF_GlyphSlotRec_
   {
     FT_GlyphSlotRec  root;
 
@@ -72,7 +72,7 @@ FT_BEGIN_HEADER
     FT_Fixed         x_scale;
     FT_Fixed         y_scale;
 
-  } T2_GlyphSlotRec, *T2_GlyphSlot;
+  } CFF_GlyphSlotRec, *CFF_GlyphSlot;
 
 
 
@@ -80,34 +80,34 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* Subglyph transformation record.                                       */
   /*                                                                       */
-  typedef struct  T2_Transform_
+  typedef struct  CFF_Transform_
   {
     FT_Fixed    xx, xy;     /* transformation matrix coefficients */
     FT_Fixed    yx, yy;
     FT_F26Dot6  ox, oy;     /* offsets        */
 
-  } T2_Transform;
+  } CFF_Transform;
 
 
   /* this is only used in the case of a pure CFF font with no charmap */
-  typedef struct  T2_CharMapRec_
+  typedef struct  CFF_CharMapRec_
   {
     TT_CharMapRec  root;
     PS_Unicodes    unicodes;
 
-  } T2_CharMapRec, *T2_CharMap;
+  } CFF_CharMapRec, *CFF_CharMap;
 
 
   /***********************************************************************/
   /*                                                                     */
   /* TrueType driver class.                                              */
   /*                                                                     */
-  typedef struct  T2_DriverRec_
+  typedef struct  CFF_DriverRec_
   {
     FT_DriverRec  root;
     void*         extension_component;
 
-  } T2_DriverRec;
+  } CFF_DriverRec;
 
 
   /*************************************************************************/
@@ -115,14 +115,14 @@ FT_BEGIN_HEADER
   /* Face functions                                                        */
   /*                                                                       */
   FT_LOCAL
-  FT_Error  T2_Init_Face( FT_Stream      stream,
-                          T2_Face        face,
+  FT_Error  CFF_Init_Face( FT_Stream      stream,
+                          CFF_Face        face,
                           FT_Int         face_index,
                           FT_Int         num_params,
                           FT_Parameter*  params );
 
   FT_LOCAL
-  void  T2_Done_Face( T2_Face  face );
+  void  CFF_Done_Face( CFF_Face  face );
 
 
   /*************************************************************************/
@@ -130,10 +130,10 @@ FT_BEGIN_HEADER
   /* Driver functions                                                      */
   /*                                                                       */
   FT_LOCAL
-  FT_Error  T2_Init_Driver( T2_Driver  driver );
+  FT_Error  CFF_Init_Driver( CFF_Driver  driver );
 
   FT_LOCAL
-  void  T2_Done_Driver( T2_Driver  driver );
+  void  CFF_Done_Driver( CFF_Driver  driver );
 
 
 FT_END_HEADER
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 81dab42..51f9c12 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -29,11 +29,11 @@
   /* messages during execution.                                            */
   /*                                                                       */
 #undef  FT_COMPONENT
-#define FT_COMPONENT  trace_t2parse
+#define FT_COMPONENT  trace_cffparse
 
 
-#define T2_Err_Stack_Underflow  FT_Err_Invalid_Argument
-#define T2_Err_Syntax_Error     FT_Err_Invalid_Argument
+#define CFF_Err_Stack_Underflow  FT_Err_Invalid_Argument
+#define CFF_Err_Syntax_Error     FT_Err_Invalid_Argument
 
 
   enum
@@ -311,7 +311,7 @@
     FT_Fixed        temp;
 
 
-    error = T2_Err_Stack_Underflow;
+    error = CFF_Err_Stack_Underflow;
 
     if ( parser->top >= parser->stack + 6 )
     {
@@ -338,7 +338,7 @@
       offset->x >>= 16;
       offset->y >>= 16;
 
-      error = T2_Err_Ok;
+      error = CFF_Err_Ok;
     }
 
     return error;
@@ -354,7 +354,7 @@
     FT_Error        error;
 
 
-    error = T2_Err_Stack_Underflow;
+    error = CFF_Err_Stack_Underflow;
 
     if ( parser->top >= parser->stack + 4 )
     {
@@ -362,7 +362,7 @@
       bbox->yMin = cff_parse_num( data++ );
       bbox->xMax = cff_parse_num( data++ );
       bbox->yMax = cff_parse_num( data   );
-      error = T2_Err_Ok;
+      error = CFF_Err_Ok;
     }
 
     return error;
@@ -377,13 +377,13 @@
     FT_Error        error;
 
 
-    error = T2_Err_Stack_Underflow;
+    error = CFF_Err_Stack_Underflow;
 
     if ( parser->top >= parser->stack + 2 )
     {
       dict->private_size   = cff_parse_num( data++ );
       dict->private_offset = cff_parse_num( data   );
-      error = T2_Err_Ok;
+      error = CFF_Err_Ok;
     }
 
     return error;
@@ -398,14 +398,14 @@
     FT_Error        error;
 
 
-    error = T2_Err_Stack_Underflow;
+    error = CFF_Err_Stack_Underflow;
 
     if ( parser->top >= parser->stack + 3 )
     {
       dict->cid_registry   = (FT_UInt)cff_parse_num ( data++ );
       dict->cid_ordering   = (FT_UInt)cff_parse_num ( data++ );
       dict->cid_supplement = (FT_ULong)cff_parse_num( data );
-      error = T2_Err_Ok;
+      error = CFF_Err_Ok;
     }
 
     return error;
@@ -472,7 +472,7 @@
                             FT_Byte*     limit )
   {
     FT_Byte*  p     = start;
-    FT_Error  error = T2_Err_Ok;
+    FT_Error  error = CFF_Err_Ok;
 
 
     parser->top    = parser->stack;
@@ -648,15 +648,15 @@
     return error;
 
   Stack_Overflow:
-    error = T2_Err_Invalid_Argument;
+    error = CFF_Err_Invalid_Argument;
     goto Exit;
 
   Stack_Underflow:
-    error = T2_Err_Invalid_Argument;
+    error = CFF_Err_Invalid_Argument;
     goto Exit;
 
   Syntax_Error:
-    error = T2_Err_Invalid_Argument;
+    error = CFF_Err_Invalid_Argument;
     goto Exit;
   }