Commit f4c0b921a18ad421a022ee7c1d2449daae502ae0

Werner Lemberg 2003-09-30T05:39:35

* include/freetype/internal/t1types.h: Don't include FT_INTERNAL_OBJECTS_H but FT_INTERNAL_SERVICE_H. * src/truetype/ttobjs.c: Don't include FT_SERVICE_POSTSCRIPT_NAMES_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
diff --git a/ChangeLog b/ChangeLog
index b028391..b1cd95e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,27 +1,122 @@
-2003-09-29  David Turner  <david@freetype.org>
-
-        * src/base/ftglyph.c (FT_Get_Glyph): fixing small bug, thanks
-        to Henry Maddocks for spotting this
-
-        * include/freetype/internal/services/svpsname.h (added),
-        include/freetype/internal/psnames.h (removed),
-        include/freetype/internal/internal.h (FT_SERVICE_POSTSCRIPT_NAMES):
-
-          added new service to handle glyph name dictionaries, replacing
-          the old internal header named "psnames.h" by "services/svpsname.h"
-          note that this is different from "services/svpostnm.h" which only
-          handles the retrieval of Postscript font name for a given face.
-          (should we merge these two services into a single header ??)
+2003-09-29  Werner Lemberg  <wl@gnu.org>
 
+	* include/freetype/internal/t1types.h: Don't include
+	FT_INTERNAL_OBJECTS_H but FT_INTERNAL_SERVICE_H.
+	* src/truetype/ttobjs.c: Don't include
+	FT_SERVICE_POSTSCRIPT_NAMES_H.
 
-        * include/freetype/internal/ftserv.h: adding
-        FT_FACE_FIND_GLOBAL_SERVICE (used to lookup a service globally,
-        instead of only within the current module)
-
-        * include/freetype/internal/ftobjs.h, src/base/ftobjs.c: adding
-        the new base function ft_module_get_service
-
+2003-09-29  David Turner  <david@freetype.org>
 
