Commit 910b544aafdf533613839468950ceb377fea5a9b

Werner Lemberg 2011-11-30T13:08:28

[type1] Remove casts. * src/type1/t1driver.c (t1_driver_class): Remove all casts and update affected functions. * src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1objs.c: Updated for t1driver changes. src/type1/t1objs.h (T1_Driver): Remove unused typedef. Updated for t1driver changes.

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
diff --git a/ChangeLog b/ChangeLog
index 689cd6b..3d96e58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-11-30  Werner Lemberg  <wl@gnu.org>
+
+	[type1] Remove casts.
+
+	* src/type1/t1driver.c (t1_driver_class): Remove all casts and
+	update affected functions.
+
+	* src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1objs.c:
+	Updated for t1driver changes.
+	src/type1/t1objs.h (T1_Driver): Remove unused typedef.
+	Updated for t1driver changes.
+
 2011-11-27  Werner Lemberg  <wl@gnu.org>
 
 	[bdf] Fix Savannah bug #34896.
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index b9ada02..9391a39 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -607,11 +607,11 @@
   };
 
 
-  static FT_Module_Interface
-  Get_Interface( FT_Driver         driver,
+  FT_CALLBACK_DEF( FT_Module_Interface )
+  Get_Interface( FT_Module         module,
                  const FT_String*  t1_interface )
   {
-    FT_UNUSED( driver );
+    FT_UNUSED( module );
 
     return ft_service_list_lookup( t1_services, t1_interface );
   }
@@ -652,11 +652,14 @@
   /*    They can be implemented by format-specific interfaces.             */
   /*                                                                       */
   static FT_Error
-  Get_Kerning( T1_Face     face,
+  Get_Kerning( FT_Face     t1face,        /* T1_Face */
                FT_UInt     left_glyph,
                FT_UInt     right_glyph,
                FT_Vector*  kerning )
   {
+    T1_Face  face = (T1_Face)t1face;
+
+
     kerning->x = 0;
     kerning->y = 0;
 
@@ -689,38 +692,38 @@
 
       0,   /* format interface */
 
-      (FT_Module_Constructor)T1_Driver_Init,
-      (FT_Module_Destructor) T1_Driver_Done,
-      (FT_Module_Requester)  Get_Interface,
+      T1_Driver_Init,
+      T1_Driver_Done,
+      Get_Interface,
     },
 
     sizeof ( T1_FaceRec ),
     sizeof ( T1_SizeRec ),
     sizeof ( T1_GlyphSlotRec ),
 
-    (FT_Face_InitFunc)        T1_Face_Init,
-    (FT_Face_DoneFunc)        T1_Face_Done,
-    (FT_Size_InitFunc)        T1_Size_Init,
-    (FT_Size_DoneFunc)        T1_Size_Done,
-    (FT_Slot_InitFunc)        T1_GlyphSlot_Init,
-    (FT_Slot_DoneFunc)        T1_GlyphSlot_Done,
+    T1_Face_Init,
+    T1_Face_Done,
+    T1_Size_Init,
+    T1_Size_Done,
+    T1_GlyphSlot_Init,
+    T1_GlyphSlot_Done,
 
 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
     ft_stub_set_char_sizes,
     ft_stub_set_pixel_sizes,
 #endif
-    (FT_Slot_LoadFunc)        T1_Load_Glyph,
+    T1_Load_Glyph,
 
 #ifdef T1_CONFIG_OPTION_NO_AFM
-    (FT_Face_GetKerningFunc)  0,
-    (FT_Face_AttachFunc)      0,
+    0,                     /* FT_Face_GetKerningFunc */
+    0,                     /* FT_Face_AttachFunc     */
 #else
-    (FT_Face_GetKerningFunc)  Get_Kerning,
-    (FT_Face_AttachFunc)      T1_Read_Metrics,
+    Get_Kerning,
+    T1_Read_Metrics,
 #endif
-    (FT_Face_GetAdvancesFunc) T1_Get_Advances,
-    (FT_Size_RequestFunc)     T1_Size_Request,
-    (FT_Size_SelectFunc)      0
+    T1_Get_Advances,
+    T1_Size_Request,
+    0                      /* FT_Size_SelectFunc     */
   };
 
 
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index f3fad4f..4c625ef 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -208,12 +208,13 @@
 
 
   FT_LOCAL_DEF( FT_Error )
-  T1_Get_Advances( T1_Face    face,
+  T1_Get_Advances( FT_Face    t1face,        /* T1_Face */
                    FT_UInt    first,
                    FT_UInt    count,
-                   FT_ULong   load_flags,
+                   FT_Int32   load_flags,
                    FT_Fixed*  advances )
   {
+    T1_Face        face  = (T1_Face)t1face;
     T1_DecoderRec  decoder;
     T1_Font        type1 = &face->type1;
     PSAux_Service  psaux = (PSAux_Service)face->psaux;
@@ -265,14 +266,15 @@
 
 
   FT_LOCAL_DEF( FT_Error )
-  T1_Load_Glyph( T1_GlyphSlot  glyph,
-                 T1_Size       size,
+  T1_Load_Glyph( FT_GlyphSlot  t1glyph,          /* T1_GlyphSlot */
+                 FT_Size       t1size,           /* T1_Size      */
                  FT_UInt       glyph_index,
                  FT_Int32      load_flags )
   {
+    T1_GlyphSlot            glyph = (T1_GlyphSlot)t1glyph;
     FT_Error                error;
     T1_DecoderRec           decoder;
-    T1_Face                 face = (T1_Face)glyph->root.face;
+    T1_Face                 face = (T1_Face)t1glyph->face;
     FT_Bool                 hinting;
     T1_Font                 type1         = &face->type1;
     PSAux_Service           psaux         = (PSAux_Service)face->psaux;
@@ -303,10 +305,10 @@
     if ( load_flags & FT_LOAD_NO_RECURSE )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
-    if ( size )
+    if ( t1size )
     {
-      glyph->x_scale = size->root.metrics.x_scale;
-      glyph->y_scale = size->root.metrics.y_scale;
+      glyph->x_scale = t1size->metrics.x_scale;
+      glyph->y_scale = t1size->metrics.y_scale;
     }
     else
     {
@@ -314,18 +316,18 @@
       glyph->y_scale = 0x10000L;
     }
 
-    glyph->root.outline.n_points   = 0;
-    glyph->root.outline.n_contours = 0;
+    t1glyph->outline.n_points   = 0;
+    t1glyph->outline.n_contours = 0;
 
     hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 &&
                        ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
 
-    glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
+    t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
 
     error = decoder_funcs->init( &decoder,
-                                 (FT_Face)face,
-                                 (FT_Size)size,
-                                 (FT_GlyphSlot)glyph,
+                                 t1glyph->face,
+                                 t1size,
+                                 t1glyph,
                                  (FT_Byte**)type1->glyph_names,
                                  face->blend,
                                  FT_BOOL( hinting ),
@@ -368,19 +370,19 @@
     /* bearing the yMax                                    */
     if ( !error )
     {
-      glyph->root.outline.flags &= FT_OUTLINE_OWNER;
-      glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
+      t1glyph->outline.flags &= FT_OUTLINE_OWNER;
+      t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
 
       /* for composite glyphs, return only left side bearing and */
       /* advance width                                           */
       if ( load_flags & FT_LOAD_NO_RECURSE )
       {
-        FT_Slot_Internal  internal = glyph->root.internal;
+        FT_Slot_Internal  internal = t1glyph->internal;
 
 
-        glyph->root.metrics.horiBearingX =
+        t1glyph->metrics.horiBearingX =
           FIXED_TO_INT( decoder.builder.left_bearing.x );
-        glyph->root.metrics.horiAdvance  =
+        t1glyph->metrics.horiAdvance  =
           FIXED_TO_INT( decoder.builder.advance.x );
 
         internal->glyph_matrix      = font_matrix;
@@ -390,45 +392,45 @@
       else
       {
         FT_BBox            cbox;
-        FT_Glyph_Metrics*  metrics = &glyph->root.metrics;
+        FT_Glyph_Metrics*  metrics = &t1glyph->metrics;
         FT_Vector          advance;
 
 
         /* copy the _unscaled_ advance width */
         metrics->horiAdvance =
           FIXED_TO_INT( decoder.builder.advance.x );
-        glyph->root.linearHoriAdvance =
+        t1glyph->linearHoriAdvance =
           FIXED_TO_INT( decoder.builder.advance.x );
-        glyph->root.internal->glyph_transformed = 0;
+        t1glyph->internal->glyph_transformed = 0;
 
         if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) 
         {
           /* make up vertical ones */
           metrics->vertAdvance = ( face->type1.font_bbox.yMax -
                                    face->type1.font_bbox.yMin ) >> 16;
-          glyph->root.linearVertAdvance = metrics->vertAdvance;
+          t1glyph->linearVertAdvance = metrics->vertAdvance;
         }
         else
         {
           metrics->vertAdvance =
             FIXED_TO_INT( decoder.builder.advance.y );
-          glyph->root.linearVertAdvance =
+          t1glyph->linearVertAdvance =
             FIXED_TO_INT( decoder.builder.advance.y );
         }
 
-        glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
+        t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
 
-        if ( size && size->root.metrics.y_ppem < 24 )
-          glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
+        if ( t1size && t1size->metrics.y_ppem < 24 )
+          t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
 
 #if 1
         /* apply the font matrix, if any */
         if ( font_matrix.xx != 0x10000L || font_matrix.yy != font_matrix.xx ||
              font_matrix.xy != 0        || font_matrix.yx != 0              )
-          FT_Outline_Transform( &glyph->root.outline, &font_matrix );
+          FT_Outline_Transform( &t1glyph->outline, &font_matrix );
 
         if ( font_offset.x || font_offset.y )
-          FT_Outline_Translate( &glyph->root.outline,
+          FT_Outline_Translate( &t1glyph->outline,
                                 font_offset.x,
                                 font_offset.y );
 
@@ -466,7 +468,7 @@
         }
 
         /* compute the other metrics */
-        FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
+        FT_Outline_Get_CBox( &t1glyph->outline, &cbox );
 
         metrics->width  = cbox.xMax - cbox.xMin;
         metrics->height = cbox.yMax - cbox.yMin;
@@ -484,8 +486,8 @@
 
       /* Set control data to the glyph charstrings.  Note that this is */
       /* _not_ zero-terminated.                                        */
-      glyph->root.control_data = (FT_Byte*)glyph_data.pointer;
-      glyph->root.control_len  = glyph_data.length;
+      t1glyph->control_data = (FT_Byte*)glyph_data.pointer;
+      t1glyph->control_len  = glyph_data.length;
     }
 
 
@@ -500,8 +502,8 @@
 
       /* Set the control data to null - it is no longer available if   */
       /* loaded incrementally.                                         */
-      glyph->root.control_data = 0;
-      glyph->root.control_len  = 0;
+      t1glyph->control_data = 0;
+      t1glyph->control_len  = 0;
     }
 #endif
 
diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h
index 100df06..0bdea3a 100644
--- a/src/type1/t1gload.h
+++ b/src/type1/t1gload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 Glyph Loader (specification).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2008 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2008, 2011 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -32,15 +32,15 @@ FT_BEGIN_HEADER
                           FT_Pos*  max_advance );
 
   FT_LOCAL( FT_Error )
-  T1_Get_Advances( T1_Face    face,
+  T1_Get_Advances( FT_Face    face,
                    FT_UInt    first,
                    FT_UInt    count,
-                   FT_ULong   load_flags,
+                   FT_Int32   load_flags,
                    FT_Fixed*  advances );
 
   FT_LOCAL( FT_Error )
-  T1_Load_Glyph( T1_GlyphSlot  glyph,
-                 T1_Size       size,
+  T1_Load_Glyph( FT_GlyphSlot  glyph,
+                 FT_Size       size,
                  FT_UInt       glyph_index,
                  FT_Int32      load_flags );
 
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 2b25c25..acca514 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -72,8 +72,11 @@
 
 
   FT_LOCAL_DEF( void )
-  T1_Size_Done( T1_Size  size )
+  T1_Size_Done( FT_Size  t1size )          /* T1_Size */
   {
+    T1_Size  size = (T1_Size)t1size;
+
+
     if ( size->root.internal )
     {
       PSH_Globals_Funcs  funcs;
@@ -89,8 +92,9 @@
 
 
   FT_LOCAL_DEF( FT_Error )
-  T1_Size_Init( T1_Size  size )
+  T1_Size_Init( FT_Size  t1size )      /* T1_Size */
   {
+    T1_Size            size  = (T1_Size)t1size;
     FT_Error           error = T1_Err_Ok;
     PSH_Globals_Funcs  funcs = T1_Size_Get_Globals_Funcs( size );
 
@@ -112,9 +116,10 @@
 
 
   FT_LOCAL_DEF( FT_Error )
-  T1_Size_Request( T1_Size          size,
+  T1_Size_Request( FT_Size          t1size,     /* T1_Size */
                    FT_Size_Request  req )
   {
+    T1_Size            size  = (T1_Size)t1size;
     PSH_Globals_Funcs  funcs = T1_Size_Get_Globals_Funcs( size );
 
 
@@ -137,20 +142,20 @@
   /*************************************************************************/
 
   FT_LOCAL_DEF( void )
-  T1_GlyphSlot_Done( T1_GlyphSlot  slot )
+  T1_GlyphSlot_Done( FT_GlyphSlot  slot )
   {
-    slot->root.internal->glyph_hints = 0;
+    slot->internal->glyph_hints = 0;
   }
 
 
   FT_LOCAL_DEF( FT_Error )
-  T1_GlyphSlot_Init( T1_GlyphSlot  slot )
+  T1_GlyphSlot_Init( FT_GlyphSlot  slot )
   {
     T1_Face           face;
     PSHinter_Service  pshinter;
 
 
-    face     = (T1_Face)slot->root.face;
+    face     = (T1_Face)slot->face;
     pshinter = (PSHinter_Service)face->pshinter;
 
     if ( pshinter )
@@ -158,15 +163,18 @@
       FT_Module  module;
 
 
-      module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" );
-      if (module)
+      module = FT_Get_Module( slot->face->driver->root.library,
+                              "pshinter" );
+      if ( module )
       {
         T1_Hints_Funcs  funcs;
 
+
         funcs = pshinter->get_t1_funcs( module );
-        slot->root.internal->glyph_hints = (void*)funcs;
+        slot->internal->glyph_hints = (void*)funcs;
       }
     }
+
     return 0;
   }
 
@@ -190,8 +198,9 @@
   /*    face :: A typeless pointer to the face object to destroy.          */
   /*                                                                       */
   FT_LOCAL_DEF( void )
-  T1_Face_Done( T1_Face  face )
+  T1_Face_Done( FT_Face  t1face )         /* T1_Face */
   {
+    T1_Face    face = (T1_Face)t1face;
     FT_Memory  memory;
     T1_Font    type1;
 
@@ -289,11 +298,12 @@
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
   T1_Face_Init( FT_Stream      stream,
-                T1_Face        face,
+                FT_Face        t1face,          /* T1_Face */
                 FT_Int         face_index,
                 FT_Int         num_params,
                 FT_Parameter*  params )
   {
+    T1_Face             face = (T1_Face)t1face;
     FT_Error            error;
     FT_Service_PsCMaps  psnames;
     PSAux_Service       psaux;
@@ -576,7 +586,7 @@
   /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
-  T1_Driver_Init( T1_Driver  driver )
+  T1_Driver_Init( FT_Module  driver )
   {
     FT_UNUSED( driver );
 
@@ -596,7 +606,7 @@
   /*    driver :: A handle to the target Type 1 driver.                    */
   /*                                                                       */
   FT_LOCAL_DEF( void )
-  T1_Driver_Done( T1_Driver  driver )
+  T1_Driver_Done( FT_Module  driver )
   {
     FT_UNUSED( driver );
   }
diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h
index e5e9029..54ccbb9 100644
--- a/src/type1/t1objs.h
+++ b/src/type1/t1objs.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 objects manager (specification).                              */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2006 by                                     */
+/*  Copyright 1996-2001, 2002, 2006, 2011 by                               */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -37,17 +37,6 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /*                                                                       */
   /* <Type>                                                                */
-  /*    T1_Driver                                                          */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    A handle to a Type 1 driver object.                                */
-  /*                                                                       */
-  typedef struct T1_DriverRec_   *T1_Driver;
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Type>                                                                */
   /*    T1_Size                                                            */
   /*                                                                       */
   /* <Description>                                                         */
@@ -106,14 +95,14 @@ FT_BEGIN_HEADER
 
 
   FT_LOCAL( void )
-  T1_Size_Done( T1_Size  size );
+  T1_Size_Done( FT_Size  size );
 
   FT_LOCAL( FT_Error )
-  T1_Size_Request( T1_Size          size,
+  T1_Size_Request( FT_Size          size,
                    FT_Size_Request  req );
 
   FT_LOCAL( FT_Error )
-  T1_Size_Init( T1_Size  size );
+  T1_Size_Init( FT_Size  size );
 
 
   /*************************************************************************/
@@ -142,25 +131,25 @@ FT_BEGIN_HEADER
 
   FT_LOCAL( FT_Error )
   T1_Face_Init( FT_Stream      stream,
-                T1_Face        face,
+                FT_Face        face,
                 FT_Int         face_index,
                 FT_Int         num_params,
                 FT_Parameter*  params );
 
   FT_LOCAL( void )
-  T1_Face_Done( T1_Face  face );
+  T1_Face_Done( FT_Face  face );
 
   FT_LOCAL( FT_Error )
-  T1_GlyphSlot_Init( T1_GlyphSlot  slot );
+  T1_GlyphSlot_Init( FT_GlyphSlot  slot );
 
   FT_LOCAL( void )
-  T1_GlyphSlot_Done( T1_GlyphSlot  slot );
+  T1_GlyphSlot_Done( FT_GlyphSlot  slot );
 
   FT_LOCAL( FT_Error )
-  T1_Driver_Init( T1_Driver  driver );
+  T1_Driver_Init( FT_Module  driver );
 
   FT_LOCAL( void )
-  T1_Driver_Done( T1_Driver  driver );
+  T1_Driver_Done( FT_Module  driver );
 
 
 FT_END_HEADER