]> granicus.if.org Git - php/commitdiff
MFH: Synchronized bundled GD library with GD 2.0.22.
authorIlia Alshanetsky <iliaa@php.net>
Mon, 29 Mar 2004 18:21:00 +0000 (18:21 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 29 Mar 2004 18:21:00 +0000 (18:21 +0000)
21 files changed:
NEWS
ext/gd/gd.c
ext/gd/libgd/gd.c
ext/gd/libgd/gd.h
ext/gd/libgd/gd_gd.c
ext/gd/libgd/gd_gd2.c
ext/gd/libgd/gd_io_dp.c
ext/gd/libgd/gd_jpeg.c
ext/gd/libgd/gd_png.c
ext/gd/libgd/gd_wbmp.c
ext/gd/libgd/gdfontg.c
ext/gd/libgd/gdfontg.h
ext/gd/libgd/gdfontl.c
ext/gd/libgd/gdfontl.h
ext/gd/libgd/gdfontmb.c
ext/gd/libgd/gdfontmb.h
ext/gd/libgd/gdfonts.c
ext/gd/libgd/gdfonts.h
ext/gd/libgd/gdfontt.c
ext/gd/libgd/gdfontt.h
ext/gd/libgd/gdft.c

diff --git a/NEWS b/NEWS
index 8a3274a84936df2b8f23e5d3169c62616dcab196..73f1c71311cf391b70d6715fec9946fc55193f73 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2004, Version 4.3.6
+- Synchronized bundled GD library with GD 2.0.22. (Ilia)
 - Fixed bug #27732 (Fixed compilation bug inside php_sab_info.h). (Ilia)
 - Fixed bug #27731 (error_reporting() inside @ block fails to set
   error_reporting level). (Ilia)
index 5515b55acbed58c73a4658552fae601fd0baf383..47b8deb389da88284b36fd1526455e167750eb4e 100644 (file)
@@ -390,7 +390,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
 /* }}} */
 
 #if HAVE_GD_BUNDLED
-#define PHP_GD_VERSION_STRING "bundled (2.0.17 compatible)"
+#define PHP_GD_VERSION_STRING "bundled (2.0.22 compatible)"
 #elif HAVE_LIBGD20
 #define PHP_GD_VERSION_STRING "2.0 or higher"
 #elif HAVE_GDIMAGECOLORRESOLVE
index 96b6a688731caf2571c55417607ec841e534b05b..2d946265ea8438135b5eee632c9566efc8ba409b 100644 (file)
@@ -1823,7 +1823,7 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
        if (y < ((im->sy) - 1)) {
                lastBorder = 1;
                for (i = leftLimit; i <= rightLimit; i++) {
-                       int c = gdImageGetPixel(im, i, y + 1);
+                       int c = gdImageGetTrueColorPixel(im, i, y + 1);
 
                        if (lastBorder) {
                                if ((c != border) && (c != color)) {
@@ -2292,7 +2292,8 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
                                                int tmp = gdImageGetPixel (src, x, y);
                                                mapTo = gdImageGetTrueColorPixel (src, x, y);
                                                if (gdImageGetTransparent (src) == tmp) {
-                                                       tox++;
+                                                       /* 2.0.21, TK: not tox++ */
+                                                       tox += stx[x - srcX];
                                                        continue;
                                                }       
                                        } else {
@@ -2300,7 +2301,8 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
                                                mapTo = gdImageGetTrueColorPixel (src, x, y);
                                                /* Added 7/24/95: support transparent copies */
                                                if (gdImageGetTransparent (src) == mapTo) {
-                                                       tox++;
+                                                       /* 2.0.21, TK: not tox++ */
+                                                       tox += stx[x - srcX];
                                                        continue;
                                                }
                                        }       
@@ -2356,22 +2358,24 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
 void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
 {
        int x, y;
+       double sy1, sy2, sx1, sx2;
        if (!dst->trueColor) {
                gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
                return;
        }
        for (y = dstY; (y < dstY + dstH); y++) {
+               sy1 = ((double) y - (double) dstY) * (double) srcH / (double) dstH;
+               sy2 = ((double) (y + 1) - (double) dstY) * (double) srcH / (double) dstH;
                for (x = dstX; (x < dstX + dstW); x++) {
-                       float sy1, sy2, sx1, sx2;
-                       float sx, sy;
-                       float spixels = 0.0f;
-                       float red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f;
-                       float alpha_factor, alpha_sum = 0.0f, contrib_sum = 0.0f;
-                       sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH;
-                       sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH;
+                       double sx, sy;
+                       double spixels = 0;
+                       double red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
+                       double alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0;
+                       sx1 = ((double) x - (double) dstX) * (double) srcW / dstW;
+                       sx2 = ((double) (x + 1) - (double) dstX) * (double) srcW / dstW;
                        sy = sy1;
                        do {
-                               float yportion;
+                               double yportion;
                                if (floor_cast(sy) == floor_cast(sy1)) {
                                        yportion = 1.0f - (sy - floor_cast(sy));
                                        if (yportion > sy2 - sy1) {
@@ -2383,12 +2387,10 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
                                } else {
                                        yportion = 1.0f;
                                }
-                               sx1 = ((float)(x - dstX)) * (float) srcW / dstW;
-                               sx2 = ((float)(x + 1 - dstX)) * (float) srcW / dstW;
                                sx = sx1;
                                do {
-                                       float xportion;
-                                       float pcontribution;
+                                       double xportion;
+                                       double pcontribution;
                                        int p;
                                        if (floorf(sx) == floor_cast(sx1)) {
                                                xportion = 1.0f - (sx - floor_cast(sx));
index ba2731677ac4191836b5977222b00f79b86d7bc3..ac7a8092b4e75e12fc254d1dd7730bda4f516a71 100644 (file)
@@ -578,6 +578,7 @@ void gdImageSaveAlpha(gdImagePtr im, int saveAlphaArg);
 
 gdIOCtx* gdNewFileCtx(FILE*);
 gdIOCtx* gdNewDynamicCtx(int, void*);
+gdIOCtx *gdNewDynamicCtxEx(int size, void *data, int freeFlag);
 gdIOCtx* gdNewSSCtx(gdSourcePtr in, gdSinkPtr out);
 void* gdDPExtractData(struct gdIOCtx* ctx, int *size);
 
index 28755a8412304b58c4fa0cf38586037a636827b6..bff27223c0ca3c5300a4ae3092df8069beef7c9c 100644 (file)
@@ -147,6 +147,16 @@ gdImagePtr gdImageCreateFromGd (FILE * inFile)
        return im;
 }
 
+gdImagePtr gdImageCreateFromGdPtr (int size, void *data)
+{
+       gdImagePtr im;
+       gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
+       im = gdImageCreateFromGdCtx(in);
+       in->gd_free(in);
+
+       return im;
+}
+
 gdImagePtr gdImageCreateFromGdCtx (gdIOCtxPtr in)
 {
        int sx, sy;
index 0fadc715363fef1282a9e251d02fa41d5da54f59..d815c672325109df6574d69c632955f3e2608feb 100644 (file)
@@ -237,6 +237,16 @@ gdImagePtr gdImageCreateFromGd2 (FILE * inFile)
        return im;
 }
 
+gdImagePtr gdImageCreateFromGd2Ptr (int size, void *data)
+{
+       gdImagePtr im;
+       gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
+       im = gdImageCreateFromGd2Ctx(in);
+       in->gd_free(in);
+
+       return im;
+}
+
 gdImagePtr gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
 {
        int sx, sy;
@@ -378,6 +388,16 @@ fail2:
        return 0;
 }
 
+gdImagePtr gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w, int h)
+{
+       gdImagePtr im;
+       gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
+       im = gdImageCreateFromGd2PartCtx(in, srcx, srcy, w, h);
+       in->gd_free(in);
+
+       return im;
+}
+
 gdImagePtr gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h) 
 {
        gdImagePtr im;
index 06c3ae80b63212c32b529b4fa20b39112b05cddb..fa4c900b163acfbaac6ef978bfae312d9a05f6d5 100644 (file)
@@ -33,6 +33,7 @@ typedef struct dpStruct
     int realSize;
     int dataGood;
     int pos;
+    int freeOK;
   }
 dynamicPtr;
 
@@ -52,7 +53,7 @@ static int appendDynamic (dynamicPtr * dp, const void *src, int size);
 static int gdReallocDynamic (dynamicPtr * dp, int required);
 static int trimDynamic (dynamicPtr * dp);
 static void gdFreeDynamicCtx (struct gdIOCtx *ctx);
-static dynamicPtr *newDynamic (int initialSize, void *data);
+static dynamicPtr *newDynamic (int initialSize, void *data, int freeOKFlag);
 
 static int dynamicPutbuf (struct gdIOCtx *, const void *, int);
 static void dynamicPutchar (struct gdIOCtx *, int a);
@@ -66,6 +67,11 @@ static long dynamicTell (struct gdIOCtx *);
 /* return data as a dynamic pointer */
 gdIOCtx *
 gdNewDynamicCtx (int initialSize, void *data)
+{
+       return gdNewDynamicCtxEx(initialSize, data, 1);
+}
+gdIOCtx * gdNewDynamicCtxEx (int initialSize, void *data, int freeOKFlag)
 {
   dpIOCtx *ctx;
   dynamicPtr *dp;
@@ -76,7 +82,7 @@ gdNewDynamicCtx (int initialSize, void *data)
       return NULL;
     }
 
-  dp = newDynamic (initialSize, data);
+  dp = newDynamic (initialSize, data, freeOKFlag);
   if (!dp)
     {
       gdFree (ctx);
@@ -120,7 +126,7 @@ gdDPExtractData (struct gdIOCtx *ctx, int *size)
     {
       *size = 0;
       data = NULL;
-      if (dp->data != NULL)
+      if (dp->data != NULL && dp->freeOK)
        {
          gdFree (dp->data);
        }
@@ -177,6 +183,10 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
   bytesNeeded = pos;
   if (bytesNeeded > dp->realSize)
     {
+       /* 2.0.21 */
+       if (!dp->freeOK) {
+               return FALSE;
+       }
       if (!gdReallocDynamic (dp, dp->realSize * 2))
        {
          dp->dataGood = FALSE;
@@ -199,8 +209,7 @@ dynamicSeek (struct gdIOCtx *ctx, const int pos)
 }
 
 /* return data as a dynamic pointer */
-static dynamicPtr *
-newDynamic (int initialSize, void *data)
+static dynamicPtr * newDynamic (int initialSize, void *data, int freeOKFlag)
 {
   dynamicPtr *dp;
   dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr));
@@ -213,6 +222,7 @@ newDynamic (int initialSize, void *data)
     return NULL;
 
   dp->pos = 0;
+  dp->freeOK = freeOKFlag;
 
   return dp;
 }
@@ -348,6 +358,10 @@ appendDynamic (dynamicPtr * dp, const void *src, int size)
 
   if (bytesNeeded > dp->realSize)
     {
+               /* 2.0.21 */
+               if (!dp->freeOK) {
+                       return FALSE;
+               }
       if (!gdReallocDynamic (dp, bytesNeeded * 2))
        {
          dp->dataGood = FALSE;
@@ -407,5 +421,9 @@ gdReallocDynamic (dynamicPtr * dp, int required)
 static int
 trimDynamic (dynamicPtr * dp)
 {
-  return gdReallocDynamic (dp, dp->logicalSize);
+       /* 2.0.21: we don't reallocate memory we don't own */
+       if (!dp->freeOK) {
+               return FALSE;
+       }
+       return gdReallocDynamic (dp, dp->logicalSize);
 }
index e3f26659f0c221a075e688dad644b10656b62479..36aa31cdef3730f693231af0a803c6a4819ad02e 100644 (file)
@@ -221,8 +221,20 @@ gdImagePtr gdImageCreateFromJpeg (FILE * inFile)
        return im;
 }
 
+gdImagePtr gdImageCreateFromJpegPtr (int size, void *data)
+{
+       gdImagePtr im;
+       gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
+       im = gdImageCreateFromJpegCtx(in);
+       in->gd_free(in);
+
+       return im;
+}
+
 void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
 
+static int CMYKToRGB(int c, int m, int y, int k, int inverted);
+
 /* 
  * Create a gd-format image from the JPEG-format INFILE.  Returns the
  * image, or NULL upon error.
@@ -239,6 +251,8 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
        unsigned int i, j;
        int retval;
        JDIMENSION nrows;
+       int channels = 3;
+       int inverted = 0;
 
        memset (&cinfo, 0, sizeof (cinfo));
        memset (&jerr, 0, sizeof (jerr));
@@ -262,6 +276,9 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
 
        jpeg_gdIOCtx_src (&cinfo, infile);
 
+       /* 2.0.22: save the APP14 marker to check for Adobe Photoshop CMYK files with inverted components. */
+       jpeg_save_markers(&cinfo, JPEG_APP0 + 14, 256);
+
        retval = jpeg_read_header (&cinfo, TRUE);
        if (retval != JPEG_HEADER_OK) { 
                php_gd_error_ex(E_WARNING, "gd-jpeg: warning: jpeg_read_header returned %d, expected %d", retval, JPEG_HEADER_OK);
@@ -281,8 +298,14 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
                goto error;
        }
 
-       /* Force the image into RGB colorspace, but don't reduce the number of colors anymore (GD 2.0) */
-       cinfo.out_color_space = JCS_RGB;
+       /* 2.0.22: very basic support for reading CMYK colorspace files. Nice for
+        * thumbnails but there's no support for fussy adjustment of the
+        * assumed properties of inks and paper. */
+       if ((cinfo.jpeg_color_space == JCS_CMYK) || (cinfo.jpeg_color_space == JCS_YCCK)) {
+               cinfo.out_color_space = JCS_CMYK;
+       } else {
+               cinfo.out_color_space = JCS_RGB;
+       }
 
        if (jpeg_start_decompress (&cinfo) != TRUE) {
                php_gd_error("gd-jpeg: warning: jpeg_start_decompress reports suspended data source");
@@ -301,8 +324,29 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
   gdImageInterlace (im, cinfo.progressive_mode != 0);
 #endif
 
-       if (cinfo.output_components != 3) {
-               php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 3)", cinfo.output_components);
+       if (cinfo.out_color_space == JCS_RGB) {
+               if (cinfo.output_components != 3) {
+                       php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 3 for RGB)", cinfo.output_components);
+                       goto error;
+               }
+               channels = 3;
+       } else if (cinfo.out_color_space == JCS_CMYK) {
+               jpeg_saved_marker_ptr marker;
+               if (cinfo.output_components != 4)  {
+                       php_gd_error_ex(E_WARNING, "gd-jpeg: error: JPEG color quantization request resulted in output_components == %d (expected 4 for CMYK)", cinfo.output_components);
+                       goto error;
+               }
+               channels = 4;
+               marker = cinfo.marker_list;
+               while (marker) {
+                       if ((marker->marker == (JPEG_APP0 + 14)) && (marker->data_length >= 12) && (!strncmp((const char *) marker->data, "Adobe", 5))) {
+                               inverted = 1;
+                               break;
+                       }
+                       marker = marker->next;
+               }
+       } else {
+               php_gd_error_ex(E_WARNING, "gd-jpeg: error: unexpected colorspace.");
                goto error;
        }
 
@@ -311,22 +355,37 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
        goto error;
 #endif /* BITS_IN_JSAMPLE == 12 */
 
-       row = safe_emalloc(cinfo.output_width * 3, sizeof(JSAMPLE), 0);
-       memset(row, 0, cinfo.output_width * 3 * sizeof(JSAMPLE));
+       row = safe_emalloc(cinfo.output_width * channels, sizeof(JSAMPLE), 0);
+       memset(row, 0, cinfo.output_width * channels * sizeof(JSAMPLE));
        rowptr[0] = row;
 
-       for (i = 0; i < cinfo.output_height; i++) {
-               register JSAMPROW currow = row;
-               register int *tpix = im->tpixels[i];
-               nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
-               if (nrows != 1) {
-                       php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
-                       goto error;
+       if (cinfo.out_color_space == JCS_CMYK) {
+               for (i = 0; i < cinfo.output_height; i++) {
+                       register JSAMPROW currow = row;
+                       register int *tpix = im->tpixels[i];
+                       nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
+                       if (nrows != 1) {
+                               php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
+                               goto error;
+                       }
+                       for (j = 0; j < cinfo.output_width; j++, currow += 4, tpix++) {
+                               *tpix = CMYKToRGB (currow[0], currow[1], currow[2], currow[3], inverted);
+                       }
                }
-               for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) {
-                       *tpix = gdTrueColor (currow[0], currow[1], currow[2]);
+       } else {
+               for (i = 0; i < cinfo.output_height; i++) {
+                       register JSAMPROW currow = row;
+                       register int *tpix = im->tpixels[i];
+                       nrows = jpeg_read_scanlines (&cinfo, rowptr, 1);
+                       if (nrows != 1) {
+                               php_gd_error_ex(E_WARNING, "gd-jpeg: error: jpeg_read_scanlines returns %u, expected 1", nrows);
+                               goto error;
+                       }
+                       for (j = 0; j < cinfo.output_width; j++, currow += 3, tpix++) {
+                               *tpix = gdTrueColor (currow[0], currow[1], currow[2]);
+                       }
                }
-       }
+       } 
 
        if (jpeg_finish_decompress (&cinfo) != TRUE) {
                php_gd_error("gd-jpeg: warning: jpeg_finish_decompress reports suspended data source");
@@ -353,8 +412,19 @@ error:
        return 0;
 }
 
-/*
+/* A very basic conversion approach, TBB */
+static int CMYKToRGB(int c, int m, int y, int k, int inverted)
+{
+       if (inverted) {
+               c = 255 - c;
+               m = 255 - m;
+               y = 255 - y;
+               k = 255 - k;
+       }
+       return gdTrueColor((255 - c) * (255 - k) / 255, (255 - m) * (255 - k) / 255, (255 - y) * (255 - k) / 255);
+}
 
+/*
  * gdIOCtx JPEG data sources and sinks, T. Boutell
  * almost a simple global replace from T. Lane's stdio versions.
  *
index 8db3bf6a36960281dd037f8529cce8a865629a6f..83d3a3de38b98fb70d9734427099acf81e633cb2 100644 (file)
@@ -93,6 +93,14 @@ gdImagePtr gdImageCreateFromPng (FILE * inFile)
        return im;
 }
 
+gdImagePtr gdImageCreateFromPngPtr (int size, void *data)
+{
+       gdImagePtr im;
+       gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
+       im = gdImageCreateFromPngCtx(in);
+       in->gd_free(in);
+       return im;
+}
 
 /* This routine is based in part on the Chapter 13 demo code in "PNG: The
  *  Definitive Guide" (http://www.cdrom.com/pub/png/pngbook.html).
index 860f70c0a54cb88cb2db0a7e2f3f46a81c80f294..9728937741f284a44c304550d3c357d43eba71f3 100644 (file)
@@ -192,6 +192,15 @@ gdImageCreateFromWBMP (FILE * inFile)
   return (im);
 }
 
+gdImagePtr gdImageCreateFromWBMPPtr (int size, void *data)
+{
+       gdImagePtr im;
+       gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
+       im = gdImageCreateFromWBMPCtx(in);
+       in->gd_free(in);
+       return im;
+}
+
 /* gdImageWBMP
    ** -----------
  */
index fd0c1e0929516bb240d04572a61b44184a488ace..61c8c2710e2879feb6eb51e6cd02cf9299d9ad39 100644 (file)
@@ -4381,4 +4381,9 @@ gdFont gdFontGiantRep =
 
 gdFontPtr gdFontGiant = &gdFontGiantRep;
 
+gdFontPtr gdFontGetGiant(void)
+{
+       return gdFontGiant;
+}
+
 /* This file has not been truncated. */
index a70f266d63757333b303b7307a138852569c1a73..8a3e95e8bc827b35e9bd139073df4a1ca8bac060 100644 (file)
@@ -20,6 +20,7 @@ extern "C" {
 #include "gd.h"
 
 extern gdFontPtr gdFontGiant;
+extern gdFontPtr gdFontGetGiant(void);
 
 #ifdef __cplusplus
 }
index e5d65d8fa8960e88e9aaadbe74f22428d3df8fc2..6da54e1a1223c8c20d8ddad2ba42937a5280f5a2 100644 (file)
@@ -4638,4 +4638,9 @@ gdFont gdFontLargeRep =
 
 gdFontPtr gdFontLarge = &gdFontLargeRep;
 
+gdFontPtr gdFontGetLarge(void)
+{
+       return gdFontLarge;
+}
+
 /* This file has not been truncated. */
index d79f4771fd80521d6737365daca053863a9e46af..92fee14ff3343a1935aead9f434b8004b1e31f06 100644 (file)
@@ -21,6 +21,7 @@ extern "C" {
 #include "gd.h"
 
 extern gdFontPtr gdFontLarge;
+extern gdFontPtr gdFontGetLarge(void);
 
 #ifdef __cplusplus
 }
index 7a4f3b68ed682a607e7ea0b98ba841f7462e37a7..dab7c0589de2dabb0b66f4328f493aecdebcacfc 100644 (file)
@@ -3868,4 +3868,9 @@ gdFont gdFontMediumBoldRep =
 
 gdFontPtr gdFontMediumBold = &gdFontMediumBoldRep;
 
+gdFontPtr gdFontGetMediumBold(void)
+{
+       return gdFontMediumBold;
+}
+
 /* This file has not been truncated. */
index 0b3fbae1131fdf419fb4213ac72c473cdf94abf9..2e2f0cbe4798c2683ae90c2c40127f0e2765e61a 100644 (file)
@@ -19,6 +19,7 @@ extern "C" {
 #include "gd.h"
 
 extern gdFontPtr gdFontMediumBold;
+extern gdFontPtr gdFontGetMediumBold(void);
 
 #ifdef __cplusplus
 }
index eec0a3d71e9557057a268365980b82a53ce3fd5b..165cf70c54ad9b9c01956f0f53998e8d037ef6b5 100644 (file)
@@ -3868,4 +3868,9 @@ gdFont gdFontSmallRep =
 
 gdFontPtr gdFontSmall = &gdFontSmallRep;
 
+gdFontPtr gdFontGetSmall(void)
+{
+       return gdFontSmall;
+}
+
 /* This file has not been truncated. */
index 3882bd2318c62af590424f6ea8fcbef67de39a2c..55d0e1f0b2ad8feff457544e2ab58b71c41d545d 100644 (file)
@@ -19,6 +19,7 @@ extern "C" {
 #include "gd.h"
 
 extern gdFontPtr gdFontSmall;
+extern gdFontPtr gdFontGetSmall(void);
 
 #ifdef __cplusplus
 }
index 9d0b73cf23407976463d870b9ffac8b99489a4a7..2e6d241506a9471cfb67ef20c23d6eb51146ce48 100644 (file)
@@ -2589,4 +2589,9 @@ gdFont gdFontTinyRep =
 
 gdFontPtr gdFontTiny = &gdFontTinyRep;
 
+gdFontPtr gdFontGetTiny(void)
+{
+       return gdFontTiny;
+}
+
 /* This file has not been truncated. */
index 181ce5c5f0a6493107548af37a3d1b1334584fd2..102fec991b4b9a2fa69d1cb71c1ffb4a518a892b 100644 (file)
@@ -20,6 +20,7 @@ extern "C" {
 #include "gd.h"
 
 extern gdFontPtr gdFontTiny;
+extern gdFontPtr gdFontGetTiny(void);
 
 #ifdef __cplusplus
 }
index 7578857c1b6041b8cb88dc99195b642a71058a47..844e92ff2e8b6ba5c7d77a4dbcf8642aff0a4a20 100644 (file)
@@ -79,9 +79,9 @@ gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
 
 /*
  * The character (space) used to separate alternate fonts in the
- * fontlist parameter to gdImageStringFT.
+ * fontlist parameter to gdImageStringFT. 2.0.18: space was a oor choice for this.
  */
-#define LISTSEPARATOR " "
+#define LISTSEPARATOR ";"
 
 /*
  * DEFAULT_FONTPATH and PATHSEPARATOR are host type dependent and
@@ -473,7 +473,7 @@ static void *fontFetch (char **error, void *key)
                encoding = charmap->encoding_id;
 
 /* EAM DEBUG - Newer versions of libfree2 make it easier by defining encodings */
-#ifdef FT_ENCODING_MS_SYMBOL
+#if (defined(FREETYPE_MAJOR) && (FREETYPE_MAJOR >=2 ) && (FREETYPE_MINOR >= 1))
        if (charmap->encoding == FT_ENCODING_MS_SYMBOL
                || charmap->encoding == FT_ENCODING_ADOBE_CUSTOM
                || charmap->encoding == FT_ENCODING_ADOBE_STANDARD) {
@@ -482,7 +482,7 @@ static void *fontFetch (char **error, void *key)
                a->face->charmap = charmap;
                return (void *)a;
        }
-#endif /* FT_ENCODING_MS_SYMBOL */
+#endif /* Freetype 2.1 or better */
 /* EAM DEBUG */
 
                if ((platform == 3 && encoding == 1)            /* Windows Unicode */
@@ -777,6 +777,11 @@ void gdFontCacheShutdown()
                FT_Done_FreeType(library);
        }
 }
+
+void gdFreeFontCache()
+{
+       gdFontCacheShutdown();
+}
   
 int gdFontCacheSetup(void)
 {
@@ -965,7 +970,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
                }
 
 /* EAM DEBUG */
-#ifdef FT_ENCODING_MS_SYMBOL
+#if (defined(FREETYPE_MAJOR) && (FREETYPE_MAJOR >=2 ) && (FREETYPE_MINOR >= 1))
                if (font->face->charmap->encoding == FT_ENCODING_MS_SYMBOL) {
                        /* I do not know the significance of the constant 0xf000.
                         * It was determined by inspection of the character codes
@@ -975,7 +980,7 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
                        ch |= 0xf000;
                        next += len;
                } else
-#endif /* FT_ENCODING_MS_SYMBOL */
+#endif /* Freetype 2.1 or better */
 /* EAM DEBUG */
 
                switch (m) {