+	Added new service to handle glyph name dictionaries, replacing the
+	old internal header named `psnames.h' by `services/svpsname.h'. 
+	Note that this is different from `services/svpostnm.h' which only
+	handles the retrieval of PostScript font names for a given face. 
+	(Should we merge these two services into a single header?)
+
+	* include/freetype/internal/psnames.h: Removed.  Most of its
+	contents is moved to...
+	* include/freetype/internal/services/svpsname.h: New file.
+
+	* include/freetype/internal/services/svpostnm.h
+	(FT_SERVICE_ID_POSTSCRIPT_NAME): Replaced with...
+	(FT_SERVICE_ID_POSTSCRIPT_FONT_NAME): New macro.
+	(PsName): Service named changed to...
+	(PsFontName): This.
+	Updated `FT_Service_PsName' -> `FT_Service_PsFontName' and
+	`POSTSCRIPT_NAME' -> `POSTSCRIPT_FONT_NAME' everywhere.
+
+	* include/freetype/internal/internal.h
+	(FT_INTERNAL_POSTSCRIPT_NAMES_H): Removed.
+	* include/freetype/internal/psaux.h: Include
+	FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(T1_DecoderRec): Updated type of `psnames'.
+	* include/freetype/internal/t1types.h: Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	Include FT_INTERNAL_OBJECTS_H.
+	* include/freetype/internal/t42types.h: Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H.
+	* include/freetype/internal/tttypes.h (TT_FaceRec): Updated.
+
+	* include/freetype/internal/ftserv.h (FT_FACE_FIND_SERVICE): Changed
+	order of parameters.  All callers updated.
+	(FT_FACE_FIND_GLOBAL_SERVICE): New macro to look up a service
+	globally, checking all modules.
+	(FT_ServiceCacheRec): Updated.
+	(FT_SERVICE_POSTSCRIPT_NAMES_H): New macro for accessing
+	`svpsname.h'.
+
+	* include/freetype/internal/ftobjs.h, src/base/ftobjs.c
+	(ft_module_get_service): New function.
+
+	* src/cff/cffdrivr.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H
+	but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(cff_get_glyph_name, cff_get_name_index): Use new POSTSCRIPT_NAMES
+	service.
+	* src/cff/cffcmap.c (cff_cmap_unicode_init): Updated.
+	* src/cff/cffload.c, src/cff/cffload.h:  Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(cff_index_get_sid_string): Updated.
+	* src/cff/cffobjs.c:  Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H
+	but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(cff_face_init): Use new POSTSCRIPT_NAMES service.
+	* src/cff/cffobjs.h:  Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H
+	but FT_SERVICE_POSTSCRIPT_NAMES_H.
+
+	* src/cid/cidobjs.c:  Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H
+	but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(cid_face_init): Use new POSTSCRIPT_NAMES service.
+	* src/cid/cidriver.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H.
+
+	* src/psaux/t1cmap.c (t1_cmap_std_init, t1_cmap_unicode_init): Use
+	new POSTSCRIPT_NAMES service.
+	* src/psaux/t1decode.h (t1_lookup_glyph_by_stdcharcode,
+	t1_decode_init): Use new POSTSCRIPT_NAMES service.
+	* src/psaux/t1cmap.h, src/psaux/t1decode.h: Dont' include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H.
+
+	* src/psnames/psmodule.c:  Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(ps_build_unicode_table): Renamed to...
+	(ps_unicodes_init): This.
+	(ps_lookup_unicode): Renamed to...
+	(ps_unicodes_char_index): This.
+	(ps_next_unicode): Renamed to...
+	(ps_unicodes_char_next): This.
+	(psnames_interface): Updated.
+	(psnames_services): New services list.
+	(psnames_get_service): New function.
+	(psnames_module_class): Updated.
+
+	* src/sfnt/sfobjs.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H
+	but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(sfnt_init_face): Use new POSTSCRIPT_NAMES service.
+	* src/sfnt/ttpost.c: Don't include FT_INTERNAL_POSTSCRIPT_NAMES_H
+	but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(tt_face_get_ps_name): Updated.
+
+	* src/truetype/ttobjs.c:  Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H.
+
+	* src/type1/t1driver.c:  Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	* src/type1/t1objs.c:  Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H.
+	(T1_Face_Init): Use new POSTSCRIPT_NAMES service.
+
+	* src/type42/t42drivr.c (t42_get_ps_name): Renamed to...
+	(t42_get_ps_font_name): This.
+	(t42_service_ps_name): Renamed to...
+	(t42_service_ps_font_name): This.
+	(t42_services): Updated.
+	* src/type42/t42objs.c (T42_Face_Init): Use new POSTSCRIPT_NAMES
+	service.
+	* src/type42/t42objs.h:  Don't include
+	FT_INTERNAL_POSTSCRIPT_NAMES_H but FT_SERVICE_POSTSCRIPT_NAMES_H.
+
+
+	* src/base/ftglyph.c (FT_Get_Glyph): Don't access `slot' before
+	testing its validity.  Reported by Henry Maddocks
+	<maddocks@metservice.com>.
 
 2003-09-21  Werner Lemberg  <wl@gnu.org>
 
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index bf17497..e0ee7cc 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -40,18 +40,18 @@ FT_BEGIN_HEADER
    *   FT_FACE_FIND_SERVICE
    *
    * @description:
-   *   This macro is used to lookup a service from a face's driver module.
+   *   This macro is used to look up a service from a face's driver module.
    *
    * @input:
