Commit a37745bad4e46c5ad0e690150b0ec8081ff81c90

Werner Lemberg 2005-03-23T16:45:24

* docs/CHANGES, docs/INSTALL.ANY: Updated. * include/freetype/ftmoderr.h: Replace `Autohint' with `Autofit'. Add `OTvalid'. * src/autofit/aferrors.h: New file. * src/autofit/afglobal.c, src/autofit/afhints.c, src/autofit/aflatin.c, src/autofit/afloader.c: s/FT_Err_/AF_Err_/. Include aferrors.h. * src/autofit/rules.mk (AUTOF_DRV_H): Include aferrors.h. * src/otvalid/otverror.h: s/FT_Mod_Err_OTV/FT_Mod_Err_OTvalid/.

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
diff --git a/ChangeLog b/ChangeLog
index dd13b98..3545eb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,24 @@
+2005-03-23  Werner Lemberg  <wl@gnu.org>
+
+	* docs/CHANGES, docs/INSTALL.ANY: Updated.
+
+	* include/freetype/ftmoderr.h: Replace `Autohint' with `Autofit'.
+	Add `OTvalid'.
+
+	* src/autofit/aferrors.h: New file.
+
+	* src/autofit/afglobal.c, src/autofit/afhints.c,
+	src/autofit/aflatin.c, src/autofit/afloader.c: s/FT_Err_/AF_Err_/.
+	Include aferrors.h.
+
+	* src/autofit/rules.mk (AUTOF_DRV_H): Include aferrors.h.
+
+	* src/otvalid/otverror.h: s/FT_Mod_Err_OTV/FT_Mod_Err_OTvalid/.
+
 2005-03-22  David Turner  <david@freetype.org>
 
-	* src/autohint/*, Jamfile: removing the 'autohint' module
-	from the build.
+	* src/autohint/*: Removed.
+	* Jamfile: Updated.
 
 2005-03-15  David Turner  <david@freetype.org>
 
diff --git a/docs/CHANGES b/docs/CHANGES
index cc19787..0dd370f 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -38,9 +38,10 @@ LATEST CHANGES BETWEEN 2.1.10 and 2.1.9
       memory-mapped font files  (which is the default on Unix  systems
       which support them).
 
-    - The auto-hinter  has been completely rewritten  as a new module,
-      called the `auto-fitter',  which is now the default auto-hinting
-      module.  It consumes a lot less memory than its predecessor.
+    - The auto-hinter  has been replaced with a new module, called the
+      `auto-fitter'.  It consumes  less memory  than its  predecessor,
+      and it is  prepared to support non-latin scripts  better in next
+      releases.
 
     - George Williams  contributed code to read  kerning data from PFM
       files.
@@ -74,19 +75,21 @@ LATEST CHANGES BETWEEN 2.1.10 and 2.1.9
     - A new option `--ftversion' has been  added to freetype-config to
       return the FreeType version.
 
-    - The memory debugger has been updated to dump allocation statistics
-      on all allocation sources in the library. This is useful to spot
-      greedy allocations when loading and processing fonts.
+    - The  memory  debugger  has  been  updated   to  dump  allocation
+      statistics on  all allocation  sources in the library.   This is
+      useful to  spot greedy  allocations when  loading and processing
+      fonts.
 
