Commit cee37a3b0a34c88caa981f9ef8cd3080d1fe0def

Werner Lemberg 2005-11-12T07:34:40

Clean-up.

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
546
547
548
diff --git a/ChangeLog b/ChangeLog
index e52ec14..6cd782b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,42 +31,72 @@
 
 2005-10-28  David Turner  <david@freetype.org>
 
-	* builds/exports.mk, builds/freetype.mk, builds/compiler/visualc.mk,
-	builds/dos/dos-def.mk, builds/os2/os2-def.mk,
-	builds/unix/unix-cc.in, builds/unix/unixddef.mk,
-	builds/win32/w32-bcc.mk, builds/win32/w32-gcc.mk,
-	builds/win32/w32-icc.mk, builds/win32/w32-intl.mk,
-	builds/win32/w32-mingw32.mk, builds/win32/w32-vcc.mk,
-	builds/win32/w32-wat.mk, builds/win32/w32-def.mk, Jamfile: Update
-	build system to support the generation of a list of exported symbols
-	or Windows .DEF files by parsing the public headers with the
+	Update build system to support the generation of a list of exported
+	symbols or Windows .DEF files by parsing the public headers with the
 	`apinames' tool located in src/tools/apinames.c.
 
 	Only tested on Unix at the moment.  On Windows, the .DEF file is
 	generated but isn't used yet to generate a DLL.
 
-        * src/pfr/pfrtypes.h, src/pfr/pfrobjs.h, src/pfr/pfrload.c,
-        src/pfr/pfrobjs.c, src/pfr/pfrgload.c: integrated memory optimization
-        without FT_OPTIMIZE_MEMORY
+	* builds/exports.mk: New file.
+
+	* builds/freetype.mk: Include exports.mk.
+	(dll): New target.
+	(clean_project_dos): Fix rule.
+
+	* builds/compiler/visualc.mk (TE), builds/dos/dos-def.mk (E),
+	builds/os2/os2-def.mk (E), builds/win32/win32-def.mk (E): New
+	variables for controlling executable extensions.
+
+	* builds/unix/unix-cc.in (EXPORTS_LIST, CCexe),
+	builds/win32/w32-bcc.mk, builds/win32/w32-gcc.mk,
+	builds/win32/w32-icc.mk, builds/win32/w32-icc.mk,
+	builds/win32/w32-mingw32.mk, builds/win32/w32-vcc,
+	builds/win32/w32-wat.mk (EXPORTS_LIST, EXPORT_OPTIONS,
+	APINAMES_OPTIONS): New targets for controlling the `apinames' tool.
+
+	* Jamfile (GenExportSymbols): Updated.
+
 
-        * src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c
-        (FT_MulFix): Performance optimizations.
+	* src/pfr/pfrtypes.h, src/pfr/pfrload.c, src/pfr/pfrobjs.c
+	[!FT_OPTIMIZE_MEMORY]: Fold memory optimization code into
+	FT_OPTIMIZE_MEMORY chunks for better maintainability and simplicity.
 