+   *   face ::
+   *     The source face handle.
+   *
    *   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 is automatically prefixed with
    *     `FT_SERVICE_ID_'.
    *
-   *   face ::
-   *     The source face handle.
-   *
    * @output:
    *   ptr ::
    *     A variable that receives the service pointer.  Will be NULL
@@ -60,23 +60,49 @@ FT_BEGIN_HEADER
 #define FT_FACE_FIND_SERVICE( face, ptr, 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 */                      \
+    FT_Pointer*  Pptr   = (FT_Pointer*) &(ptr);                             \
+                                                                            \
+                                                                            \
     *Pptr = NULL;                                                           \
     if ( module->clazz->get_interface )                                     \
       *Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
   FT_END_STMNT
 
 
-#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, 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 = ft_module_get_service( module, FT_SERVICE_ID_ ## id );          \
+  /*
+   * @macro:
+   *   FT_FACE_FIND_GLOBAL_SERVICE
+   *
+   * @description:
+   *   This macro is used to look up a service from all modules.
+   *
+   * @input:
+   *   face ::
+   *     The source face handle.
+   *
+   *   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 is automatically prefixed with
+   *     `FT_SERVICE_ID_'.
+   *
+   * @output:
+   *   ptr ::
+   *     A variable that receives the service pointer.  Will be NULL
+   *     if not found.
+   */
+#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id )               \
+  FT_BEGIN_STMNT                                                   \
+    FT_Module    module = FT_MODULE( FT_FACE(face)->driver );      \
+    /* the strange cast is to allow C++ compilation */             \
+    FT_Pointer*  Pptr   = (FT_Pointer*) &(ptr);                    \
+                                                                   \
+                                                                   \
+    *Pptr = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
   FT_END_STMNT
 
+
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
diff --git a/include/freetype/internal/services/svpsname.h b/include/freetype/internal/services/svpsname.h
index 5a56179..279afda 100644
--- a/include/freetype/internal/services/svpsname.h
+++ b/include/freetype/internal/services/svpsname.h
@@ -1,36 +1,61 @@
+/***************************************************************************/
+/*                                                                         */
+/*  svpsname.h                                                             */
+/*                                                                         */
+/*    The FreeType glyph PS name services (specification).                 */
+/*                                                                         */
+/*  Copyright 2003 by                                                      */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used,       */
+/*  modified, and distributed under the terms of the FreeType project      */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
 #ifndef __SVPSNAME_H__
 #define __SVPSNAME_H__
 
+
 FT_BEGIN_HEADER
 
-#define  FT_SERVICE_ID_POSTSCRIPT_NAMES  "postscript-names"
 
- /*  Adobe glyph name to unicode value
-  */
+#define FT_SERVICE_ID_POSTSCRIPT_NAMES  "postscript-names"
+
+
+  /*
+   *  Adobe glyph name to unicode value
+   */
   typedef FT_UInt32
   (*PS_Unicode_ValueFunc)( const char*  glyph_name );
 
- /*  Unicode value to Adobe glyph name index. 0xFFFF if not found
-  */
+  /*
+   *  Unicode value to Adobe glyph name index. 0xFFFF if not found
+   */
   typedef FT_UInt
   (*PS_Unicode_Index_Func)( FT_UInt       num_glyphs,
                             const char**  glyph_names,
                             FT_ULong      unicode );
 
- /* Macintosh name id to glyph name, NULL if invalid index
-  */
+  /*
+   *  Macintosh name id to glyph name, NULL if invalid index
+   */
   typedef const char*
   (*PS_Macintosh_Name_Func)( FT_UInt  name_index );
 
- /* Adobe standard string id to glyph name, NULL if invalid index
-  */
+  /*
+   *  Adobe standard string id to glyph name, NULL if invalid index
+   */
   typedef const char*
   (*PS_Adobe_Std_Strings_Func)( FT_UInt  string_index );
 
