Commit a259b6dddbdf1e23346bd8d9816c5c68adb7d433

Werner Lemberg 2003-09-22T09:53:56

* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE): Fix compilation warning (s/pptr/Pptr/). * include/freetype/internal/internal.h (FT_INTERNAL_PFR_H, FT_INTERNAL_FNT_TYPES_H): Removed.

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
diff --git a/ChangeLog b/ChangeLog
index 6b927fc..7445aba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,30 +1,64 @@
+2003-09-21  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE):
+	Fix compilation warning (s/pptr/Pptr/).
+
+	* include/freetype/internal/internal.h (FT_INTERNAL_PFR_H,
+	FT_INTERNAL_FNT_TYPES_H): Removed.
+
 2003-09-21  David Turner  <david@freetype.org>
 
-        * include/freetype/internal/ftserv.h,
-        include/freetype/internal/service/svpfr.h,
-        include/freetype/internal/pfr.h,
-        src/base/ftpfr.c:
+	Migrating the PFR and WINFNT drivers to the new service-based
+	internal API.
 
-          migrating the functions of "ftpfr.h" to the new
-          service-base internal API
+	* include/freetype/internal/fnttypes.h: Removed.  Most of its data
+	are moved to winfnt.h and...
+	* include/freetype/internal/services/svwinfnt.h: New file.
 
-        * src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
-        src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
-        src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
-        src/type42/t42objs.c, src/winfonts/winfnt.c:
+	* include/freetype/internal/pfr.h: Removed.  Most of its data are
+	moved to...
+	* include/freetype/internal/services/svpfr.h: New file.
 
-          removing various compiler warnings
+	* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE,
+	FT_FACE_LOOKUP_SERVICE): Simplify fix of 2003-09-16 by removing
+	pointer type argument.
+	Updated all callers.
+	Update macro names of services header files.
 
+	* src/base/ftobjs.c (FT_Get_Name_Index): Simplified code.
+
+	* src/base/ftpfr.c: Include FT_SERVICE_PFR_H instead of
+	FT_INTERNAL_PFR_H.
+	(ft_pfr_check, FT_Get_PFR_Metrics, FT_Get_PFR_Kerning,
+	FT_Get_PFR_Advance): Use services provided in `PFR_METRICS'.
+
+	* src/base/ftwinfnt.c: Include FT_SERVICE_WINFNT_H instead of
+	FT_INTERNAL_FNT_TYPES_H.
+	(FT_Get_WinFNT_Header): Use service provided in `WINFNT'.
+
+	* src/pfr/pfrdrivr.c: Include FT_SERVICE_PFR_H and
+	FT_SERVICE_XFREE86_NAME_H instead of FT_INTERNAL_PFR_H.
+	(pfr_service_bdf): Updated.
+	(pfr_services): New services list.
+	(pfr_get_service): New function.
+	(pfr_driver_class): Updated.
+
+	* src/winfonts/winfnt.c: Include FT_SERVICE_WINFNT_H and
+	FT_SERVICE_XFREE86_NAME_H instead of FT_INTERNAL_FNT_TYPES_H.
+	(winfnt_get_header, winfnt_get_service): New functions.
+	(winfnt_service_rec): New structure providing WINFNT services.
+	(winfnt_services): New services list.
+	(winfnt_driver_class): Updated.
+	* src/winfonts/winfnt.h: Add most of the removed fnttypes.h data.
 
-        * include/freetype/internal/fnttypes.h,
-        include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
-        src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
-        src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
-        src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
+	* src/sfnt/sfdriver.c (sfnt_service_ps_name): Fix typo.
 
-          simplification of service lookup macros, updating the PFR and
-          WINFNT font drivers to new services
+	* src/type1/t1driver.c (t1_service_ps_name): Fix typo.
 
+	* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
+	src/psaux/psobjs.c, src/sfnt/sfobjs.c, src/truetype/ttobjs.c,
+	src/type1/t1objs.c, src/type42/t42objs.c: Removing various compiler
+	warnings.
 
 2003-09-19  David Bevan  <dbevan@emtex.com>
 