-	* include/freetype/internal/ftgloader.h, src/base/ftgloader.h:
-	Introduce the FT_GLYPHLOADER_CHECKXXXX macros, and fix a small bug
-	within FT_GlyphLoader_CheckPoints which caused `AdjustPoints' to be
-	called everytime.
 
-	* src/autofit/afloader.c, src/truetype/ttgload.c: Performance
-	optimization: Use FT_GLYPHLOADER_CHECK_POINTS macro on
-	profile-detected hot-spots.
+	* src/base/fttrigon.c (ft_trig_prenorm), src/base/ftcalc.c
+	(FT_MulFix): Performance optimizations.
+
+
+	* include/freetype/internal/ftgloadr.h (FT_GLYPHLOADER_CHECK_P,
+	FT_GLYPHLOADER_CHECK_C, FT_GLYPHLOADER_CHECK_POINTS): New macros for
+	checking points and contours.  Update callers to use
+	FT_GLYPHLOADER_CHECK_POINTS instead of FT_GlyphLoader_CheckPoints
+	at profile-detected hot-spots.
+
+	* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Set `adjust'
+	to 0 to not call `AdjustPoints' every time.
+
 
 	* src/autofit/aftypes.h (AF_ANGLE_DIFF): New macro to inline
 	FT_Angle_Diff.
 
-	* src/autofit/afhints.c (af_direction_compute): Re-implement.  Use
+	* src/autofit/afhints.c (af_direction_compute): Re-implement.
+	(af_glyph_hints_compute_inflections, af_glyph_hints_reload): Use
 	AF_ANGLE_DIFF to speed up the detection of inflexions.
 
+
+	* src/tools/apinames.c: Include <string.h>.
+	(OutputFormat): New enumeration.
+	(names_dump): Add two parameters to control output format and DLL
+	name.
+	(names_dump_windef): Removed.  Code folded into `names_dump'.
+	(read_header_file): Use isalnum, not isalpha.  Otherwise function
+	names with digits aren't read correctly.
+	(usage): Updated.
+	(main): New option `-o' to control output file name.
+	New option `-d' to indicate DLL file name.
+	Extend `-w' flag to handle Borland and Watcom compilers and linkers.
+
 2005-10-28  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
 	* builds/mac/ftlib.prj, builds/mac/freetype.mak: Removed.
diff --git a/builds/compiler/visualc.mk b/builds/compiler/visualc.mk
index 498f5b9..594c819 100644
--- a/builds/compiler/visualc.mk
+++ b/builds/compiler/visualc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/dos/dos-def.mk b/builds/dos/dos-def.mk
index faed1ac..70391bc 100644
--- a/builds/dos/dos-def.mk
+++ b/builds/dos/dos-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -19,7 +19,7 @@ BUILD_DIR := $(TOP_DIR)/builds/dos
 PLATFORM  := dos
 
 
-# The executable file extension (for tools). NOTE: WE INCLUDE THE DOT HERE !!
+# The executable file extension (for tools), *with* leading dot.
 #
 E := .exe
 
diff --git a/builds/os2/os2-def.mk b/builds/os2/os2-def.mk
index b59710c..0e563ac 100644
--- a/builds/os2/os2-def.mk
+++ b/builds/os2/os2-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -18,7 +18,7 @@ SEP       := $(strip \ )
 BUILD_DIR := $(TOP_DIR)/builds/os2
 PLATFORM  := os2
 
-# The executable file extension (for tools). NOTE: WE INCLUDE THE DOT HERE !!
+# The executable file extension (for tools), *with* leading dot.
 #
 E := .exe
 
diff --git a/builds/win32/w32-bcc.mk b/builds/win32/w32-bcc.mk
index 5525dff..a9f48fc 100644
--- a/builds/win32/w32-bcc.mk
+++ b/builds/win32/w32-bcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/win32/w32-gcc.mk b/builds/win32/w32-gcc.mk
index 6f0a0e9..580afc5 100644
--- a/builds/win32/w32-gcc.mk
+++ b/builds/win32/w32-gcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/win32/w32-icc.mk b/builds/win32/w32-icc.mk
index 2f61c25..8819a1f 100644
--- a/builds/win32/w32-icc.mk
+++ b/builds/win32/w32-icc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000 by
+# Copyright 1996-2000, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/win32/w32-intl.mk b/builds/win32/w32-intl.mk
index 1c4a4bc..ae62e1b 100644
--- a/builds/win32/w32-intl.mk
+++ b/builds/win32/w32-intl.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/win32/w32-mingw32.mk b/builds/win32/w32-mingw32.mk
index aa22be9..04e9e21 100644
--- a/builds/win32/w32-mingw32.mk
+++ b/builds/win32/w32-mingw32.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/win32/w32-vcc.mk b/builds/win32/w32-vcc.mk
index 010a4d5..7fb8794 100644
--- a/builds/win32/w32-vcc.mk
+++ b/builds/win32/w32-vcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/win32/w32-wat.mk b/builds/win32/w32-wat.mk
index 1debcab..820b817 100644
--- a/builds/win32/w32-wat.mk
+++ b/builds/win32/w32-wat.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/win32/win32-def.mk b/builds/win32/win32-def.mk
index cd3e681..e402e74 100644
--- a/builds/win32/win32-def.mk
+++ b/builds/win32/win32-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h
index 50c557f..2aaff0d 100644
--- a/include/freetype/internal/ftgloadr.h
+++ b/include/freetype/internal/ftgloadr.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    The FreeType glyph loader (specification).                           */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -117,22 +117,24 @@ FT_BEGIN_HEADER
                               FT_UInt         n_points,
                               FT_UInt         n_contours );
 
-#define  FT_GLYPHLOADER_CHECK_P(_loader,_count)                         \
-   ( (_count) == 0 || (int)((_loader)->base.outline.n_points    +       \
-                            (_loader)->current.outline.n_points +       \
+
+#define FT_GLYPHLOADER_CHECK_P( _loader, _count )                    \
+   ( (_count) == 0 || (int)((_loader)->base.outline.n_points    +    \
+                            (_loader)->current.outline.n_points +    \
                             (_count)) <= (int)(_loader)->max_points )
 
-#define  FT_GLYPHLOADER_CHECK_C(_loader,_count)                           \
-  ( (_count) == 0 || (int)((_loader)->base.outline.n_contours         +   \
-                           (_loader)->current.outline.n_contours      +   \
+#define FT_GLYPHLOADER_CHECK_C( _loader, _count )                     \
+  ( (_count) == 0 || (int)((_loader)->base.outline.n_contours    +    \
+                           (_loader)->current.outline.n_contours +    \
                            (_count)) <= (int)(_loader)->max_contours )
 
-#define  FT_GLYPHLOADER_CHECK_POINTS(_loader,_points,_contours)       \
-  ( ( FT_GLYPHLOADER_CHECK_P(_loader,_points)   &&                    \
-      FT_GLYPHLOADER_CHECK_C(_loader,_contours) )                     \
-    ? 0                                                               \
+#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours )      \
+  ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points )   &&                  \
+      FT_GLYPHLOADER_CHECK_C( _loader, _contours ) )                   \
+    ? 0                                                                \
     : FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) )
 
+
   /* check that there is enough space to add `n_subs' sub-glyphs to */
   /* a glyph loader                                                 */
   FT_BASE( FT_Error )
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index 4e071cd..0826571 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -274,22 +274,25 @@
 #if 1
     AF_Direction  dir = AF_DIR_NONE;
 
