tabe            Sun Jun 21 06:09:46 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/gd/tests       Tuffy.ttf bug48555.phpt 

  Modified files:              
    /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/ext/gd/libgd/gdft.c?r1=1.36.4.9.2.2&r2=1.36.4.9.2.3&diff_format=u
Index: php-src/ext/gd/libgd/gdft.c
diff -u php-src/ext/gd/libgd/gdft.c:1.36.4.9.2.2 
php-src/ext/gd/libgd/gdft.c:1.36.4.9.2.3
--- php-src/ext/gd/libgd/gdft.c:1.36.4.9.2.2    Wed Mar 18 00:29:42 2009
+++ php-src/ext/gd/libgd/gdft.c Sun Jun 21 06:09:46 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/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®Ø$Ln¤À
Ø:p¦àþJfŽ¤ÂÞ*‚Žæ"V”Üp¤ú(2 ®àî...@†´ÒÜèô

þ$;IyO¤â*P\GP*.D$ +6W„V›Â      ý°ÅuZ9Q4ÈþŒjT€
°‰”t°j†yT»©Çнª¦þJÛÒþ]
-?1$

Bs¯e¦ë  /";N›˜%g‡´u!f~¯ɛ+3N›~N͓*-:snDd       H
3SQ)“  êq»„" nƒ¥Ž&oŒóVb‚qQa„¥ƒ -Ïn'”l((ÕwÍ 4,N†Y9V'0ŸÖ
)Pm’Q¦ì        1Aþ¼¨#f‡³v"f€°ýìɛ2->~pW3Γ,+:rr>mý²
Ù


Ù
  š|R‹H’ô©Vœ~KJ>I21±@,':?,':õ‘-P6="9  
$}‰Z|9¤ß2`œaa“?7'4Gþ9-?1$,?0%


×
13HNf8‚·TÄ
z...@um;ƒÓu(Pm”Tr«6)2cï¶Âí#60M)HA&˜›V£j=za
        ŒpLw<<uLH …3Ñv‚ÁabÀ‚ažc4\‘Ñ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]`4‡cdZPkU~pPRZ<£‡‘w,9L|M.××W_Pz[!&S]jZ`4Ä
TBT‡ktþ×Fd†¸Q}N‡¹þì! s*âé
¼‚]“;–S Ga
-
Œå"N’[avFšFŒ‹^!›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/ZŒl1$£h(Ob4_Y´ž^}-IG]~
7nk9 %71&™70£Ü35,6+¥&'f(YþsG9âBmuÿÿ








—Iq«½g;h9ÃCƒ÷³¬É Ý )G/30    
h8™cˆGY)J7À‡œ`Ç.2uˆ×†%s›j›øMèo$!8‹BåþÒ¸˜HPÂ$. )^Ò1d“FŒm













ú
g
l





This font, including hint instructions, has been donated to the Public Domain.  
Do whatever you want with it.








softhyphen
figuredashquotereverseduni201FEuro


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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to