@@ -145,7 +179,7 @@
 	* src/base/ftbdf.c: Include FT_SERVICE_BDF_H.
 	(test_font_type): Removed.
 	(FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Use services
-	provided in `FT_SERVICE_ID_BDF'
+	provided in `FT_SERVICE_ID_BDF'.
 
 	* src/base/ftmm.c: Include FT_SERVICE_MULTIPLE_MASTERS_H.
 	(ft_face_get_mm_service): New auxiliary function to get services
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 8faf681..5819940 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -46,15 +46,12 @@ FT_BEGIN_HEADER
    *   id ::
    *     A string describing the service as defined in the service's
    *     header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
-   *     `multi-masters'). It will be prefixed with "FT_SERVICE_ID_" !!
+   *     `multi-masters').  It is automatically prefixed with
+   *     `FT_SERVICE_ID_'.
    *
    *   face ::
    *     The source face handle.
    *
-   *   ptrtype ::
-   *     The pointer type of `ptr'.  This is needed to make FreeType
-   *     compile cleanly with C++.
-   *
    * @output:
    *   ptr ::
    *     A variable that receives the service pointer.  Will be NULL
@@ -63,14 +60,16 @@ FT_BEGIN_HEADER
 #define FT_FACE_FIND_SERVICE( ptr, face, id )                               \
   FT_BEGIN_STMNT                                                            \
     FT_Module    module = FT_MODULE( FT_FACE(face)->driver );               \
-    FT_Pointer*  pptr   = (FT_Pointer*) &(ptr);                             \
-                                                                            \
     /* the strange cast is to allow C++ compilation */                      \
-    *pptr = NULL;                                                           \
+    FT_Pointer*  Pptr = (FT_Pointer*)&(ptr);                                \
+                                                                            \
+                                                                            \
+    *Pptr = NULL;                                                           \
     if ( module->clazz->get_interface )                                     \
-      *pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
+      *Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
   FT_END_STMNT
 
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -123,9 +122,9 @@ FT_BEGIN_HEADER
    *  All fields should have the type FT_Pointer to relax compilation
    *  dependencies.  We assume the developer isn't completely stupid.
    *
-   *  Each field must be named service_XXXX where XXX correspond to
-   *  the correct FT_SERVICE_ID_XXXX macro. see the definition of
-   *  FT_FACE_LOOKUP_SERVICE below to see why
+   *  Each field must be named `service_XXXX' where `XXX' corresponds to
+   *  the correct FT_SERVICE_ID_XXXX macro.  See the definition of
+   *  FT_FACE_LOOKUP_SERVICE below how this is implemented.
    *
    */
   typedef struct  FT_ServiceCacheRec_
@@ -163,20 +162,16 @@ FT_BEGIN_HEADER
    *   id ::
    *     The service ID.
    *
-   *   ptrtype ::
-   *     The pointer type of `ptr'.  This is needed to make FreeType
-   *     compile cleanly with C++.
-   *
    * @output:
    *   ptr ::
    *     A variable receiving the service data.  NULL if not available.
    */
 #define FT_FACE_LOOKUP_SERVICE( face, ptr, id )                  \
   FT_BEGIN_STMNT                                                 \
+    /* the strange cast is to allow C++ compilation */           \
     FT_Pointer*  pptr = (FT_Pointer*)&(ptr);                     \
     FT_Pointer   svc;                                            \
                                                                  \
-    /* the strange cast is to allow C++ compilation */           \
                                                                  \
     svc = FT_FACE(face)->internal->services. service_ ## id ;    \
     if ( svc == FT_SERVICE_UNAVAILABLE )                         \
@@ -192,6 +187,7 @@ FT_BEGIN_HEADER
     }                                                            \
   FT_END_STMNT
 
+
   /*
    *  A macro used to define new service structure types.
    */
diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h
index 4037866..6ce543c 100644
--- a/include/freetype/internal/internal.h
+++ b/include/freetype/internal/internal.h
@@ -39,9 +39,7 @@
 #define FT_INTERNAL_TYPE1_TYPES_H         <freetype/internal/t1types.h>
 #define FT_INTERNAL_TYPE42_TYPES_H        <freetype/internal/t42types.h>
 #define FT_INTERNAL_CFF_TYPES_H           <freetype/internal/cfftypes.h>
-#define FT_INTERNAL_FNT_TYPES_H           <freetype/internal/fnttypes.h>
 #define FT_INTERNAL_BDF_TYPES_H           <freetype/internal/bdftypes.h>
-#define FT_INTERNAL_PFR_H                 <freetype/internal/pfr.h>
 
 #define FT_INTERNAL_POSTSCRIPT_NAMES_H    <freetype/internal/psnames.h>
 #define FT_INTERNAL_POSTSCRIPT_AUX_H      <freetype/internal/psaux.h>
diff --git a/include/freetype/internal/services/svpfr.h b/include/freetype/internal/services/svpfr.h
index e47cb6c..b610505 100644
--- a/include/freetype/internal/services/svpfr.h
+++ b/include/freetype/internal/services/svpfr.h
@@ -2,9 +2,9 @@
 /*                                                                         */
 /*  svpfr.h                                                                */
 /*                                                                         */
-/*    Internal PFR service functions (specification only).                 */
+/*    Internal PFR service functions (specification).                      */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2003 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -21,24 +21,30 @@
 
 #include FT_INTERNAL_SERVICE_H
 
+
 FT_BEGIN_HEADER
 
-#define  FT_SERVICE_ID_PFR_METRICS   "pfr-metrics"
 
-  typedef FT_Error  (*FT_PFR_GetMetricsFunc)( FT_Face    face,
-                                              FT_UInt   *aoutline,
-                                              FT_UInt   *ametrics,
-                                              FT_Fixed  *ax_scale,
-                                              FT_Fixed  *ay_scale );
+#define FT_SERVICE_ID_PFR_METRICS  "pfr-metrics"
+
+
+  typedef FT_Error
+  (*FT_PFR_GetMetricsFunc)( FT_Face    face,
+                            FT_UInt   *aoutline,
+                            FT_UInt   *ametrics,
+                            FT_Fixed  *ax_scale,
+                            FT_Fixed  *ay_scale );
 
-  typedef FT_Error  (*FT_PFR_GetKerningFunc)( FT_Face     face,
-                                              FT_UInt     left,
-                                              FT_UInt     right,
-                                              FT_Vector  *avector );
+  typedef FT_Error
+  (*FT_PFR_GetKerningFunc)( FT_Face     face,
+                            FT_UInt     left,
+                            FT_UInt     right,
+                            FT_Vector  *avector );
 
-  typedef FT_Error  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,
-                                              FT_UInt   gindex,
-                                              FT_Pos   *aadvance );
+  typedef FT_Error
+  (*FT_PFR_GetAdvanceFunc)( FT_Face   face,
+                            FT_UInt   gindex,
+                            FT_Pos   *aadvance );
 
 
   FT_DEFINE_SERVICE( PfrMetrics )
diff --git a/include/freetype/internal/services/svwinfnt.h b/include/freetype/internal/services/svwinfnt.h
index 3c0b1d2..57f7765 100644
--- a/include/freetype/internal/services/svwinfnt.h
+++ b/include/freetype/internal/services/svwinfnt.h
@@ -2,7 +2,7 @@
 /*                                                                         */
 /*  svwinfnt.h                                                             */
 /*                                                                         */
-/*    The FreeType Windows FNT/FONT service                                */
+/*    The FreeType Windows FNT/FONT service (specification).               */
 /*                                                                         */
 /*  Copyright 2003 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
@@ -19,17 +19,19 @@
 #ifndef __SVWINFNT_H__
 #define __SVWINFNT_H__
 
-
 #include FT_INTERNAL_SERVICE_H
 #include FT_WINFONTS_H
 
+
 FT_BEGIN_HEADER
 
 
 #define FT_SERVICE_ID_WINFNT  "winfonts"
 
-  typedef FT_Error  (*FT_WinFnt_GetHeaderFunc)( FT_Face               face,
-                                                FT_WinFNT_HeaderRec  *aheader );
+  typedef FT_Error
+  (*FT_WinFnt_GetHeaderFunc)( FT_Face               face,
+                              FT_WinFNT_HeaderRec  *aheader );
+
 
   FT_DEFINE_SERVICE( WinFnt )
   {
@@ -38,6 +40,7 @@ FT_BEGIN_HEADER
 
   /* */
 
+
 FT_END_HEADER
 
 
diff --git a/include/freetype/internal/services/svxf86nm.h b/include/freetype/internal/services/svxf86nm.h
index f38cbcb..3a33abc 100644
--- a/include/freetype/internal/services/svxf86nm.h
+++ b/include/freetype/internal/services/svxf86nm.h
@@ -2,7 +2,7 @@
 /*                                                                         */
 /*  svxf86nm.h                                                             */
 /*                                                                         */
-/*    The FreeType XFree86 services (specification).                       */
+/*    The FreeType XFree86 services (specification only).                  */
 /*                                                                         */
 /*  Copyright 2003 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
diff --git a/src/base/ftpfr.c b/src/base/ftpfr.c
index f49fab5..b1cd773 100644
--- a/src/base/ftpfr.c
+++ b/src/base/ftpfr.c
@@ -56,6 +56,7 @@
     {
       FT_Fixed  x_scale, y_scale;
 
+
       /* this is not a PFR font */
       *aoutline_resolution = face->units_per_EM;
       *ametrics_resolution = face->units_per_EM;
@@ -88,13 +89,10 @@
 
     service = ft_pfr_check( face );
     if ( service )
-    {
       error = service->get_kerning( face, left, right, avector );
-    }
     else if ( face )
-    {
-      error = FT_Get_Kerning( face, left, right, FT_KERNING_UNSCALED, avector );
-    }
+      error = FT_Get_Kerning( face, left, right,
+                              FT_KERNING_UNSCALED, avector );
     else
       error = FT_Err_Invalid_Argument;
 
@@ -117,7 +115,7 @@
       error = service->get_advance( face, gindex, aadvance );
     }
     else
-     /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
+      /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */
       error = FT_Err_Invalid_Argument;
 
     return error;
diff --git a/src/base/ftwinfnt.c b/src/base/ftwinfnt.c
index b7eda1d..46f618c 100644
--- a/src/base/ftwinfnt.c
+++ b/src/base/ftwinfnt.c
@@ -29,6 +29,7 @@
     FT_Service_WinFnt  service;
     FT_Error           error;
 
+
     error = FT_Err_Invalid_Argument;
 
     if ( face != NULL )
@@ -40,7 +41,9 @@
         error = service->get_header( face, header );
       }
     }
-    return  error;
+
+    return error;
   }
 
+
 /* END */
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 9dad6c3..c0fdc05 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -396,8 +396,10 @@
         else
           root->units_per_EM = 1000;
 
-        root->underline_position  = (FT_Short) (dict->underline_position >> 16);
-        root->underline_thickness = (FT_Short) (dict->underline_thickness >> 16);
+        root->underline_position  =
+          (FT_Short)( dict->underline_position >> 16 );
+        root->underline_thickness =
+          (FT_Short)( dict->underline_thickness >> 16 );
 
         /* retrieve font family & style name */
         root->family_name  = cff_index_get_name( &cff->name_index, face_index );
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 7945758..5834cd8 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -423,8 +423,10 @@
       root->height    = (FT_Short)(
         ( ( root->ascender - root->descender ) * 12 ) / 10 );
 
-      root->underline_position  = (FT_Short) (info->underline_position >> 16);
-      root->underline_thickness = (FT_Short) (info->underline_thickness >> 16);
+      root->underline_position =
+        (FT_Short)( info->underline_position >> 16 );
+      root->underline_thickness =
+        (FT_Short)( info->underline_thickness >> 16 );
 
       root->internal->max_points   = 0;
       root->internal->max_contours = 0;
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 949e3de..dfc7eb2 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -651,11 +651,12 @@
           error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
           if ( !error )
           {
-            error = pfr_load_bitmap_bits( p,
-                                          stream->limit,
-                                          format,
-                                          FT_BOOL(face->header.color_flags & 2),
-                                          &glyph->root.bitmap );
+            error = pfr_load_bitmap_bits(
+                      p,
+                      stream->limit,
+                      format,
+                      FT_BOOL(face->header.color_flags & 2),
+                      &glyph->root.bitmap );
           }
         }
       }
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 2207aef..9f3bed6 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -434,8 +434,10 @@
 
       root->max_advance_height = root->height;
 
-      root->underline_position  = (FT_Short)( info->underline_position >> 16 );
-      root->underline_thickness = (FT_Short)( info->underline_thickness >> 16 );
+      root->underline_position =
+        (FT_Short)( info->underline_position >> 16 );
+      root->underline_thickness =
+        (FT_Short)( info->underline_thickness >> 16 );
 
       root->internal->max_points   = 0;
       root->internal->max_contours = 0;
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 6bc2eac..13a5f47 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -637,11 +637,13 @@
   {
     FNT_Font  font = ((FNT_Face)face)->font;
 
+
     *aheader = font->header;
 
     return 0;
   }
 
+
   static const FT_Service_WinFntRec  winfnt_service_rec =
   {
     winfnt_get_header