Commit 621e4886223a6528fee553f6618ed1c22297ad19

David Turner 2002-12-16T21:51:24

2002-12-16 David Turner <david@freetype.org> * docs/VERSION.DLL: updating document to better explain the differences between the three version numbers being used on Unix, as well as provide the AutoConf fragment provided by Lars Clausen * src/smooth/ftgrays.c (gray_render_conic): fixed small bug that prevented bezier arcs with negative vertical coordinates to be rendered appropriately 2002-11-27 Vincent Caron <v.caron@zerodeux.net> * builds/unix/unix-def.in, builds/unix/freetype-config.in, builds/unix/configure.ac, src/gzip/rules.mk, src/gzip/ftgzip.c: adding support for system zlib installations when available on the target platform (Unix only)

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
diff --git a/ChangeLog b/ChangeLog
index a577cf2..fcc3589 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-12-16  David Turner  <david@freetype.org>
+
+        * docs/VERSION.DLL: updating document to better explain the differences between
+        the three version numbers being used on Unix, as well as provide the AutoConf
+        fragment provided by Lars Clausen
+
+        * src/smooth/ftgrays.c (gray_render_conic): fixed small bug that
+        prevented bezier arcs with negative vertical coordinates to be rendered
+        appropriately
+
 2002-12-02  Antoine Leca  <Antoine-FreetypeLeca-Marti.org>
 
         * src/base/ftobjs.c: modified the logic to get Unicode charmaps.
@@ -11,6 +21,13 @@
         * include/freetype/ftgzip.h: Correct the name of the controlling
         macro (was __FTXF86_H__ ...)
 
+2002-11-27  Vincent Caron <v.caron@zerodeux.net>
+
+        * builds/unix/unix-def.in, builds/unix/freetype-config.in,
+        builds/unix/configure.ac, src/gzip/rules.mk, src/gzip/ftgzip.c:
+        adding support for system zlib installations when available on the
+        target platform (Unix only)
+
 2002-11-23  David Turner  <david@freetype.org>
 
         * src/cff/cffload.c (cff_charser_load): modified charset loader to
diff --git a/README b/README
index 0503382..8090c62 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@
   is called `libttf'.  They are *not* compatible!
 
 
-  FreeType 2.1.3
+  FreeType 2.1.4
   ==============
 
   Please   read  the  docs/CHANGES   file,  it   contains  IMPORTANT
@@ -22,9 +22,9 @@
   Note  that the  FreeType 2  documentation  is now  available as  a
   separate package from our sites.  See:
 
-    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.3.tar.bz2
-    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.3.tar.gz
-    ftp://ftp.freetype.org/pub/freetype2/ftdoc213.zip
+    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.4.tar.bz2
+    ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.4.tar.gz
+    ftp://ftp.freetype.org/pub/freetype2/ftdoc214.zip
 
 
   Reports
diff --git a/builds/unix/configure.ac b/builds/unix/configure.ac
index a51c941..44baa74 100644
--- a/builds/unix/configure.ac
+++ b/builds/unix/configure.ac
@@ -81,6 +81,23 @@ AC_SUBST(FTSYS_SRC)
 
 AC_CHECK_FUNCS(memcpy memmove)
 
+
+dnl Check for system zlib
+AC_ARG_WITH(zlib,
+  [  --without-zlib          use internal zlib instead of system-wide])
+if test x$with_zlib != xno && test -z "$LIBZ"; then
+  AC_CHECK_LIB(z, gzsetparams, [AC_CHECK_HEADER(zlib.h, LIBZ='-lz')])
+fi
+if test x$with_zlib != xno && test -n "$LIBZ"; then
+  CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB"
+  SYSTEM_ZLIB=yes
+fi
+AC_SUBST(LIBZ)
+AC_SUBST(CFLAGS)
+AC_SUBST(SYSTEM_ZLIB)
+
+
+
 AC_PROG_LIBTOOL
 
 dnl create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in
index 7e939c3..c5a3e5a 100644
--- a/builds/unix/freetype-config.in
+++ b/builds/unix/freetype-config.in
@@ -88,7 +88,7 @@ if test "$echo_cflags" = "yes" ; then
 fi
 
 if test "$echo_libs" = "yes" ; then
- libs="-lfreetype"
+ libs="-lfreetype @LIBZ@"
  if test "@libdir@" != "/usr/lib" ; then
   echo -L@libdir@ $libs
  else
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index 621d068..6797041 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -85,6 +85,12 @@ endif
 LIB_DIR := $(OBJ_DIR)
 
 
+# The SYSTEM_ZLIB macro is defined if the user whishes to link dynamically
+# whith its system wide zlib. If SYSTEM_ZLIB is 'yes', the zlib part of the
+# ftgzip module is not compiled in.
+SYSTEM_ZLIB := @SYSTEM_ZLIB@
+
+
 # The NO_OUTPUT macro is appended to command lines in order to ignore
 # the output of some programs.
 #
diff --git a/docs/VERSION.DLL b/docs/VERSION.DLL
index 43b1a17..e3086e3 100644
--- a/docs/VERSION.DLL
+++ b/docs/VERSION.DLL
@@ -1,7 +1,78 @@
-Libtool's version for FreeType 2.1.3 is `9.2.3'.
+Due to our use of "libtool" to generate and install the FreeType 2 libraries
+on Unix systems, as well as other historical events, it is generally very
+difficult to know precisely which release of the font engine is installed
+on a given system.
 
