Commit 2d8629b3931dfc66ce5411553e89ea8ffd1b0f7e

Werner Lemberg 2006-09-03T06:18:45

* devel/ftoption.h: Synchronize with include/freetype/config/ftoption.h. * src/smooth/ftgrays.c (gray_record_cell): Remove shadowing variable declaration. (gray_convert_glyph): Fix compiler warnings. Formatting, copyright years.

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
diff --git a/ChangeLog b/ChangeLog
index 0275ef8..b299b53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,38 @@
-2006-09-01  David Turner  <david@freetype.org>
+2006-09-03  Werner Lemberg  <wl@gnu.org>
+
+	* devel/ftoption.h: Synchronize with
+	include/freetype/config/ftoption.h.
 
-    * src/truetype/ttobjs.c: updated the TrueType loader to recognize
-    a few fonts that require the automatic unpatented loader
+	* src/smooth/ftgrays.c (gray_record_cell): Remove shadowing
+	variable declaration.
+	(gray_convert_glyph): Fix compiler warnings.
 
-    * src/smooth/ftgrays.c: optmized the performance of the anti-aliased
-    rasterizer. The speed gains is between 15% and 25%, depending on
-    content
+2006-09-01  David Turner  <david@freetype.org>
+
+	* src/truetype/ttobjs.c (tt_face_init): Update the TrueType loader
+	to recognize a few fonts that require the automatic unpatented
+	loader.
+
+	* src/smooth/ftgrays.c: Optmize the performance of the anti-aliased
+	rasterizer.  The speed improvement is between 15% and 25%, depending
+	on the font data.
+
+	(GRAYS_USE_GAMMA, GRAYS_COMPACT): Removed, and all associated code.
+	(TCell): Redefine.
+	(TRaster): New members `buffer', `buffer_size', `ycells', `ycount'.
+	(gray_init_cells): Updated.
+	(gray_find_cell, gray_alloc_cell): New functions.
+	(gray_record_cell): Rewritten to use `gray_find_cell' and
+	`gray_alloc_cell'.
+	(PACK, LESS_THAN, SWAP_CELLS, DEBUG_SORT, QUICK_SORT, SHELL_SORT,
+	QSORT_THRESHOLD):
+	Removed.
+	(gray_shell_sort, gray_quick_sort, gray_check_sort,
+	gray_dump_cells): Removed.
+	(gray_sweep): Rewritten.
+	(gray_convert_glyph): Rewrite code which used one of the sorting
+	functions.
+	(gray_raster_render): Updated.
 
 2006-08-29  Dr. Werner Fink  <werner@suse.de>
 
@@ -14,28 +41,45 @@
 
 2006-08-27  David Turner  <david@freetype.org>
 
-	<TO BE WRITTEN>
+	* include/freetype/config/ftoption.h (TT_USE_BYTECODE_INTERPRETER):
+	New macro, defined if either TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+	or TT_CONFIG_OPTION_UNPATENTED_HINTING is defined.
+
+	* include/freetype/internal/ftcalc.h, src/base/ftcalc.c,
+	src/truetype/truetype.c, src/truetype/ttdriver.c,
+	src/truetype/ttgload.c, src/truetype/ttgload.h,
+	src/truetype/ttinterp.c, src/truetype/ttobjs.c,
+	src/truetype/ttobjs.h, src/truetype/ttpload.c, src/type42/t42drivr.c:
+	s/TT_CONFIG_OPTION_BYTECODE_INTERPRETER/TT_USE_BYTECODE_INTERPRETER/.
+
+	* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New
+	member `force_autohint'.
+
+	* src/base/ftobjs.c (FT_Load_Glyph): Use `force_autohint'.
+
+	* src/truetype/ttobjs.c (tt_face_init): Prepare code for testing
+	against a list of font names which need the bytecode interpreter.
 
 2006-08-27  Jens Claudius  <jens.claudius@yahoo.com>
 
 	Fix miscellaneous compiler warnings.
 
-	* freetype2/include/freetype/internal/ftobjs.h: close
-	comment with `*/' to avoid `/* in comment' compiler warning.
+	* freetype2/include/freetype/internal/ftobjs.h: Close comment with
+	`*/' to avoid `/* in comment' compiler warning.
 
-	* freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn
-	cast `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)'
-	since on 64-bit platforms void* is larger than FT_UInt32.
+	* freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn cast
+	`(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)' since on
+	64-bit platforms void* is larger than FT_UInt32.
 
-	* freetype2/src/base/ftobjs.c (t_validator_error): cast
-	away volatileness of argument to ft_longjmp. Spotted by
-	Werner `Putzfrau' Lemberg.
+	* freetype2/src/base/ftobjs.c (t_validator_error): Cast away
+	volatileness of argument to ft_longjmp.  Spotted by Werner
+	`Putzfrau' Lemberg.
 
-	* freetype2/src/bdf/bdflib.c (bdf_load_font): initialize
-	local variable `lineno'.
+	* freetype2/src/bdf/bdflib.c (bdf_load_font): Initialize local
+	variable `lineno'.
 
-	* freetype2/src/gxvalid/gxvmod.c (classic_kern_validate):
-	mark local variable `error' volatile.
+	* freetype2/src/gxvalid/gxvmod.c (classic_kern_validate): Mark local
+	variable `error' as volatile.
 
 2006-08-27  Werner Lemberg  <wl@gnu.org>
 
@@ -1248,10 +1292,10 @@
 	(FTC_CMapCache_Lookup) [FT_CONFIG_OPTION_OLD_INTERNALS]: New
 	compatibility code.
 
-    * src/cache/ftcbasic.c: fixed a silly bug that prevented our super-duper
-    "hack" to support rogue clients compiled against 2.1.7 to work correctly.
-    Probably explains the GNUstep crashes with the second release
-    candidate.
+	* src/cache/ftcbasic.c: Fix a silly bug that prevented our `hack' to
+	support rogue clients compiled against 2.1.7 to work correctly. 
+	This probably explains the GNUstep crashes with the second release
+	candidate.
 
 2006-02-23  Chia-I Wu  <b90201047@ntu.edu.tw>
 
diff --git a/devel/ftoption.h b/devel/ftoption.h
index a7a3d0b..fb20804 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -471,7 +471,7 @@ FT_BEGIN_HEADER
   /* component offsets in composite glyphs.                                */
   /*                                                                       */
   /* Apple and MS disagree on the default behavior of component offsets    */
