Commit 9a9315faae0e3efe24a6029ad2ca4f32e726f60f

David Turner 2000-05-02T10:59:01

changes to reflect the new files include/tttables.h include/t1tables.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
diff --git a/src/shared/t1types.h b/src/shared/t1types.h
index 9d74ebe..cdcfd88 100644
--- a/src/shared/t1types.h
+++ b/src/shared/t1types.h
@@ -21,7 +21,7 @@
 #ifndef T1TYPES_H
 #define T1TYPES_H
 
-#include <freetype.h>
+#include <t1tables.h>
 #include <psnames.h>
 
 #ifdef __cplusplus
@@ -310,55 +310,12 @@
   {
 
  /* font info dictionary */
+    T1_FontInfo    font_info;
  
-    T1_String*     version;
-    T1_String*     notice;
-    T1_String*     full_name;
-    T1_String*     family_name;
-    T1_String*     weight;
-    T1_Long        italic_angle;
-    T1_Bool        is_fixed_pitch;
-    T1_Short       underline_position;
-    T1_UShort      underline_thickness;
-
  /* private dictionary */
-
-    T1_Int       unique_id;
-    T1_Int       lenIV;
-
-    T1_Byte      num_blues;
-    T1_Byte      num_other_blues;
-    T1_Byte      num_family_blues;
-    T1_Byte      num_family_other_blues;
-
-    T1_Short     blue_values[14];
-    T1_Short     other_blues[10];
-
-    T1_Short     family_blues      [14];
-    T1_Short     family_other_blues[10];
-
-    T1_Fixed     blue_scale;
-    T1_Int       blue_shift;
-    T1_Int       blue_fuzz;
-
-    T1_UShort    standard_width;
-    T1_UShort    standard_height;
-
-    T1_Byte      num_snap_widths;
-    T1_Byte      num_snap_heights;
-    T1_Bool      force_bold;
-    T1_Bool      round_stem_up;
-
-    T1_Short     stem_snap_widths [13];  /* reserve one place for the std */
-    T1_Short     stem_snap_heights[13];  /* reserve one place for the std */
-
-    T1_Long      language_group;
-    T1_Long      password;
-
-    T1_Short     min_feature[2];
+    T1_Private     private_dict;
 
  /* top-level dictionary */
- 
     FT_String*   font_name;
 
     T1_EncodingType  encoding_type;
diff --git a/src/shared/tttypes.h b/src/shared/tttypes.h
index 74a8c43..29136fe 100644
--- a/src/shared/tttypes.h
+++ b/src/shared/tttypes.h
@@ -788,60 +788,6 @@
     /* load them by default.  See the ttpost.c file.  */
 
   } TT_Postscript;
-#endif
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    TT_CMapDir                                                         */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This structure describes the directory of the `cmap' table,        */
-  /*    containing the font's character mappings table.                    */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    tableVersionNumber :: The version number.                          */
-  /*    numCMaps           :: The number of charmaps in the font.          */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This structure is only used during font loading.                   */
-  /*                                                                       */
-  typedef struct  TT_CMapDir_
-  {
-    TT_UShort  tableVersionNumber;
-    TT_UShort  numCMaps;
-
-  } TT_CMapDir;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Struct>                                                              */
-  /*    TT_CMapDirEntry                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    This structure describes a charmap in a TrueType font.             */
-  /*                                                                       */
-  /* <Fields>                                                              */
-  /*    platformID :: An ID used to specify for which platform this        */
-  /*                  charmap is defined (FreeType manages all platforms). */
-  /*                                                                       */
-  /*    encodingID :: A platform-specific ID used to indicate which source */
-  /*                  encoding is used in this charmap.                    */
-  /*                                                                       */
-  /*    offset ::     The offset of the charmap relative to the start of   */
-  /*                  the `cmap' table.                                    */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    This structure is only used during font loading.                   */
-  /*                                                                       */
-  typedef struct  TT_CMapDirEntry_
-  {
-    TT_UShort  platformID;
-    TT_UShort  platformEncodingID;
-    TT_Long    offset;
-
-  } TT_CMapDirEntry;
 
 
   /*************************************************************************/
@@ -932,6 +878,62 @@
   } TT_MaxProfile;
 
 
+#endif
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    TT_CMapDir                                                         */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    This structure describes the directory of the `cmap' table,        */
+  /*    containing the font's character mappings table.                    */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    tableVersionNumber :: The version number.                          */
+  /*    numCMaps           :: The number of charmaps in the font.          */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This structure is only used during font loading.                   */
+  /*                                                                       */
+  typedef struct  TT_CMapDir_
+  {
+    TT_UShort  tableVersionNumber;
+    TT_UShort  numCMaps;
+
+  } TT_CMapDir;
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Struct>                                                              */
+  /*    TT_CMapDirEntry                                                    */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    This structure describes a charmap in a TrueType font.             */
+  /*                                                                       */
+  /* <Fields>                                                              */
+  /*    platformID :: An ID used to specify for which platform this        */
+  /*                  charmap is defined (FreeType manages all platforms). */
+  /*                                                                       */
+  /*    encodingID :: A platform-specific ID used to indicate which source */
+  /*                  encoding is used in this charmap.                    */
+  /*                                                                       */
+  /*    offset ::     The offset of the charmap relative to the start of   */
+  /*                  the `cmap' table.                                    */
+  /*                                                                       */
+  /* <Note>                                                                */
+  /*    This structure is only used during font loading.                   */
+  /*                                                                       */
+  typedef struct  TT_CMapDirEntry_
+  {
+    TT_UShort  platformID;
+    TT_UShort  platformEncodingID;
+    TT_Long    offset;
+
+  } TT_CMapDirEntry;
+
+
   /*************************************************************************/
   /*                                                                       */
   /* <Struct>                                                              */