-On most platforms, the soname will be `6.3.2' (e.g. `libfreetype.so.6.3.2').
+This file tries to explain why and to document ways to properly detect
+FreeType on Unix.
 
-Libtool's version for FreeType 2.1.2 is `9.1.3'.
 
-On most platforms, the soname will be `6.3.1' (e.g. `libfreetype.so.6.3.1').
+I. Version & Release numbers:
+
+For each new public release of FreeType 2, there are generally *three*
+distinct "version" numbers to consider:
+
+  * the official FT2 release number, like 2.0.9, or 2.1.3
+  
+  * the libtool (and Unix) specific version number, like "9.2.3". This
+    is what "freetype-config --version" will return
+  
+  * the platform-specific shared object number, used for example when
+    the library is installed as "/usr/lib/libfreetype.so.6.3.2"
+
+
+the platform-specific number is, unsurprisingly, platform-specific and varies
+with the operating system you're using (several variants of Linux, FreeBSD,
+Solaris, etc...). You should thus _never_ use it, even for simple tests.
+
+the libtool-specific number does not equal the release number but is tied
+to it.
+
+the release number is available at *compile* time through the following
+macros defined in FT_FREETYPE_H:
+
+  - FREETYPE_MAJOR : major release number
+  - FREETYPE_MINOR : minor release number
+  - FREETYPE_PATCH : patch release number
+
+see below for some Autoconf fragment to 
+
+
+the release number is also available at *runtime* through the 
+"FT_Library_Version" API. Unfortunately, this one wasn't available or
+working correctly before the 2.1.3 official release !!
+
+
+II. Table:
+
+the following is a simple table that gives, for each official release,
+the corresponding libtool number, as well as the shared object number
+found on _most_ systems, but not all of them:
+
+  release       libtool        so
+-------------------------------------
+   2.1.3         9.2.3         6.3.2
+   2.1.2         9.1.3         6.3.1
+   2.1.1           ?            ?
+   2.1.0           ?            ?
+   2.0.9           ?            ?
+
+
+
+
+III. AutoConf Code Fragment:
+
+Lars Clausen contributed the following Autoconf fragment to detect at
+which version of FreeType is installed on your system. This one tests
+for a version that is at least 2.0.9, you should change the last line to
+check against other release numbers.
+
+    AC_MSG_CHECKING([for version of FreeType])
+    FREETYPE_INCLUDE=`freetype-config --cflags | cut -c3-`
+    FREETYPE_MAJOR=`grep '^#define FREETYPE_MAJOR' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
+    FREETYPE_MINOR=`grep '^#define FREETYPE_MINOR' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
+    FREETYPE_PATCH=`grep '^#define FREETYPE_PATCH' $FREETYPE_INCLUDE/freetype/freetype.h | cut -d' ' -f3`
+    FREETYPE_VERSION=`echo | awk "BEGIN { printf \"%d\", ($FREETYPE_MAJOR * 1000 + $FREETYPE_MINOR) * 1000 + $FREETYPE_PATCH;}"`
+    AC_MSG_RESULT([$FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH])
+    if test "$FREETYPE_VERSION" -ge 2000009; then
+
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 3a41daf..93077c9 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1494,6 +1494,16 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    FT_OPEN_PARAMS      :: Use the `num_params' & `params' field.      */
   /*                                                                       */
+  /*    ft_open_memory :: deprecated. use @FT_OPEN_MEMORY instead          */
+  /*                                                                       */
+  /*    ft_open_stream :: deprecated. use @FT_OPEN_STREAM instead          */
+  /*                                                                       */
+  /*    ft_open_pathname :: deprecated. use @FT_OPEN_PATHNAME instead      */
+  /*                                                                       */
+  /*    ft_open_driver :: deprecated, use @FT_OPEN_DRIVER instead          */
+  /*                                                                       */
+  /*    ft_open_params :: deprecated, use @FT_OPEN_PARAMS instead          */
+  /*                                                                       */
   /* <Note>                                                                */
   /*    The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME'     */
   /*    flags are mutually exclusive.                                      */