-  /* in composites.  Apple says that they should be scaled by the scale    */
+  /* in composites.  Apple says that they should be scaled by the scaling  */
   /* factors in the transformation matrix (roughly, it's more complex)     */
   /* while MS says they should not.  OpenType defines two bits in the      */
   /* composite flags array which can be used to disambiguate, but old      */
@@ -594,6 +594,16 @@ FT_BEGIN_HEADER
 #undef FT_CONFIG_OPTION_OLD_INTERNALS
 
 
+  /*
+   * This variable is defined if either unpatented or native TrueType
+   * hinting is requested by the definitions above.
+   */
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+#define  TT_USE_BYTECODE_INTERPRETER
+#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
+#define  TT_USE_BYTECODE_INTERPRETER
+#endif
+
 FT_END_HEADER
 
 
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 6821134..bb939e9 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -572,7 +572,7 @@ FT_BEGIN_HEADER
 #define AF_CONFIG_OPTION_CJK
 
 
- /* */
+  /* */
 
   /*
    * This temporary macro is used to control various optimizations for
@@ -594,14 +594,14 @@ FT_BEGIN_HEADER
 #define FT_CONFIG_OPTION_OLD_INTERNALS
 
 
- /*
-  * this variable is defined if either unpatented or native TrueType
-  * hinting is requested by the definitions above.
-  */
+  /*
+   * This variable is defined if either unpatented or native TrueType
+   * hinting is requested by the definitions above.
+   */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
-#  define  TT_USE_BYTECODE_INTERPRETER
+#define  TT_USE_BYTECODE_INTERPRETER
 #elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
-#  define  TT_USE_BYTECODE_INTERPRETER
+#define  TT_USE_BYTECODE_INTERPRETER
 #endif
 
 FT_END_HEADER
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index fb9e58f..38eef7b 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -212,25 +212,25 @@ FT_BEGIN_HEADER
   /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
   /*                                                                       */
   /*    force_autohing ::                                                  */
-  /*      this boolean flag is used to instruct the glyph loader to        */
-  /*      ignore the format-specific hinter, and use the auto-hinter       */
-  /*      instead to load all glyphs.                                      */
+  /*      This boolean flag instructs the glyph loader to ignore the       */
+  /*      format-specific hinter, and to use the auto-hinter instead to    */
+  /*      load all glyphs.                                                 */
   /*                                                                       */
-  /*      if the unpatented bytecode interpreter was compiled withing      */
-  /*      the library then:                                                */
+  /*      If the unpatented bytecode interpreter is compiled into the      */
+  /*      library, then:                                                   */
   /*                                                                       */
   /*      - if this is one of the tricky Asian fonts, like Gulim, which    */
   /*        absolutely require a bytecode interpreter to load anything     */
-  /*        properly, the flag will be set to FALSE                        */
+  /*        properly, the flag is set to FALSE                             */
   /*                                                                       */
-  /*      - for other fonts, the flag will be set to TRUE, and the         */
-  /*        auto-hinter will be used to scale the glyphs.                  */
+  /*      - for other fonts, the flag is set to TRUE, and the auto-hinter  */
+  /*        is used to scale the glyphs.                                   */
   /*                                                                       */
