ID:               17955
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dk at webcluster dot at
 Status:           Bogus
 Bug Type:         GD related
 Operating System: RedHat 7.3
 PHP Version:      4CVS, 5CVS
 Assigned To:      moriyoshi
 New Comment:

I can't add much more to this as my initial report was from 2002 but
I'll get back to your tips as soon as I need symbol fonts again.

Thank's a lot moriyoshi for digging into this problem and for taking
care of even old bug reports - _really_

cheers

Daniel Khan


Previous Comments:
------------------------------------------------------------------------

[2004-01-26 14:34:14] [EMAIL PROTECTED]

This problem turned out not to be a PHP developer's 
issue.

Read the following post on the freetype list archive:

http://www.freetype.org/pipermail/freetype/2001-October/
004507.html

And then, try this one:

<?php
$str = "this is a test";
$str = iconv("UCS-2", "UTF-8", preg_replace("/(.)/", 
"\xf0\$1", $str));

$fsize = 32;
$ffile="./webdings.ttf";

$size = ImageTTFBBox($fsize, 0, $ffile, $str);

$txt_width = ($size[2] - $size[0]);
$txt_height = ($size[1] - $size[7]);

$im_width = $txt_width * 1.5; 
$im_height = $txt_height * 1.5;

$im = ImageCreateTrueColor($im_width, $im_height);
$black = ImageColorAllocate($im, 0, 0, 0);
$white = ImageColorAllocate($im, 255, 255, 255);

$txt_x = ($im_width - $txt_width) / 2;
$txt_y = ($im_height - $txt_height) / 2 + $txt_height;

ImageFilledRectangle($im, 0, 0, $im_width, $im_height, 
$white);
ImageTTFText($im, $fsize, 0, $txt_x, $txt_y, $black, 
$ffile, $str);

ImagePng($im);
ImageDestroy($im);
?>

The output of the script can be seen in the following 
page:
http://www.voltex.jp/articles/imagettf_m10n.htm

------------------------------------------------------------------------

[2004-01-22 18:16:40] [EMAIL PROTECTED]

Take a look at bug #26901. I summerized the 
"rectangular / square placeholders" issues that you may 
encounter when using non-ASCII characters with 
ImageTTFText() / ImageFTText().


------------------------------------------------------------------------

[2003-12-17 09:20:21] [EMAIL PROTECTED]

I'll take a look into this.
Assign to myself.


------------------------------------------------------------------------

[2002-06-25 05:44:46] dk at webcluster dot at

Additional info:

I talked again to the freetype guys.

They asked me to try to use "&#61473;" instead of the characters. This
worked fine:

<quote>
If &#61473; works but UTF-8 not then GD was compiled with the option
JISX0208 which IMHO prevents decoding of UTF-8 encoded character
codes.
Then try to find out why this option was set.
</quote>

------------------------------------------------------------------------

[2002-06-24 21:25:51] dk at webcluster dot at

<?PHP
function hex2rgb($hex) {
    $c = array('R', 'G', 'B'); $i = 0;
    preg_replace('/([a-f0-9]{2})/ie', '$rgb[$c[$i++]] = hexdec("\1")',
$hex);
    return $rgb;
} 

$col = "FF0000";
$text = "Here comes the text!";
$rgb = hex2rgb($col);

$fontsize = 18;
$font="/some/dir/webdings.ttf";

$size=ImageTTFBBox($fontsize,0,$font,$text);

$width = abs($size[2]); 
$height = abs($size[5]);
Header ("Content-type: image/jpeg");


$im = ImageCreate ($width+11, $height+8);
$bg = ImageColorAllocate ($im, 255, 255, 255);
ImageColorTransparent($im, $bg);
$main = ImageColorAllocate ($im, $rgb["R"], $rgb["G"], $rgb["B"]);

$shadow = ImageColorAllocate ($im, 219, 219, 219);
ImageTTFText($im,$fontsize,0,1,21,$shadow,$font,$text);
ImageTTFText($im,$fontsize,0,0,20,$main,$font,$text);


ImageGif ($im);
ImageDestroy ($im);

?>

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17955

-- 
Edit this bug report at http://bugs.php.net/?id=17955&edit=1

Reply via email to