+
+    /* atan(1/12) == 4.7 degrees */
+
     if ( dx < 0 )
     {
       if ( dy < 0 )
       {
-        if ( -dx*12 < -dy )
+        if ( -dx * 12 < -dy )
           dir = AF_DIR_DOWN;
 
-        else if ( -dy*12 < -dx )
+        else if ( -dy * 12 < -dx )
           dir = AF_DIR_LEFT;
       }
       else /* dy >= 0 */
       {
-        if ( -dx*12 < dy )
+        if ( -dx * 12 < dy )
           dir = AF_DIR_UP;
 
-        else if ( dy*12 < -dx )
+        else if ( dy * 12 < -dx )
           dir = AF_DIR_LEFT;
       }
     }
@@ -297,23 +300,26 @@
     {
       if ( dy < 0 )
       {
-        if ( dx*12 < -dy )
+        if ( dx * 12 < -dy )
           dir = AF_DIR_DOWN;
 
-        else if ( -dy*12 < dx )
+        else if ( -dy * 12 < dx )
           dir = AF_DIR_RIGHT;
       }
       else  /* dy >= 0 */
       {
-        if ( dx*12 < dy )
+        if ( dx * 12 < dy )
           dir = AF_DIR_UP;
 
-        else if ( dy*12 < dx )
+        else if ( dy * 12 < dx )
           dir = AF_DIR_RIGHT;
       }
     }