-  /*      if the unpatented bytecode interpretr was *not* compiled         */
-  /*      within the librayr, the flag will always be FALSE                */
+  /*      If the unpatented bytecode interpreter is not compiled into      */
+  /*      the library, the flag is always set to FALSE.                    */
   /*                                                                       */
-  /*      the detection of "tricky" fonts is located in the TrueType       */
-  /*      face loader.                                                     */
+  /*      The detection of `tricky' fonts is located in the TrueType       */
+  /*      face loader, testing against a bunch of font names.              */
   /*                                                                       */
   typedef struct  FT_Face_InternalRec_
   {
@@ -644,8 +644,8 @@ FT_BEGIN_HEADER
 
 
   /* Set this debug hook to a non-null pointer to force unpatented hinting */
-  /* for all faces when both TT_USE_BYTECODE_INTERPRETER and     */
-  /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. this is only used    */
+  /* for all faces when both TT_USE_BYTECODE_INTERPRETER and               */
+  /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined.  This is only used   */
   /* during debugging.                                                     */
 #define FT_DEBUG_HOOK_UNPATENTED_HINTING  1
 
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 6b19c2f..0410d5f 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -133,10 +133,8 @@
 #define FT_TRACE( x )  do ; while ( 0 )     /* nothing */
 #endif
 
-
 #else /* _STANDALONE_ */
 
-
 #include <ft2build.h>
 #include "ftgrays.h"
 #include FT_INTERNAL_OBJECTS_H
@@ -148,7 +146,6 @@
 #define ErrRaster_Invalid_Mode     Smooth_Err_Cannot_Render_Glyph
 #define ErrRaster_Invalid_Outline  Smooth_Err_Invalid_Outline
 
-
 #endif /* _STANDALONE_ */
 
 
@@ -326,13 +323,13 @@ typedef struct TCell_
     ras.buffer      = buffer;
     ras.buffer_size = byte_size;
 
-    ras.ycells    = (PCell*) buffer;
-    ras.cells     = NULL;
-    ras.max_cells = 0;
-    ras.num_cells = 0;
-    ras.area      = 0;
-    ras.cover     = 0;
-    ras.invalid   = 1;
+    ras.ycells      = (PCell*) buffer;
+    ras.cells       = NULL;
+    ras.max_cells   = 0;
+    ras.num_cells   = 0;
+    ras.area        = 0;
+    ras.cover       = 0;
+    ras.invalid     = 1;
   }
 
 
@@ -385,11 +382,12 @@ typedef struct TCell_
   /* Record the current cell in the table.                                 */
   /*                                                                       */
   static PCell*
-  gray_find_cell( RAS_ARG_  TCoord  x,
-                            TCoord  y )
+  gray_find_cell( RAS_ARG_ TCoord  x,
+                           TCoord  y )
   {
     PCell  *pnode, node;
 
+
     pnode = &ras.ycells[y];
     for (;;)
     {
@@ -399,15 +397,17 @@ typedef struct TCell_
 
       pnode = &node->next;
     }
-    return  pnode;
+
+    return pnode;
   }
 
 
   static PCell
-  gray_alloc_cell( RAS_ARG_  TCoord  x )
+  gray_alloc_cell( RAS_ARG_ TCoord  x )
   {
     PCell  cell;
 
+
     if ( ras.num_cells >= ras.max_cells )
       ft_longjmp( ras.jump_buffer, 1 );
 
@@ -423,13 +423,10 @@ typedef struct TCell_
   static void
   gray_record_cell( RAS_ARG )
   {
-    PCell  cell;
-
-
     if ( !ras.invalid && ( ras.area | ras.cover ) )
     {
-      TCoord  x       = (TCoord)(ras.ex - ras.min_ex);
-      TCoord  y       = (TCoord)(ras.ey - ras.min_ey);
+      TCoord  x       = (TCoord)( ras.ex - ras.min_ex );
+      TCoord  y       = (TCoord)( ras.ey - ras.min_ey );
       PCell  *pparent = gray_find_cell( RAS_VAR_ x, y );
       PCell   cell    = *pparent;
 
@@ -445,6 +442,7 @@ typedef struct TCell_
     }
   }
 
+
   /*************************************************************************/
   /*                                                                       */
   /* Set the current cell to a new position.                               */
@@ -1257,6 +1255,7 @@ typedef struct TCell_
 
     FT_UNUSED( target );
 
+
     if ( ras.num_cells == 0 )
       return;
 
@@ -1268,15 +1267,18 @@ typedef struct TCell_
       TCoord  cover = 0;
       TCoord  x     = 0;
 
+
       for ( ; cell != NULL; cell = cell->next )
       {
         TArea  area;
 
+
         if ( cell->x > x && cover != 0 )
-          gray_hline( RAS_VAR_ x, yindex, cover*(ONE_PIXEL*2), cell->x - x );
+          gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),
+                      cell->x - x );
 
         cover += cell->cover;
