tabe Mon Jun 22 15:50:18 2009 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/gd/tests bug48555.phpt Tuffy.ttf
Modified files:
/php-src NEWS
/php-src/ext/gd/libgd gdft.c
Log:
MFH: fixed bug #48555 (ImageFTBBox() differs from previous versions for texts
with new lines)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1564&r2=1.2027.2.547.2.1565&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1564 php-src/NEWS:1.2027.2.547.2.1565
--- php-src/NEWS:1.2027.2.547.2.1564 Mon Jun 22 13:42:29 2009
+++ php-src/NEWS Mon Jun 22 15:50:17 2009
@@ -5,6 +5,8 @@
php.net, Ilia)
- Fixed bug #48629 (get_defined_constants() ignores categorize parameter).
(Felipe)
+- Fixed bug #48555 (ImageFTBBox() differs from previous versions for texts
+ with new lines) (Takeshi Abe)
- Fixed bug #48276 (date("Y") on big endian machines produces the
wrong result). (Scott)
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gdft.c?r1=1.36.4.11&r2=1.36.4.12&diff_format=u
Index: php-src/ext/gd/libgd/gdft.c
diff -u php-src/ext/gd/libgd/gdft.c:1.36.4.11
php-src/ext/gd/libgd/gdft.c:1.36.4.12
--- php-src/ext/gd/libgd/gdft.c:1.36.4.11 Wed Mar 18 08:15:27 2009
+++ php-src/ext/gd/libgd/gdft.c Mon Jun 22 15:50:17 2009
@@ -784,6 +784,7 @@
double cos_a = cos (angle);
int len, i = 0, ch;
int x1 = 0, y1 = 0;
+ int xb = x, yb = y;
font_t *font;
fontkey_t fontkey;
char *next;
@@ -924,8 +925,8 @@
/* carriage returns */
if (ch == '\r') {
penf.x = 0;
- x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64;
- y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64;
+ x1 = (int)(- penf.y * sin_a + 32) / 64;
+ y1 = (int)(- penf.y * cos_a + 32) / 64;
pen.x = pen.y = 0;
previous = 0; /* clear kerning flag */
next++;
@@ -937,8 +938,10 @@
penf.x = 0;
penf.y -= (long)(face->size->metrics.height *
linespace);
penf.y = (penf.y - 32) & -64; /* round to
next pixel row */
- x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64;
- y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64;
+ x1 = (int)(- penf.y * sin_a + 32) / 64;
+ y1 = (int)(- penf.y * cos_a + 32) / 64;
+ xb = x + x1;
+ yb = y + y1;
pen.x = pen.y = 0;
previous = 0; /* clear kerning flag */
next++;
@@ -1088,7 +1091,7 @@
/* now, draw to our target surface */
bm = (FT_BitmapGlyph) image;
- gdft_draw_bitmap(tc_cache, im, fg, bm->bitmap, x + x1 +
((pen.x + 31) >> 6) + bm->left, y - y1 + ((pen.y + 31) >> 6) - bm->top);
+ gdft_draw_bitmap(tc_cache, im, fg, bm->bitmap, x + x1 +
((pen.x + 31) >> 6) + bm->left, y + y1 + ((pen.y + 31) >> 6) - bm->top);
}
/* record current glyph index for kerning */
@@ -1127,14 +1130,14 @@
brect[7] = (int) (normbox.xMin * sin_a + normbox.yMax * cos_a);
/* scale, round and offset brect */
- brect[0] = x + gdroundupdown(brect[0], d2 > 0);
- brect[1] = y - gdroundupdown(brect[1], d1 < 0);
- brect[2] = x + gdroundupdown(brect[2], d1 > 0);
- brect[3] = y - gdroundupdown(brect[3], d2 > 0);
- brect[4] = x + gdroundupdown(brect[4], d2 < 0);
- brect[5] = y - gdroundupdown(brect[5], d1 > 0);
- brect[6] = x + gdroundupdown(brect[6], d1 < 0);
- brect[7] = y - gdroundupdown(brect[7], d2 < 0);
+ brect[0] = xb + gdroundupdown(brect[0], d2 > 0);
+ brect[1] = yb - gdroundupdown(brect[1], d1 < 0);
+ brect[2] = xb + gdroundupdown(brect[2], d1 > 0);
+ brect[3] = yb - gdroundupdown(brect[3], d2 > 0);
+ brect[4] = xb + gdroundupdown(brect[4], d2 < 0);
+ brect[5] = yb - gdroundupdown(brect[5], d1 > 0);
+ brect[6] = xb + gdroundupdown(brect[6], d1 < 0);
+ brect[7] = yb - gdroundupdown(brect[7], d2 < 0);
}
if (tmpstr) {
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug48555.phpt?view=markup&rev=1.1
Index: php-src/ext/gd/tests/bug48555.phpt
+++ php-src/ext/gd/tests/bug48555.phpt
--TEST--
Bug #48555 (ImageFTBBox() differs from previous versions for texts with new
lines)
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
?>
--FILE--
<?php
$cwd = dirname(__FILE__);
$font = "$cwd/Tuffy.ttf";
$box = ImageFTBBox(13, 0, $font, "Text without line-break");
echo 'Top without line-break: ' . $box[7] . "\n";
$box = ImageFTBBox(13, 0, $font, "Text with\nline-break\none more");
echo 'Top with line-break: ' . $box[7] . "\n";
?>
--EXPECTF--
Top without line-break: -15
Top with line-break: -15
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/Tuffy.ttf?view=markup&rev=1.1
Index: php-src/ext/gd/tests/Tuffy.ttf
+++ php-src/ext/gd/tests/Tuffy.ttf
!"#$%&'()*+,-./0123456789:;<=>?...@abcdefghijklmnopqrstuvwxyz[\]^_`a
0
@
R
d
p
Ö...@v®Ø$Ln¤À
Ø:p¦àþJf¤ÂÞ*æ"VÜp¤ú(2 ®àî...@´ÒÜèô
þ$;IyO¤â*P\GP*.D$ +6WV ý°ÅuZ9Q4ÈþjT
°t°jyT»©Çнª¦þJÛÒþ]
-?1$
Bs¯e¦ë /";N%g´u!f~¯É+3N~NÍ*-:snDd H
3SQ) êq»" n¥&oóVbqQa¥ -Ïn'l((ÕwÍ 4,NY9V'0Ö
)PmQ¦ì 1Aþ¼¨#f³v"f°ýìÉ2->~pW3Î,+:rr>mý²
Ù
Ù
|RHô©V~KJ>I21±@,':?,':õ-P6="9
$}Z|9¤ß2`aa?7'4Gþ9-?1$,?0%
×
13HNf8·TÄ
z...@um;Óu(PmTr«6)2cï¶Âí#60M)HA&V£j=za
pLw<<uLH
3ÑvÁabÀac4\Ñlà` kM<7cvþ>ú[ºeI
{ª1ûÏ?g?+
,9F'+Z<.<"Y,'F:,
(Ùf}w" P-M³¼§+> "'...@w¾
,:F',Y<.?"Z+'F9,
'Ùi|" T+Q¾Å¡
-9 "%þØR¹
8]`4cdZPkU~pPRZ<£w,9L|M.××W_Pz[!&S]jZ`4Ä
TBTktþ×Fd¸Q}N¹þì! s*âé
¼];S Ga
-
å"N[avFF^!Q%¾ Ã0,©þÿWd
#pX«7:nÀxH\ý¿S{Q
þþµð
bC\GUy;R8& ,D%o¾&n½µÅ2)¶þÿÅ+
,ïãá
¾"
.8>H 81,
#6®7õµ¥ò,DXQ'+^eNþPj[(?d_?&ø$*Y´)÷JsO3!
µ£*-8cF:"
,GnA'þh5{$;`...@o;xJ'%À#CP7bþzýðY
ÈWR$
"AP'N55Q3^
t¶/:X/Zl1$£h(Ob4_Y´^}-IG]~
7nk9 %71&70£Ü35,6+¥&'f(YþsG9âBmuÿÿ
Iq«½g;h9ÃC÷³¬É Ý )G/30
h8cGY)J7À`Ç.2u×%sjøMèo$!8BåþÒ¸HPÂ$. )^Ò1dFm
ú
g
l
This font, including hint instructions, has been donated to the Public Domain.
Do whatever you want with it.
softhyphen
figuredashquotereverseduni201FEuro
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php