-    return  dir;
-#else
+
+    return dir;
+
+#else /* 0 */
+
     AF_Direction  dir;
     FT_Pos        ax = FT_ABS( dx );
     FT_Pos        ay = FT_ABS( dy );
@@ -335,7 +341,9 @@
     }
 
     return dir;
-#endif
+
+#endif /* 0 */
+
   }
 
 
@@ -394,7 +402,7 @@
 
       } while ( angle_in == angle_seg );
 
-      first   = start;
+      first = start;
 
       AF_ANGLE_DIFF( diff_in, angle_in, angle_seg );
 
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 3ade4ac..8a9aeb6 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (body).                                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -402,8 +402,10 @@
     if ( a == 0 || b == 0x10000L )
       return a;
 
-    sa = (a >> (sizeof(a)*8 - 1)); a = (a^sa) - sa;
-    sb = (b >> (sizeof(b)*8 - 1)); b = (b^sb) - sb;
+    sa = ( a >> ( sizeof ( a ) * 8 - 1 ) );
+     a = ( a ^ sa ) - sa;
+    sb = ( b >> ( sizeof ( b ) * 8 - 1 ) );
+     b = ( b ^ sb ) - sb;
 
     ua = (FT_ULong)a;
     ub = (FT_ULong)b;
@@ -422,10 +424,12 @@
     }
 
     sa ^= sb,
-    ua  = (FT_ULong)((ua ^ sa) - sa);
+    ua  = (FT_ULong)(( ua ^ sa ) - sa);
 
     return (FT_Long)ua;
-#else
+
+#else /* 0 */
+
     FT_Long   s;
     FT_ULong  ua, ub;
 
@@ -453,7 +457,9 @@
     }
 
     return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua );
-#endif
+
+#endif /* 0 */
+
   }
 
 
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index f3ae209..5c06439 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Mac FOND support.  Written by just@letterror.com.                    */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index bc6c45b..b25a152 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType trigonometric functions (body).                             */
 /*                                                                         */
-/*  Copyright 2001, 2002, 2003, 2004 by                                    */
+/*  Copyright 2001, 2002, 2003, 2004, 2005 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -110,23 +110,24 @@
     shift = 0;
 
 #if 1
-    /* determine msb bit index in 'shift' */
-    if ( z >= (1L << 16 ) )
+
+    /* determine msb bit index in `shift' */
+    if ( z >= ( 1L << 16 ) )
     {
       z     >>= 16;
       shift  += 16;
     }
-    if ( z >= (1L << 8) )
+    if ( z >= ( 1L << 8 ) )
     {
       z     >>= 8;
       shift  += 8;
     }
-    if ( z >= (1L << 4) )
+    if ( z >= ( 1L << 4 ) )
     {
       z     >>= 4;
       shift  += 4;
     }
-    if ( z >= (1L << 2) )
+    if ( z >= ( 1L << 2 ) )
     {
       z     >>= 2;
       shift  += 2;
@@ -136,8 +137,7 @@
 
     if ( shift < 28 )
     {
-      shift  = 28-shift;
-
+      shift = 28 - shift;
       vec->x = x << shift;
       vec->y = y << shift;
     }
@@ -148,7 +148,9 @@
       vec->y = y >> shift;
       shift  = -shift;
     }
-#else
+
+#else /* 0 */
+
     if ( z < ( 1L << 27 ) )
     {
       do
@@ -171,7 +173,9 @@
       vec->y = y >> shift;
       shift  = -shift;
     }
-#endif
+
+#endif /* 0 */
+
     return shift;
   }
 
diff --git a/src/pfr/pfrgload.c b/src/pfr/pfrgload.c
index 18d7a22..7cee187 100644
--- a/src/pfr/pfrgload.c
+++ b/src/pfr/pfrgload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR glyph loader (body).                                    */
 /*                                                                         */
-/*  Copyright 2002, 2003 by                                                */
+/*  Copyright 2002, 2003, 2005 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */