uw Wed Mar 28 05:56:35 2001 EDT
Modified files:
/php4/pear/Experimental/Image gtext.php
Log:
- fixed the vertical alignment bug
Index: php4/pear/Experimental/Image/gtext.php
diff -u php4/pear/Experimental/Image/gtext.php:1.1
php4/pear/Experimental/Image/gtext.php:1.2
--- php4/pear/Experimental/Image/gtext.php:1.1 Wed Mar 28 04:48:36 2001
+++ php4/pear/Experimental/Image/gtext.php Wed Mar 28 05:56:33 2001
@@ -23,7 +23,7 @@
* FIXME - Usage example missing - FIXME
*
* @author Ulf Wendel <[EMAIL PROTECTED]>
-* @version $Id: gtext.php,v 1.1 2001/03/28 12:48:36 uw Exp $
+* @version $Id: gtext.php,v 1.2 2001/03/28 13:56:33 uw Exp $
*/
class gtext extends ColorHelper {
@@ -304,7 +304,7 @@
$descender_height = 2 * $font_height;
- // temporary image to draw on
+ // temporary image to draw on
$tmp_img = @ImageCreate($descender_width, $descender_height);
$bg_color = $this->allocateColor($tmp_img, "white");
$fg_color = $this->allocateColor($tmp_img, "black");
@@ -318,16 +318,14 @@
// scanning the height of a descender
// search the lower right edge
for ($yb = $descender_height; $yb >= 0; $yb--)
- for ($x = $descender_width; $x >= 0; $x--)
- if (ImageColorAt($tmp_img, $x, $yb) == $fg_color)
- break 2;
-
- for ($yt = 0; $yt <= $descender_height; $yt++)
- for ($x = $descender_width; $x >= 0; $x--)
- if (ImageColorAt($tmp_img, $x, $yt) == $fg_color)
- break 2;
+ if (ImageColorAt($tmp_img, 2, $yb) == $fg_color)
+ break;
- $descender_diff = abs($yb - $yt);
+ for ($yt = $yb - 1; $yt >= 0; $yt--)
+ if (ImageColorAt($tmp_img, 2, $yt) != $fg_color)
+ break;
+
+ $descender_diff = $yb - $yt;
$font_height += $descender_diff;
// cache the result
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]