Commit 2acb963baf4a37f3d388ae6dd20aa83832d70d74

Werner Lemberg 2003-04-23T06:47:12

Cleanups.

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
diff --git a/ChangeLog b/ChangeLog
index 2522b7e..37734bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -209,13 +209,16 @@
 
 2003-02-13  Graham Asher  <graham.asher@btinternet.com>
 
-	* include/freetype/ftincrem.h, src/cff/cffgload.c,
-	src/cid/cidgload.c, src/truetype/ttgload.c, src/type1/t1gload.c
-	[FT_CONFIG_OPTION_INCREMENTAL]: Changed the incremental loading
-	interface in a way that makes it simpler and allows glyph metrics to
-	be changed (e.g., by adding a constant, as required by CFF fonts)
-	rather than just overridden.  This was required to make the
-	GhsotScript-to-FreeType bridge work.
+	Changed the incremental loading interface in a way that makes it
+	simpler and allows glyph metrics to be changed (e.g., by adding a
+	constant, as required by CFF fonts) rather than just overridden. 
+	This was required to make the GhostScript-to-FreeType bridge work.
+
+	* src/cff/cffgload.c (cff_slot_load) [FT_CONFIG_OPTION_INCREMENTAL]:
+	Allow metrics to be overridden.
+	* src/cid/cidgload.c, src/truetype/ttgload.c, src/type1/t1gload.c
+	[FT_CONFIG_OPTION_INCREMENTAL]:
+	* include/freetype/ftincrem.h: Updated.
 
 2003-01-31  David Turner  <david@freetype.org>
 
@@ -513,10 +516,10 @@
 
 2002-11-23  David Turner  <david@freetype.org>
 
-	* src/cff/cffload.c (cff_charser_load): Modified charset loader to
-	accept pre-defined charsets, even when the font contains fewer
-	glyphs.  Also enforced more checks to ensure that we never overflow
-	the character codes array in the encoding.
+	* src/cff/cffload.c (cff_charset_load, cff_encoding_load): Modified
+	charset loader to accept pre-defined charsets, even when the font
+	contains fewer glyphs.  Also enforced more checks to ensure that we
+	never overflow the character codes array in the encoding.
 
 2002-11-22  Antoine Leca  <Antoine-Freetype@Leca-Marti.org>
 
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index 4f60266..62e7ca7 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -2,7 +2,7 @@
 
     FreeType font driver for bdf files
 
-    Copyright (C) 2001-2002 by
+    Copyright (C) 2001, 2002, 2003 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -637,6 +637,7 @@ THE SOFTWARE.
   {
     bdf_property_t*  prop;
 
+
     FT_ASSERT( face && face->bdffont );
 
     prop = bdf_get_font_property( face->bdffont, (char*)prop_name );
@@ -644,26 +645,27 @@ THE SOFTWARE.
     {
       switch ( prop->format )
       {
-        case BDF_ATOM:
-          aproperty->type   = BDF_PROPERTY_TYPE_ATOM;
-          aproperty->u.atom = prop->value.atom;
-          break;
-
-        case BDF_INTEGER:
-          aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
-          aproperty->u.integer = prop->value.int32;
-          break;
-
-        case BDF_CARDINAL:
-          aproperty->type       = BDF_PROPERTY_TYPE_CARDINAL;
-          aproperty->u.cardinal = prop->value.card32;
-          break;
-
-        default:
-          goto Fail;
+      case BDF_ATOM:
+        aproperty->type   = BDF_PROPERTY_TYPE_ATOM;
+        aproperty->u.atom = prop->value.atom;
+        break;
+
+      case BDF_INTEGER:
+        aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
+        aproperty->u.integer = prop->value.int32;
+        break;
+
+      case BDF_CARDINAL:
+        aproperty->type       = BDF_PROPERTY_TYPE_CARDINAL;
+        aproperty->u.cardinal = prop->value.card32;
+        break;
+
+      default:
+        goto Fail;
       }
       return 0;
     }
+
   Fail:
     return FT_Err_Invalid_Argument;
   }
@@ -676,7 +678,7 @@ THE SOFTWARE.
     FT_UNUSED( module );
 
     if ( name && ft_strcmp( name, "get_bdf_property" ) == 0 )
-      return (FT_Module_Interface) bdf_get_bdf_property;
+      return (FT_Module_Interface)bdf_get_bdf_property;
 
     return NULL;
   }
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 8366ce5..bdb83ab 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType CharMap cache (body)                                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -193,16 +193,17 @@
         break;
 
       case FTC_CMAP_BY_ENCODING:
-        if (desc->u.encoding == FT_ENCODING_UNICODE)
+        if ( desc->u.encoding == FT_ENCODING_UNICODE )
         {
-         /* since the `interesting' table, with id's 3,10, is normally the
-          * last one, we loop backwards. This looses with type1 fonts with
-          * non-BMP characters (<.0001%), this wins with .ttf with non-BMP
-          * chars (.01% ?), and this is the same about 99.99% of the time!
-          */
+          /* Since the `interesting' table, pid/eid (3,10), is normally the
+           * last one, we loop backwards.  This looses with type1 fonts with
+           * non-BMP characters (<.0001%), this wins with .ttf with non-BMP
+           * chars (.01% ?), and this is the same about 99.99% of the time!
+           */
 
           FT_UInt  unicmap_idx = count;  /* some UCS-2 map, if we found it */
 
+
           cur += count - 1;
 
           for ( idx = 0; idx < count; idx++, cur-- )
@@ -211,15 +212,15 @@
             {
               unicmap_idx = idx;  /* record we found a Unicode charmap */
 
-             /* XXX If some new encodings to represent UCS-4 are added,
-              *     they should be added here.
-              */
+              /* XXX If some new encodings to represent UCS-4 are added,
+               *     they should be added here.
+               */
               if ( ( cur[0]->platform_id == TT_PLATFORM_MICROSOFT &&
-                     cur[0]->encoding_id == TT_MS_ID_UCS_4        )          ||
+                     cur[0]->encoding_id == TT_MS_ID_UCS_4        )      ||
                    ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE &&
-                     cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32    )      )
+                     cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32    )  )
 
-              /* Hurray! We found a UCS-4 charmap. We can stop the scan! */
+              /* Hurray! We found a UCS-4 charmap.  We can stop the scan! */
               {
                 idx = count - 1 - idx;
                 goto Found_idx_for_FTC_CMAP_BY_ENCODING;
@@ -227,9 +228,9 @@
             }
           }
 
-         /* We do not have any UCS-4 charmap. Sigh.
-          * Let's see if we have some other kind of Unicode charmap, though.
-          */
+          /* We do not have any UCS-4 charmap. Sigh.
+           * Let's see if we have some other kind of Unicode charmap, though.
+           */
           if ( unicmap_idx < count )
             idx = count - 1 - unicmap_idx;
         }
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 5840382..594c92a 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType sbits manager (body).                                       */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -189,7 +189,7 @@
           sbit->format    = (FT_Byte)bitmap->pixel_mode;
           sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
 
-#if 0 /* this doesn't work well with embedded bitmaps !! */
+#if 0 /* this doesn't work well with embedded bitmaps */
 
           /* grab the bitmap when possible - this is a hack! */
           if ( slot->flags & FT_GLYPH_OWN_BITMAP )
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index 4eab0d9..bd450be 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Simple LRU list-cache (body).                                        */
 /*                                                                         */