-    - we removed a huge array of constant pointers to constant strings
-      in the 'psnames' module. The problem was that when compiled in PIC
-      mode (i.e. when generating a Unix shared object / dll), the array
-      could only be placed in the non-shared writable section of the library*
+    - We removed a huge array of constant pointers to constant strings
+      in the `psnames' module.   The problem was that  compilations in
+      PIC mode (i.e.,  when generating a  Unix shared object/dll)  put
+      the array  into the non-shared  writable section of  the library
       since absolute pointers are not relocatable by nature.
       
-      This saves about 16Kb per process linked to FreeType. We also store
-      the array in a novel compressed way that saves about 20 Kb of code
-      as well.
+      This reduces the memory consumption by approximately 16KByte per
+      process linked  to FreeType.   We now also store  the array in a
+      compressed form (as a trie) which saves about 20KByte of code as
+      well.
 
 
 ======================================================================
diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY
index af3f6e7..0849619 100644
--- a/docs/INSTALL.ANY
+++ b/docs/INSTALL.ANY
@@ -42,7 +42,7 @@ I. Standard procedure
 
     -- other components (optional)
 
-      src/autohint/autohint.c -- auto hinting module
+      src/autofit/autofit.c   -- auto hinting module
       src/cache/ftcache.c     -- cache sub-system (in beta)
       src/sfnt/sfnt.c         -- SFNT files support
                                  (TrueType & OpenType)
diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h
index d190167..b0115dd 100644
--- a/include/freetype/ftmoderr.h
+++ b/include/freetype/ftmoderr.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType module error offsets (specification).                       */
 /*                                                                         */
-/*  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,       */
@@ -23,8 +23,8 @@
   /* The lower byte gives the error code, the higher byte gives the        */
   /* module.  The base module has error offset 0.  For example, the error  */
   /* `FT_Err_Invalid_File_Format' has value 0x003, the error               */
-  /* `TT_Err_Invalid_File_Format' has value 0x1003, the error              */
-  /* `T1_Err_Invalid_File_Format' has value 0x1103, etc.                   */
+  /* `TT_Err_Invalid_File_Format' has value 0x1103, the error              */
+  /* `T1_Err_Invalid_File_Format' has value 0x1203, etc.                   */
   /*                                                                       */
   /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h   */
   /* to make the higher byte always zero (disabling the module error       */
@@ -103,25 +103,26 @@
 
 
   FT_MODERRDEF( Base,      0x000, "base module" )
-  FT_MODERRDEF( Autohint,  0x100, "autohinter module" )
+  FT_MODERRDEF( Autofit,   0x100, "autofitter module" )
   FT_MODERRDEF( BDF,       0x200, "BDF module" )
   FT_MODERRDEF( Cache,     0x300, "cache module" )
   FT_MODERRDEF( CFF,       0x400, "CFF module" )
   FT_MODERRDEF( CID,       0x500, "CID module" )
   FT_MODERRDEF( Gzip,      0x600, "Gzip module" )
   FT_MODERRDEF( LZW,       0x700, "LZW module" )
-  FT_MODERRDEF( PCF,       0x800, "PCF module" )
-  FT_MODERRDEF( PFR,       0x900, "PFR module" )
-  FT_MODERRDEF( PSaux,     0xA00, "PS auxiliary module" )
-  FT_MODERRDEF( PShinter,  0xB00, "PS hinter module" )
-  FT_MODERRDEF( PSnames,   0xC00, "PS names module" )
-  FT_MODERRDEF( Raster,    0xD00, "raster module" )
-  FT_MODERRDEF( SFNT,      0xE00, "SFNT module" )
-  FT_MODERRDEF( Smooth,    0xF00, "smooth raster module" )
-  FT_MODERRDEF( TrueType, 0x1000, "TrueType module" )
-  FT_MODERRDEF( Type1,    0x1100, "Type 1 module" )
-  FT_MODERRDEF( Type42,   0x1200, "Type 42 module" )
-  FT_MODERRDEF( Winfonts, 0x1300, "Windows FON/FNT module" )
+  FT_MODERRDEF( OTvalid,   0x800, "OpenType validation module" )
+  FT_MODERRDEF( PCF,       0x900, "PCF module" )
+  FT_MODERRDEF( PFR,       0xA00, "PFR module" )
+  FT_MODERRDEF( PSaux,     0xB00, "PS auxiliary module" )
+  FT_MODERRDEF( PShinter,  0xC00, "PS hinter module" )
+  FT_MODERRDEF( PSnames,   0xD00, "PS names module" )
+  FT_MODERRDEF( Raster,    0xE00, "raster module" )
+  FT_MODERRDEF( SFNT,      0xF00, "SFNT module" )
+  FT_MODERRDEF( Smooth,   0x1000, "smooth raster module" )
+  FT_MODERRDEF( TrueType, 0x1100, "TrueType module" )
+  FT_MODERRDEF( Type1,    0x1200, "Type 1 module" )
+  FT_MODERRDEF( Type42,   0x1300, "Type 42 module" )
+  FT_MODERRDEF( Winfonts, 0x1400, "Windows FON/FNT module" )
 
 
 #ifdef FT_MODERR_END_LIST