-        area   = cover*(ONE_PIXEL*2) - cell->area;
+        area   = cover * ( ONE_PIXEL * 2 ) - cell->area;
 
         if ( area != 0 && cell->x >= 0 )
           gray_hline( RAS_VAR_ cell->x, yindex, area, 1 );
@@ -1285,8 +1287,8 @@ typedef struct TCell_
       }
 
       if ( cover != 0 )
-        gray_hline( RAS_VAR_ x, yindex, cover*(ONE_PIXEL*2),
-                    (ras.max_ex - x) );
+        gray_hline( RAS_VAR_ x, yindex, cover * ( ONE_PIXEL * 2 ),
+                    ras.max_ex - x );
     }
 
     if ( ras.render_span && ras.num_gray_spans > 0 )
@@ -1294,6 +1296,7 @@ typedef struct TCell_
                        ras.gray_spans, ras.render_span_data );
   }
 
+
 #ifdef _STANDALONE_
 
   /*************************************************************************/
@@ -1646,9 +1649,10 @@ typedef struct TCell_
         int   error;
 
         {
-          PCell   cells_max;
-          int     yindex, ycount;
-          long    cell_start, cell_mod;
+          PCell  cells_max;
+          int    yindex;
+          long   cell_start, cell_mod;
+
 
           ras.ycells = (PCell*)ras.buffer;
           ras.ycount = band->max - band->min;
@@ -1656,18 +1660,18 @@ typedef struct TCell_
           for ( yindex = 0; yindex < ras.ycount; yindex++ )
             ras.ycells[yindex] = NULL;
 
-          cell_start = sizeof(PCell)*ras.ycount;
-          cell_mod   = cell_start % sizeof(TCell);
+          cell_start = sizeof ( PCell ) * ras.ycount;
+          cell_mod   = cell_start % sizeof ( TCell );
           if ( cell_mod > 0 )
-            cell_start += sizeof(TCell) - cell_mod;
+            cell_start += sizeof ( TCell ) - cell_mod;
 
-          cells_max = (PCell)(ras.buffer + ras.buffer_size);
-          ras.cells = (PCell)((char*)ras.buffer + cell_start);
+          cells_max = (PCell)( (char*)ras.buffer + ras.buffer_size );
+          ras.cells = (PCell)( (char*)ras.buffer + cell_start );
           if ( ras.cells >= cells_max )
             goto ReduceBands;
 
-          ras.max_cells = (cells_max - ras.cells);
-          if (ras.max_cells < 2)
+          ras.max_cells = cells_max - ras.cells;
+          if ( ras.max_cells < 2 )
             goto ReduceBands;
         }
 
diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c
index 5cb342a..b36473a 100644
--- a/src/truetype/truetype.c
+++ b/src/truetype/truetype.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType TrueType driver component (body only).                      */
 /*                                                                         */
-/*  Copyright 1996-2001, 2004 by                                           */
+/*  Copyright 1996-2001, 2004, 2006 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index c97caf8..b261e97 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    TrueType Glyph Loader (specification).                               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by                   */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index c9a0310..13eddf0 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -261,9 +261,8 @@
           face->unpatented_hinting = TRUE;
     }
 
-   /* compare the face with a list of well-known "tricky' fonts !!
-    * this list shall be expanded as we find them
-    */
+    /* Compare the face with a list of well-known `tricky' fonts. */
+    /* This list shall be expanded as we find more of them.       */
     if ( !face->unpatented_hinting )
     {
       static const char* const  trick_names[] =
@@ -275,11 +274,11 @@
         "PMingLiU",        /* mingliu.ttc */
         NULL
       };
-      int   nn;
+      int  nn;
 
-     /* note that we only check the face name at the moment, it might
-      * be worthy to do more checks for a few special cases
-      */
+
+      /* Note that we only check the face name at the moment; it might */
+      /* be worth to do more checks for a few special cases.           */
       for ( nn = 0; trick_names[nn] != NULL; nn++ )
       {
         if ( ft_strcmp( ttface->family_name, trick_names[nn] ) == 0 )
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 3b6c23b..ecd0473 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -209,9 +209,9 @@
     if ( info->is_fixed_pitch )
       root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
 
-    /* note, only define if we have the patented bytecode interpreter,
-     * there are no known "tricky" Type42 fonts that could be loaded
-     * with the unpatented interpreter */
+    /* We only set this flag if we have the patented bytecode interpreter. */
+    /* There are no known `tricky' Type42 fonts that could be loaded with  */
+    /* the unpatented interpreter.                                         */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
     root->face_flags |= FT_FACE_FLAG_HINTER;
 #endif