-/*  Copyright 2000-2001, 2002 by                                           */
+/*  Copyright 2000-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -188,40 +188,40 @@
       goto Exit;
     }
 
-   /* since we haven't found the relevant element in our LRU list,
+   /* Since we haven't found the relevant element in our LRU list,
     * we're going to "create" a new one.
     *
-    * the following code is a bit special, because it tries to handle
+    * The following code is a bit special, because it tries to handle
     * out-of-memory conditions (OOM) in an intelligent way.
     *
-    * more precisely, if not enough memory is available to create a
+    * More precisely, if not enough memory is available to create a
     * new node or "flush" an old one, we need to remove the oldest
-    * elements from our list, and try again. since several tries may
-    * be necessary, a loop is needed
+    * elements from our list, and try again.  Since several tries may
+    * be necessary, a loop is needed.
     *
-    * this loop will only exit when:
+    * This loop will only exit when:
     *
-    *   - a new node was succesfully created, or an old node flushed
+    *   - a new node was successfully created, or an old node flushed
     *   - an error other than FT_Err_Out_Of_Memory is detected
     *   - the list of nodes is empty, and it isn't possible to create
     *     new nodes
     *
-    * on each unsucesful attempt, one node will be removed from the list
+    * On each unsuccessful attempt, one node will be removed from the list.
     *
     */
     
     {
-      FT_Int   drop_last = ( list->max_nodes > 0 && 
-                             list->num_nodes >= list->max_nodes );
+      FT_Int  drop_last = ( list->max_nodes > 0 && 
+                            list->num_nodes >= list->max_nodes );
 
       for (;;)
       {
         node = NULL;
 
-       /* when "drop_last" is true, we should free the last node in
-        * the list to make room for a new one. note that we re-use
-        * its memory block to save allocation calls.
-        */
+        /* If "drop_last" is true, we should free the last node in
+         * the list to make room for a new one.  Note that we reuse
+         * its memory block to save allocation calls.
+         */
         if ( drop_last )
         {
          /* find the last node in the list
@@ -244,10 +244,10 @@
             node  = *pnode;
           }
   
-         /* remove it from the list, and try to "flush" it. doing this will
-          * save a significant number of dynamic allocations compared to
-          * a classic destroy/create cycle
-          */
+          /* Remove it from the list, and try to "flush" it.  Doing this will
+           * save a significant number of dynamic allocations compared to
+           * a classic destroy/create cycle.
+           */
           *pnode = NULL;
           list->num_nodes -= 1;
   
@@ -257,14 +257,14 @@
             if ( !error )
               goto Success;
 
-           /* note that if an error occured during the flush, we need to
+           /* Note that if an error occured during the flush, we need to
             * finalize it since it is potentially in incomplete state.
             */
           }
 
-         /* we finalize, but do not destroy the last node, we
-          * simply re-use its memory block !
-          */
+          /* We finalize, but do not destroy the last node, we
+           * simply reuse its memory block!
+           */
           if ( clazz->node_done )
             clazz->node_done( node, list->data );
             
@@ -272,8 +272,8 @@
         }
         else
         {
-         /* try to allocate a new node when "drop_last" is not TRUE
-          * this usually happens on the first pass, when the LRU list
+         /* Try to allocate a new node when "drop_last" is not TRUE.
+          * This usually happens on the first pass, when the LRU list
           * is not already full.
           */
           if ( FT_ALLOC( node, clazz->node_size ) )
@@ -316,7 +316,6 @@
   }
 
 
-
   FT_EXPORT_DEF( void )
   FT_LruList_Remove( FT_LruList  list,
                      FT_LruNode  node )
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 0432aa0..6c5c5d9 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType Glyph Loader (body).                                        */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -2366,12 +2366,13 @@
  #ifdef FT_CONFIG_OPTION_INCREMENTAL
 
     /* Incremental fonts can optionally override the metrics. */
-    if ( !error                                       &&
-         face->root.internal->incremental_interface   &&
+    if ( !error                                                              &&
+         face->root.internal->incremental_interface                          &&
          face->root.internal->incremental_interface->funcs->get_glyph_metrics )
     {
       FT_Incremental_MetricsRec  metrics;
 
+
       metrics.bearing_x = decoder.builder.left_bearing.x;
 	  metrics.bearing_y = decoder.builder.left_bearing.y;
 	  metrics.advance   = decoder.builder.advance.x;
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 66af469..5d22961 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1595,7 +1595,7 @@
       /* In order to use a predefined charset, the following must be  */
       /* true: The charset constructed for the glyphs in the font's   */
       /* charstrings dictionary must match the predefined charset in  */
-      /* the first num_glyphs                                         */
+      /* the first num_glyphs.                                        */
 
       charset->offset = offset;  /* record charset type */
 
@@ -1749,9 +1749,10 @@
         {
           FT_Byte*  p;
 
-          /* by convention, GID 0 is always ".notdef" and is never */
-          /* coded in the font. Hence, the number of codes found   */
-          /* in the table is 'count+1'                             */
+
+          /* By convention, GID 0 is always ".notdef" and is never */
+          /* coded in the font.  Hence, the number of codes found  */
+          /* in the table is `count+1'.                            */
           /*                                                       */
           encoding->count = count + 1;
 
@@ -1821,7 +1822,7 @@
             }
           }
 
-          /* simple check, one never knows what can be found in a font */
+          /* simple check; one never knows what can be found in a font */
           if ( encoding->count > 256 )
             encoding->count = 256;
         }
@@ -1923,8 +1924,8 @@
               encoding->codes[j] = (FT_UShort)i;
 
               /* update encoding count */
-              if ( encoding->count < j+1 )
-                encoding->count = j+1;
+              if ( encoding->count < j + 1 )
+                encoding->count = j + 1;
             }
           }
         }