diff --git a/src/autofit/aferrors.h b/src/autofit/aferrors.h
new file mode 100644
index 0000000..c2ed5fe
--- /dev/null
+++ b/src/autofit/aferrors.h
@@ -0,0 +1,40 @@
+/***************************************************************************/
+/*                                                                         */
+/*  aferrors.h                                                             */
+/*                                                                         */
+/*    Autofitter error codes (specification only).                         */
+/*                                                                         */
+/*  Copyright 2005 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.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* This file is used to define the Autofitter error enumeration          */
+  /* constants.                                                            */
+  /*                                                                       */
+  /*************************************************************************/
+
+#ifndef __AFERRORS_H__
+#define __AFERRORS_H__
+
+#include FT_MODULE_ERRORS_H
+
+#undef __FTERRORS_H__
+
+#define FT_ERR_PREFIX  AF_Err_
+#define FT_ERR_BASE    FT_Mod_Err_Autofit
+
+#include FT_ERRORS_H
+
+#endif /* __AFERRORS_H__ */
+
+/* END */
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index 05be73d..640cf79 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -19,6 +19,7 @@
 #include "afglobal.h"
 #include "afdummy.h"
 #include "aflatin.h"
+#include "aferrors.h"
 
 
   /* populate this list when you add new scripts */
@@ -57,7 +58,7 @@
   static FT_Error
   af_face_globals_compute_script_coverage( AF_FaceGlobals  globals )
   {
-    FT_Error    error       = FT_Err_Ok;
+    FT_Error    error       = AF_Err_Ok;
     FT_Face     face        = globals->face;
     FT_CharMap  old_charmap = face->charmap;
     FT_Byte*    gscripts    = globals->glyph_scripts;
@@ -76,7 +77,7 @@
       *  Ignore this error; we simply use Latin as the standard
       *  script.  XXX: Shouldn't we rather disable hinting?
       */
-      error = FT_Err_Ok;
+      error = AF_Err_Ok;
       goto Exit;
     }
 
@@ -219,12 +220,12 @@
     AF_ScriptMetrics  metrics = NULL;
     FT_UInt           index;
     AF_ScriptClass    clazz;
-    FT_Error          error = 0;
+    FT_Error          error = AF_Err_Ok;
 
 
     if ( gindex >= globals->glyph_count )
     {
-      error = FT_Err_Invalid_Argument;
+      error = AF_Err_Invalid_Argument;
       goto Exit;
     }
 
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index afc8462..ade4fd3 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -17,6 +17,7 @@
 
 
 #include "afhints.h"
+#include "aferrors.h"
 
 
   FT_LOCAL_DEF( FT_Error )