diff --git a/src/type1/t1hinter.c b/src/type1/t1hinter.c
index bb2f235..3a09ed7 100644
--- a/src/type1/t1hinter.c
+++ b/src/type1/t1hinter.c
@@ -105,7 +105,7 @@
   T1_Error  t1_set_blue_zones( T1_Size  size )
   {
     T1_Face          face = (T1_Face)size->root.face;
-    T1_Font*         priv = &face->type1;
+    T1_Private*      priv = &face->type1.private_dict;
     T1_Int           n;
     T1_Int           blues[24];
     T1_Int           num_bottom;
@@ -286,7 +286,7 @@
     T1_Fixed       scale;
 
     T1_Face         face = (T1_Face)size->root.face;
-    T1_Font*        priv = &face->type1;
+    T1_Private*     priv = &face->type1.private_dict;
     T1_Size_Hints*  hints = size->hints;
 
     /* start with horizontal snap zones */
@@ -1286,7 +1286,7 @@
   void  T1_Hint_Stems( T1_Builder*  builder )
   {
     T1_Glyph_Hints*  hints = builder->glyph->hints;
-    T1_Font*         priv  = &builder->face->type1;
+    T1_Private*      priv  = &builder->face->type1.private_dict;
 
     T1_Size   size    = builder->size;
     T1_Fixed  scale_x = size->root.metrics.x_scale;
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 3c2e5c2..87c2d1f 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -44,7 +44,7 @@
     parser->encoding_lengths = 0;
 
     parser->dump_tokens      = 0;
-    face->type1.lenIV        = 4;  /* XXX : is it sure ?? */
+    face->type1.private_dict.lenIV        = 4;  /* XXX : is it sure ?? */
   }
 
 
@@ -309,7 +309,7 @@
         break;
 
       case imm_UniqueID:
-        type1->unique_id = CopyInteger( parser );
+        type1->private_dict.unique_id = CopyInteger( parser );
         break;
 
       case imm_StrokeWidth:
@@ -347,8 +347,8 @@
   static
   T1_Error  Do_Def_FontInfo( T1_Parser*  parser )
   {
-    T1_Token*  top   = parser->top;
-    T1_Font*   info  = &parser->face->type1;
+    T1_Token*    top   = parser->top;
+    T1_FontInfo* info  = &parser->face->type1.font_info;
 
     switch ( top[0].kind2 )
     {
@@ -416,7 +416,7 @@
   T1_Error  Do_Def_Private( T1_Parser*  parser )
   {
     T1_Token*   top   = parser->top;
-    T1_Font*    priv  = &parser->face->type1;
+    T1_Private* priv  = &parser->face->type1.private_dict;
 
     switch ( top[0].kind2 )
     {
@@ -722,8 +722,8 @@
       t1_decrypt( base, count, 4330 );
       tokzer->cursor += count;
 
-      base  += face->type1.lenIV;
-      count -= face->type1.lenIV;
+      base  += face->type1.private_dict.lenIV;
+      count -= face->type1.private_dict.lenIV;
 
       error = T1_Add_Table( &parser->table, index, base, count );
     }
@@ -806,8 +806,8 @@
       t1_decrypt( base, count, 4330 );
       tokzer->cursor += count;  /* skip */
 
-      base  += face->type1.lenIV;
-      count -= face->type1.lenIV;
+      base  += face->type1.private_dict.lenIV;
+      count -= face->type1.private_dict.lenIV;
 
       error = T1_Add_Table( &parser->table, index*2+1, base, count );
     }
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index c5ba417..7bd19dc 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -243,17 +243,17 @@
         
         root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
                               
-        if ( type1->is_fixed_pitch )
+        if ( type1->font_info.is_fixed_pitch )
           root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
 
         /* XXX : TO DO - add kerning with .afm support */
 
         /* get style name - be careful, some broken fonts only */
         /* have a /FontName dictionary entry .. !!             */
-        root->family_name = type1->family_name;
+        root->family_name = type1->font_info.family_name;
         if (root->family_name)
         {
-          char*  full   = type1->full_name;
+          char*  full   = type1->font_info.full_name;
           char*  family = root->family_name;
           
           while ( *family && *full == *family )
@@ -286,10 +286,10 @@
   
         /* now compute the maximum advance width */
 
-        root->max_advance_width = type1->standard_width;
+        root->max_advance_width = type1->private_dict.standard_width;
 
         /* compute max advance width for proportional fonts */
-        if (!type1->is_fixed_pitch)
+        if (!type1->font_info.is_fixed_pitch)
         {
           T1_Int  max_advance;
 
@@ -304,8 +304,8 @@
 
         root->max_advance_height = root->height;
         
-        root->underline_position  = type1->underline_position;
-        root->underline_thickness = type1->underline_thickness;
+        root->underline_position  = type1->font_info.underline_position;
+        root->underline_thickness = type1->font_info.underline_thickness;
   
         root->max_points   = 0;
         root->max_contours = 0;
diff --git a/src/type1z/t1load.c b/src/type1z/t1load.c
index d272e4e..5877b86 100644
--- a/src/type1z/t1load.c
+++ b/src/type1z/t1load.c
@@ -437,8 +437,8 @@
       if (!read_binary_data(parser,&size,&base)) return;
       
       T1_Decrypt( base, size, 4330 );      
-      size -= face->type1.lenIV;
-      base += face->type1.lenIV;
+      size -= face->type1.private_dict.lenIV;
+      base += face->type1.private_dict.lenIV;
 
       error = T1_Add_Table( table, index, base, size );
       if (error) goto Fail;
@@ -521,8 +521,8 @@
         if (!read_binary_data(parser,&size,&base)) return;
 
         T1_Decrypt( base, size, 4330 );      
-        size -= face->type1.lenIV;
-        base += face->type1.lenIV;
+        size -= face->type1.private_dict.lenIV;
+        base += face->type1.private_dict.lenIV;
 
         error = T1_Add_Table( code_table, n, base, size );
         if (error) goto Fail;
@@ -688,7 +688,7 @@
     t1_init_loader( &loader, face );
 
     /* default lenIV */
-    type1->lenIV = 4;
+    type1->private_dict.lenIV = 4;
     
     parser = &loader.parser;
     error = T1_New_Parser( parser, face->root.stream, face->root.memory );
diff --git a/src/type1z/t1objs.c b/src/type1z/t1objs.c
index d46d709..860f7f4 100644
--- a/src/type1z/t1objs.c
+++ b/src/type1z/t1objs.c
@@ -215,17 +215,17 @@
         
         root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
                               
-        if ( face->type1.is_fixed_pitch )
+        if ( face->type1.font_info.is_fixed_pitch )
           root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
 
         /* XXX : TO DO - add kerning with .afm support */
 
         /* get style name - be careful, some broken fonts only */
         /* have a /FontName dictionary entry .. !!             */
-        root->family_name = face->type1.family_name;
+        root->family_name = face->type1.font_info.family_name;
         if (root->family_name)
         {
-          char*  full   = face->type1.full_name;
+          char*  full   = face->type1.font_info.full_name;
           char*  family = root->family_name;
           
           while ( *family && *full == *family )
@@ -258,10 +258,10 @@
   
         /* now compute the maximum advance width */
 
-        root->max_advance_width = face->type1.standard_width;
+        root->max_advance_width = face->type1.private_dict.standard_width;
 
         /* compute max advance width for proportional fonts */
-        if (!face->type1.is_fixed_pitch)
+        if (!face->type1.font_info.is_fixed_pitch)
         {
           T1_Int  max_advance;
 
@@ -276,8 +276,8 @@
 
         root->max_advance_height = root->height;
         
-        root->underline_position  = face->type1.underline_position;
-        root->underline_thickness = face->type1.underline_thickness;
+        root->underline_position  = face->type1.font_info.underline_position;
+        root->underline_thickness = face->type1.font_info.underline_thickness;
   
         root->max_points   = 0;
         root->max_contours = 0;
diff --git a/src/type1z/t1tokens.h b/src/type1z/t1tokens.h
index 94de2e2..0de85be 100644
--- a/src/type1z/t1tokens.h
+++ b/src/type1z/t1tokens.h
@@ -17,10 +17,9 @@
  *
  ******************************************************************/
 
-#undef  FACE
-#define FACE  (face->type1)
-
  /* define the font info dictionary parsing callbacks */
+#undef  FACE
+#define FACE  (face->type1.font_info)
 
   PARSE_STRING("version",version)
   PARSE_STRING("Notice",notice)
@@ -35,6 +34,9 @@
 
  /* define the private dict parsing callbacks */ 
  
+#undef  FACE
+#define FACE  (face->type1.private_dict)
+
    PARSE_INT("UniqueID",unique_id)
    PARSE_INT("lenIV",lenIV)
    
@@ -60,6 +62,10 @@
    PARSE_COORDS2( "MinFeature", 2, min_feature )
 
  /* define the top-level dictionary parsing callbacks */
+
+#undef  FACE
+#define FACE  (face->type1)
+
  
 /* PARSE_STRING( "FontName", font_name ) -- handled by special routine */
    PARSE_NUM( "PaintType", paint_type, T1_Byte )