-
- /* Simple unicode -> glyph index charmap built from font glyph names
-  * table
-  */
+  /*
+   *  Simple unicode -> glyph index charmap built from font glyph names
+   *  table.
+   */
   typedef struct  PS_UniMap_
   {
     FT_UInt  unicode;
@@ -61,6 +86,7 @@ FT_BEGIN_HEADER
   (*PS_Unicodes_CharNextFunc)( PS_Unicodes*  unicodes,
                                FT_ULong      unicode );
 
+
   FT_DEFINE_SERVICE( PsNames )
   {
     PS_Unicode_ValueFunc       unicode_value;
@@ -77,6 +103,8 @@ FT_BEGIN_HEADER
 
  /* */
 
+
 FT_END_HEADER
 
+
 #endif /* __SVPSNAME_H__ */
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index 851baa8..c688067 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -23,8 +23,8 @@
 
 #include <ft2build.h>
 #include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include FT_INTERNAL_SERVICE_H
 #include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 7e9db90..4b71b95 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1375,7 +1375,9 @@ FT_BEGIN_HEADER
   /*                            It must be called after the header was     */
   /*                            read, and before the `forget'.             */
   /*                                                                       */
-  /*    sfnt                 :: A pointer to the SFNT `driver' interface.  */
+  /*    sfnt                 :: A pointer to the SFNT service.             */
+  /*                                                                       */
+  /*    psnames              :: A pointer to the PostScript names service. */
   /*                                                                       */
   /*    hdmx                 :: The face's horizontal device metrics       */
   /*                            (`hdmx' table).  This table is optional in */
@@ -1494,14 +1496,15 @@ FT_BEGIN_HEADER
     TT_Loader_ReadGlyphFunc   read_simple_glyph;
     TT_Loader_ReadGlyphFunc   read_composite_glyph;
 
-    /* a typeless pointer to the SFNT_Interface table used to load     */
-    /* the basic TrueType tables in the face object                    */
+    /* a typeless pointer to the SFNT_Interface table used to load */
+    /* the basic TrueType tables in the face object                */
     void*                 sfnt;
 
-    /* a typeless pointer to the FT_Service_PsNamesRec table used to       */
-    /* handle glyph names <-> unicode & Mac values                     */
+    /* a typeless pointer to the FT_Service_PsNamesRec table used to */
+    /* handle glyph names <-> unicode & Mac values                   */
     void*                 psnames;
 
+
     /***********************************************************************/
     /*                                                                     */
     /* Optional TrueType/OpenType tables                                   */
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 258b6d1..f558bee 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -339,10 +339,10 @@
   {
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
-    (PS_Unicode_ValueFunc)          ps_unicode_value,
-    (PS_Unicodes_InitFunc)          ps_unicodes_init,
-    (PS_Unicodes_CharIndexFunc)     ps_unicodes_char_index,
-    (PS_Unicodes_CharNextFunc)      ps_unicodes_char_next,
+    (PS_Unicode_ValueFunc)     ps_unicode_value,
+    (PS_Unicodes_InitFunc)     ps_unicodes_init,
+    (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index,
+    (PS_Unicodes_CharNextFunc) ps_unicodes_char_next,
 
 #else
 
@@ -353,8 +353,8 @@
 
 #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
 
-    (PS_Macintosh_Name_Func)    ps_get_macintosh_name,
-    (PS_Adobe_Std_Strings_Func) ps_get_standard_strings,
+    (PS_Macintosh_Name_Func)   ps_get_macintosh_name,
+    (PS_Adobe_Std_Strings_Func)ps_get_standard_strings,
 
     t1_standard_encoding,
     t1_expert_encoding
@@ -363,10 +363,11 @@
 
   static const FT_ServiceDescRec  psnames_services[] =
   {
-    { FT_SERVICE_ID_POSTSCRIPT_NAMES, & psnames_interface },
+    { FT_SERVICE_ID_POSTSCRIPT_NAMES, &psnames_interface },
     { NULL, NULL }
   };
 
+
   static FT_Pointer
   psnames_get_service( FT_Module    module,
                        const char*  service_id )
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index e3a5c51..30da6d3 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -23,7 +23,6 @@
 #include FT_TRUETYPE_IDS_H
 #include FT_TRUETYPE_TAGS_H
 #include FT_INTERNAL_SFNT_H
-#include FT_SERVICE_POSTSCRIPT_NAMES_H
 
 #include "ttgload.h"
 #include "ttpload.h"