@@ -24,7 +25,7 @@
                              FT_Memory     memory,
                              AF_Segment   *asegment )
   {
-    FT_Error    error   = FT_Err_Ok;
+    FT_Error    error   = AF_Err_Ok;
     AF_Segment  segment = NULL;
 
 
@@ -37,7 +38,7 @@
 
       if ( old_max >= big_max )
       {
-        error = FT_Err_Out_Of_Memory;
+        error = AF_Err_Out_Of_Memory;
         goto Exit;
       }
 
@@ -66,7 +67,7 @@
                           FT_Memory     memory,
                           AF_Edge      *aedge )
   {
-    FT_Error  error = FT_Err_Ok;
+    FT_Error  error = AF_Err_Ok;
     AF_Edge   edge  = NULL;
     AF_Edge   edges;
 
@@ -80,7 +81,7 @@
 
       if ( old_max >= big_max )
       {
-        error = FT_Err_Out_Of_Memory;
+        error = AF_Err_Out_Of_Memory;
         goto Exit;
       }
 
@@ -462,7 +463,7 @@
   af_glyph_hints_reload( AF_GlyphHints  hints,
                          FT_Outline*    outline )
   {
-    FT_Error   error   = FT_Err_Ok;
+    FT_Error   error   = AF_Err_Ok;
     AF_Point   points;
     FT_UInt    old_max, new_max;
     AF_Scaler  scaler  = &hints->metrics->scaler;
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index c6fc17f..d6cfaa6 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -17,6 +17,7 @@
 
 
 #include "aflatin.h"
+#include "aferrors.h"
 
 
   /*************************************************************************/
@@ -377,7 +378,7 @@
   af_latin_metrics_init( AF_LatinMetrics  metrics,
                          FT_Face          face )
   {
-    FT_Error    error = FT_Err_Ok;
+    FT_Error    error = AF_Err_Ok;
     FT_CharMap  oldmap = face->charmap;
     FT_UInt     ee;
 
@@ -408,7 +409,7 @@
     }
 
     FT_Set_Charmap( face, oldmap );
-    return FT_Err_Ok;
+    return AF_Err_Ok;
   }
 
 
@@ -577,7 +578,7 @@
   {
     AF_AxisHints  axis          = &hints->axis[dim];
     FT_Memory     memory        = hints->memory;
-    FT_Error      error         = FT_Err_Ok;
+    FT_Error      error         = AF_Err_Ok;
     AF_Segment    segment       = NULL;
     AF_Point*     contour       = hints->contours;
     AF_Point*     contour_limit = contour + hints->num_contours;
@@ -921,7 +922,7 @@
                                 AF_Dimension   dim )
   {
     AF_AxisHints  axis   = &hints->axis[dim];
-    FT_Error      error  = 0;
+    FT_Error      error  = AF_Err_Ok;
     FT_Memory     memory = hints->memory;
     AF_LatinAxis  laxis  = &((AF_LatinMetrics)hints->metrics)->axis[dim];
 
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index c02df64..c3f3b2c 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -20,6 +20,7 @@
 #include "afhints.h"
 #include "afglobal.h"
 #include "aflatin.h"
+#include "aferrors.h"
 
 
   FT_LOCAL_DEF( FT_Error )
@@ -51,7 +52,7 @@
   af_loader_reset( AF_Loader  loader,
                    FT_Face    face )
   {
-    FT_Error  error = FT_Err_Ok;
+    FT_Error  error = AF_Err_Ok;
 
 
     loader->face    = face;
@@ -331,7 +332,7 @@
             if ( start_point + k >= num_base_points         ||
                                l >= (FT_UInt)num_new_points )
             {
-              error = FT_Err_Invalid_Composite;
+              error = AF_Err_Invalid_Composite;
               goto Exit;
             }
 
@@ -369,7 +370,7 @@
 
     default:
       /* we don't support other formats (yet?) */
-      error = FT_Err_Unimplemented_Feature;
+      error = AF_Err_Unimplemented_Feature;
     }
 
   Hint_Metrics:
@@ -448,7 +449,7 @@
 
 
     if ( !size )
-      return FT_Err_Invalid_Argument;
+      return AF_Err_Invalid_Argument;
 
     FT_ZERO( &scaler );
 
diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk
index 5ace990..7f7ff99 100644
--- a/src/autofit/rules.mk
+++ b/src/autofit/rules.mk
@@ -35,8 +35,9 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \
 
 # AUTOF driver headers
 #
-AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \
-               $(AUTOF_DIR)/aftypes.h
+AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h)  \
+               $(AUTOF_DIR)/aftypes.h  \
+               $(AUTOF_DIR)/aferrors.h
 
 
 # AUTOF driver object(s)
diff --git a/src/otvalid/otverror.h b/src/otvalid/otverror.h
index dc34a5a..041b538 100644
--- a/src/otvalid/otverror.h
+++ b/src/otvalid/otverror.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType validation module error codes (specification only).         */
 /*                                                                         */
-/*  Copyright 2004 by                                                      */
+/*  Copyright 2004, 2005 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -31,7 +31,7 @@
 #undef __FTERRORS_H__
 
 #define FT_ERR_PREFIX  OTV_Err_
-#define FT_ERR_BASE    FT_Mod_Err_OTV
+#define FT_ERR_BASE    FT_Mod_Err_OTvalid
 
 #define FT_KEEP_ERR_PREFIX