@@ -1508,11 +1518,11 @@ FT_BEGIN_HEADER
 
   } FT_Open_Flags;
 
-#define  FT_OPEN_MEMORY    FT_OPEN_MEMORY
-#define  FT_OPEN_STREAM    FT_OPEN_STREAM
-#define  FT_OPEN_PATHNAME  FT_OPEN_PATHNAME
-#define  FT_OPEN_DRIVER    FT_OPEN_DRIVER
-#define  FT_OPEN_PARAMS    FT_OPEN_PARAMS
+#define  ft_open_memory    FT_OPEN_MEMORY     /* deprecated */
+#define  ft_open_stream    FT_OPEN_STREAM     /* deprecated */
+#define  ft_open_pathname  FT_OPEN_PATHNAME   /* deprecated */
+#define  ft_open_driver    FT_OPEN_DRIVER     /* deprecated */
+#define  ft_open_params    FT_OPEN_PARAMS     /* deprecated */
 
 
   /*************************************************************************/
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index 89e9190..c5f3bd3 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -459,6 +459,21 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
+  /* <FuncType>                                                            */
+  /*    SFNT_Load_Table_Func                                               */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Loads a given SFNT table in memory                                 */
+  /*                                                                       */
+  typedef FT_Error
+  (*SFNT_Load_Table_Func)( FT_Face      face,
+                           FT_ULong     tag,
+                           FT_Long      offset,
+                           FT_Byte*     buffer,
+                           FT_ULong*    length );
+
+  /*************************************************************************/
+  /*                                                                       */
   /* <Struct>                                                              */
   /*    SFNT_Interface                                                     */
   /*                                                                       */
diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h
index d638a21..4599632 100644
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -593,6 +593,63 @@ FT_BEGIN_HEADER
   FT_Get_Sfnt_Table( FT_Face      face,
                      FT_Sfnt_Tag  tag );
 
+ /**************************************************************************
+  *
+  * <Function>
+  *    FT_Load_Sfnt_Table
+  *
+  * <Description>
+  *   Loads any font table into client memory.
+  *
+  * <Input>
+  *   face   :: handle to source face.
+  *   tag    :: the 4-byte tag of the table to load. Use the value 0 if
+  *             you want to access the whole font file. Else, you can use
+  *             one of the definitions found in the @FT_TRUETYPE_TAGS_H
+  *             file, or forge a new one with @FT_MAKE_TAG
+  *              
+  *   offset :: the starting offset in the table (or file if tag == 0)
+  *
+  * <Output>
+  *   buffer :: target buffer address. client must ensure that there are
+  *             enough bytes in it.
+  *
+  * <InOut>
+  *   length :: if the 'length' parameter is NULL, then try to load the whole
+  *             table, and return an error code if it fails.
+  *
+  *             else, if '*length' is 0, then exit immediately while returning
+  *             the table's (or file) full size in it.
+  *
+  *             else, the number of bytes to read from the table or file,
+  *             from the starting offset.
+  *
+  * <Return>
+  *   error code. 0 means success
+  *
+  * <Note>
+  *   if you need to determine the table's length you should first call this
+  *   function with "*length" set to 0, as in the following example:
+  *
+  *   {
+  *     FT_ULong  length = 0;
+  *
+  *     error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );
+  *     if ( error ) { ... table does not exist ... }
+  *
+  *     buffer = malloc( length );
+  *     if ( buffer == NULL )  { ... not enough memory ... }
+  *
+  *     error = FT_Load_Sfnt_Table( face,tag, 0, buffer, &length );
+  *     if ( error ) { ... could not load table ... }
+  *   }
+  */
+  FT_EXPORT( FT_Error )
+  FT_Load_Sfnt_Table( FT_Face      face,
+                      FT_ULong     tag,
+                      FT_Long      offset,
+                      FT_Byte*     buffer,
+                      FT_ULong*    length );
 
   /* */
 
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index dacde6e..689f4b9 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -224,7 +224,7 @@
     FT_Pos  sign = 1;
 
     FT_UNUSED( hinter );
-
+    FT_UNUSED( vertical );
 
     dist = serif->opos - base->opos;
     if ( dist < 0 )
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 5f6d3ba..3333c92 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -22,6 +22,7 @@
 #include FT_INTERNAL_OBJECTS_H
 #include FT_INTERNAL_DEBUG_H
 #include FT_INTERNAL_STREAM_H
+#include FT_INTERNAL_SFNT_H    /* for SFNT_Load_Table_Func */
 #include FT_TRUETYPE_TABLES_H
 #include FT_TRUETYPE_IDS_H
 #include FT_OUTLINE_H
@@ -1835,6 +1836,32 @@
   }
 
 
+  /* documentation is in tttables.h */
+
+  FT_EXPORT_DEF( FT_Error )
+  FT_Load_Sfnt_Table( FT_Face      face,
+                      FT_ULong     tag,
+                      FT_Long      offset,
+                      FT_Byte*     buffer,
+                      FT_ULong*    length )
+  {
+    SFNT_Load_Table_Func  func;
+    FT_Driver             driver;
+
+
+    if ( !face || !FT_IS_SFNT( face ) )
+      return FT_Err_Invalid_Face_Handle;
+
+    driver = face->driver;
+    func   = (SFNT_Load_Table_Func) driver->root.clazz->get_interface(
+                                      FT_MODULE( driver ), "load_sfnt" );
+    if ( !func )
+      return FT_Err_Unimplemented_Feature;
+
+    return func( face, tag, offset, buffer, length );
+  }
+
+
   FT_EXPORT_DEF( FT_Error )
   FT_Activate_Size( FT_Size  size )
   {
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 91c0cd4..b814e8e 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -29,7 +29,7 @@
 
 #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
 
-#  include "zlib.h"
+#  include <zlib.h>
 
 #else /* !SYSTEM_ZLIB */
 
diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk
index a092ce7..1332fb2 100644
--- a/src/gzip/rules.mk
+++ b/src/gzip/rules.mk
@@ -21,7 +21,11 @@ GZIP_DIR_ := $(GZIP_DIR)$(SEP)
 
 # compilation flags for the driver
 #
-GZIP_COMPILE := $(FT_COMPILE) $I$(GZIP_DIR)
+ifeq ($(SYSTEM_ZLIB),)
+  GZIP_COMPILE := $(FT_COMPILE) $I$(GZIP_DIR)
+else
+  GZIP_COMPILE := $(FT_COMPILE)
+endif
 
 
 # gzip support sources (i.e., C files)
@@ -30,15 +34,19 @@ GZIP_DRV_SRC := $(GZIP_DIR_)ftgzip.c
 
 # gzip support headers
 #
-GZIP_DRV_H := 
+GZIP_DRV_H :=
 
 
-# Pfr driver object(s)
+# gzip driver object(s)
 #
 #   GZIP_DRV_OBJ_M is used during `multi' builds
 #   GZIP_DRV_OBJ_S is used during `single' builds
 #
-GZIP_DRV_OBJ_M := $(GZIP_DRV_SRC:$(GZIP_DIR_)%.c=$(OBJ_)%.$O)
+ifeq ($(SYSTEM_ZLIB),)
+  GZIP_DRV_OBJ_M := $(GZIP_DRV_SRC:$(GZIP_DIR_)%.c=$(OBJ_)%.$O)
+else
+  GZIP_DRV_OBJ_M := $(OBJ_)ftgzip.$O
+endif
 GZIP_DRV_OBJ_S := $(OBJ_)ftgzip.$O
 
 # gzip support source file for single build
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index f2fa7b4..c4dd1b4 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -228,6 +228,9 @@
     if ( ft_strcmp( module_interface, "get_sfnt" ) == 0 )
       return (FT_Module_Interface)get_sfnt_table;
 
+    if ( ft_strcmp( module_interface, "load_sfnt" ) == 0 )
+      return (FT_Module_Interface)tt_face_load_any;
+
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
     if ( ft_strcmp( module_interface, "glyph_name" ) == 0 )
       return (FT_Module_Interface)get_sfnt_glyph_name;
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index f6723af..5ca7c70 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -857,7 +857,7 @@
         if ( y < min ) min = y;
         if ( y > max ) max = y;
 
-        if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < 0 )
+        if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
           goto Draw;
 
         gray_split_conic( arc );
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 70fda88..02220db 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1133,6 +1133,14 @@
       /*  with synthetic fonts, it's possible we get here twice  */
       return;
 
+    if ( parser->root.cursor + 2 > parser->root.limit &&
+         parser->root.cursor[0] == '['                &&
+         parser->root.cursor[1] == ']'                )
+    {
+      /* empty array */
+      return;
+    }
+
     loader->num_subrs = (FT_Int)T1_ToInt( parser );
     if ( parser->root.error )
       return;
@@ -1483,9 +1491,9 @@
 
     /* now add the special functions... */
     T1_FIELD_CALLBACK( "FontName", parse_font_name )
-#if 0    
+#if 0
     T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
-#endif    
+#endif
     T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix )
     T1_FIELD_CALLBACK( "Encoding", parse_encoding )
     T1_FIELD_CALLBACK( "Subrs", parse_subrs )