FreeBSD Bugzilla – Attachment 102385 Details for
Bug 142165
[PATCH] lang/php5: add optional patch for gd2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
php5-5.2.12.patch
php5-5.2.12.patch (text/plain), 6.76 KB, created by
Martin Matuska
on 2009-12-30 10:10:02 UTC
(
hide
)
Description:
php5-5.2.12.patch
Filename:
MIME Type:
Creator:
Martin Matuska
Created:
2009-12-30 10:10:02 UTC
Size:
6.76 KB
patch
obsolete
>Index: Makefile.ext >=================================================================== >RCS file: /home/pcvs/ports/lang/php5/Makefile.ext,v >retrieving revision 1.66 >diff -u -r1.66 Makefile.ext >--- Makefile.ext 8 Dec 2009 08:59:27 -0000 1.66 >+++ Makefile.ext 30 Dec 2009 10:03:22 -0000 >@@ -109,7 +109,8 @@ > > OPTIONS= T1LIB "Include T1lib support" on \ > TRUETYPE "Enable TrueType string function" on \ >- JIS "Enable JIS-mapped Japanese font support" off >+ JIS "Enable JIS-mapped Japanese font support" off \ >+ EXTRAFT2 "Additional parameters for imagefttext()" off > > PHP_HEADER_DIRS=libgd > .endif >@@ -555,6 +556,9 @@ > . if defined(WITH_JIS) > CONFIGURE_ARGS+=--enable-gd-jis-conv > . endif >+. if defined(WITH_EXTRAFT2) >+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-gd-ft2 >+. endif > .endif > > .if ${PHP_MODNAME} == "mbstring" >Index: files/extra-patch-gd-ft2 >=================================================================== >RCS file: files/extra-patch-gd-ft2 >diff -N files/extra-patch-gd-ft2 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ files/extra-patch-gd-ft2 30 Dec 2009 10:03:22 -0000 >@@ -0,0 +1,160 @@ >+diff --git a/ext/gd/gd.c ./gd.c >+--- a/ext/gd/gd.c >++++ ./gd.c >+@@ -88,6 +88,9 @@ >+ # include "gdttf.h" >+ #endif >+ >++/* Need access to some freetype constants */ >++#include <freetype/freetype.h> >++ >+ #ifndef M_PI >+ #define M_PI 3.14159265358979323846 >+ #endif >+@@ -4264,6 +4267,14 @@ >+ angle = angle * (M_PI/180); >+ >+ #if HAVE_GD_STRINGFTEX >++ if (extended) { >++ /* Sensible defaults */ >++ strex.slant_angle = 0.; >++ strex.width_mult = 1.; >++ strex.height_mult = 1.; >++ strex.advance_mult = 1.; >++ } >++ >+ if (extended && EXT) { /* parse extended info */ >+ HashPosition pos; >+ >+@@ -4286,6 +4297,49 @@ >+ convert_to_double_ex(item); >+ strex.flags |= gdFTEX_LINESPACE; >+ strex.linespacing = Z_DVAL_PP(item); >++ } else if (strcmp("load_no_scale", key) == 0) { >++ strex.loadFlags |= FT_LOAD_NO_SCALE; >++ } else if (strcmp("load_no_hinting", key) == 0) { >++ strex.loadFlags |= FT_LOAD_NO_HINTING; >++ } else if (strcmp("load_no_bitmap", key) == 0) { >++ strex.loadFlags |= FT_LOAD_NO_BITMAP; >++ } else if (strcmp("load_force_autohint", key) == 0) { >++ strex.loadFlags |= FT_LOAD_FORCE_AUTOHINT; >++ } else if (strcmp("load_ignore_transform", key) == 0) { >++ strex.loadFlags |= FT_LOAD_IGNORE_TRANSFORM; >++ } else if (strcmp("load_monochrome", key) == 0) { >++ strex.loadFlags |= FT_LOAD_MONOCHROME; >++ } else if (strcmp("load_linear_design", key) == 0) { >++ strex.loadFlags |= FT_LOAD_LINEAR_DESIGN; >++ } else if (strcmp("load_no_autohint", key) == 0) { >++ strex.loadFlags |= FT_LOAD_NO_AUTOHINT; >++ } else if (strcmp("hdpi", key) == 0) { >++ convert_to_long_ex(item); >++ strex.hdpi = Z_LVAL_PP(item); >++ if (!strex.vdpi) strex.vdpi = strex.hdpi; >++ strex.flags |= gdFTEX_RESOLUTION; >++ } else if (strcmp("vdpi", key) == 0) { >++ convert_to_long_ex(item); >++ strex.vdpi = Z_LVAL_PP(item); >++ if (!strex.hdpi) strex.hdpi = strex.vdpi; >++ strex.flags |= gdFTEX_RESOLUTION; >++ } else if (strcmp("screenres", key) == 0) { >++ convert_to_long_ex(item); >++ strex.hdpi = Z_LVAL_PP(item); >++ strex.vdpi = strex.hdpi; >++ strex.flags |= gdFTEX_RESOLUTION; >++ } else if (strcmp("slant_angle", key) == 0) { >++ convert_to_double_ex(item); >++ strex.slant_angle = Z_DVAL_PP(item); >++ } else if (strcmp("advance_mult", key) == 0) { >++ convert_to_double_ex(item); >++ strex.advance_mult = Z_DVAL_PP(item); >++ } else if (strcmp("width_mult", key) == 0) { >++ convert_to_double_ex(item); >++ strex.width_mult = Z_DVAL_PP(item); >++ } else if (strcmp("height_mult", key) == 0) { >++ convert_to_double_ex(item); >++ strex.height_mult = Z_DVAL_PP(item); >+ } >+ >+ } while (zend_hash_move_forward_ex(HASH_OF(EXT), &pos) == SUCCESS); >+diff --git a/ext/gd/libgd/gd.h ./libgd/gd.h >+--- a/ext/gd/libgd/gd.h >++++ ./libgd/gd.h >+@@ -347,6 +347,12 @@ >+ for in the above order. */ >+ int hdpi; >+ int vdpi; >++ >++ int loadFlags; /* Freetype's FT_LOAD_* constants */ >++ double slant_angle; /* Slant angle, in radians */ >++ double advance_mult; /* Advange multiplier (letter spacing) */ >++ double width_mult; /* Font's width multiplier */ >++ double height_mult; /* Font's height multiplier */ >+ } >+ gdFTStringExtra, *gdFTStringExtraPtr; >+ >+diff --git a/ext/gd/libgd/gdft.c ./libgd/gdft.c >+--- a/ext/gd/libgd/gdft.c >++++ ./libgd/gdft.c >+@@ -773,7 +773,7 @@ >+ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsize, double angle, int x, int y, char *string, gdFTStringExtraPtr strex) >+ { >+ FT_BBox bbox, glyph_bbox; >+- FT_Matrix matrix; >++ FT_Matrix matrix, matrix_a, matrix_b; >+ FT_Vector pen, delta, penf; >+ FT_Face face; >+ FT_Glyph image; >+@@ -790,8 +790,8 @@ >+ char *tmpstr = NULL; >+ int render = (im && (im->trueColor || (fg <= 255 && fg >= -255))); >+ FT_BitmapGlyph bm; >+- /* 2.0.13: Bob Ostermann: don't force autohint, that's just for testing freetype and doesn't look as good */ >+- int render_mode = FT_LOAD_DEFAULT; >++ /* Render to bitmap by default */ >++ int render_mode = FT_LOAD_RENDER; >+ int m, mfound; >+ /* Now tuneable thanks to Wez Furlong */ >+ double linespace = LINESPACE; >+@@ -807,9 +807,14 @@ >+ /* Tuneable horizontal and vertical resolution in dots per inch */ >+ int hdpi, vdpi; >+ >+- if (strex && ((strex->flags & gdFTEX_LINESPACE) == gdFTEX_LINESPACE)) { >+- linespace = strex->linespacing; >++ if (strex) { >++ if (strex && ((strex->flags & gdFTEX_LINESPACE) == gdFTEX_LINESPACE)) { >++ linespace = strex->linespacing; >++ } >++ /* Add additional FT_LOAD_* values */ >++ render_mode |= strex->loadFlags; >+ } >++ >+ tc_cache = gdCacheCreate(TWEENCOLORCACHESIZE, tweenColorTest, tweenColorFetch, tweenColorRelease); >+ >+ /***** initialize font library and font cache on first call ******/ >+@@ -854,10 +859,10 @@ >+ return "Could not set character size"; >+ } >+ >+- matrix.xx = (FT_Fixed) (cos_a * (1 << 16)); >+- matrix.yx = (FT_Fixed) (sin_a * (1 << 16)); >+- matrix.xy = -matrix.yx; >+- matrix.yy = matrix.xx; >++ matrix.xx = (FT_Fixed) ((strex->width_mult * cos_a + strex->width_mult * strex->slant_angle * sin_a) * (1 << 16)); >++ matrix.xy = (FT_Fixed) ((strex->width_mult * -sin_a + strex->width_mult * strex->slant_angle * cos_a) * (1 << 16)); >++ matrix.yx = (FT_Fixed) ((strex->height_mult * sin_a) * (1 << 16)); >++ matrix.yy = (FT_Fixed) ((strex->height_mult * cos_a) * (1 << 16)); >+ >+ penf.x = penf.y = 0; /* running position of non-rotated string */ >+ pen.x = pen.y = 0; /* running position of rotated string */ >+@@ -1095,8 +1100,8 @@ >+ previous = glyph_index; >+ >+ /* increment pen position */ >+- pen.x += image->advance.x >> 10; >+- pen.y -= image->advance.y >> 10; >++ pen.x += (image->advance.x >> 10) * strex->advance_mult; >++ pen.y -= (image->advance.y >> 10) * strex->advance_mult; >+ >+ penf.x += slot->metrics.horiAdvance; >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 142165
: 102385