PHP 4.0 Bug #10548 Updated: function ImageTTFText always get wrong chinese words from TTF ...
| From: | cchsieh at gagazone dot net | Date: | Mon, 30 Apr 2001 12:26:58 +0000 |
| Subject: | PHP 4.0 Bug #10548 Updated: function ImageTTFText always get wrong chinese words from TTF ... | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-53059@lists.php.net to get a copy of this message | ||
ID: 10548
User Update by: cchsieh@gagazone.net
Status: Open
Bug Type: GD related
Description: function ImageTTFText always get wrong chinese words from TTF ...
About Image function - ImageTTFText: always get wrong chinese words from TTF.
To correct the problem:
690c690
< ch = (ch * 256) + **next;
---
> ch = (ch * 256) + ((**next) & 255);
705c705,709
< *advance = glyph->metrics.advance;
---
>
> if ( !font->have_char_map_Unicode && (ch < 161) )
> *advance = glyph->metrics.advance / 2;
> else
> *advance = glyph->metrics.advance;
Script to test:
<?php
// Create the image
$png = ImageCreate(200,200);
$bg = ImageColorAllocate($png,0,0,0);
$tx = ImageColorAllocate($png,255,128,128);
// Set Chinese words ("Chinese language" in Chinese Big5)
$string="¤¤¤å";
// Chinese test (need mingli.ttf from MS-Win Chinese ver)
ImageTTFText($png,30,0,0,100,$tx,"/home/staff/cchsieh/public_html/gd/mingli.ttf
// Send the image
header("content-type: image/png\n\n");
ImagePng($png);
// Destroy image
ImageDestroy($png);
?>
Previous Comments:
---------------------------------------------------------------------------
[2001-04-29 06:00:49] cchsieh@gagazone.net
About Image function - ImageTTFText: always get wrong chinese words from TTF.
To correct the problem:
$ diff gdttf.c.orig gdttf.c
690c690
< ch = (ch * 256) + **next;
---
> ch = (ch * 256) + ((**next) & 255);
Script to test:
<?php
// Create the image
$png = ImageCreate(200,200);
$bg = ImageColorAllocate($png,0,0,0);
$tx = ImageColorAllocate($png,255,128,128);
// Set Chinese words ("Chinese language" in Chinese Big5)
$string="¤¤¤å";
// Chinese test (need mingli.ttf from MS-Win Chinese ver)
ImageTTFText($png,30,0,0,100,$tx,"/home/staff/cchsieh/public_html/gd/mingli.ttf
// Send the image
header("content-type: image/pngnn");
ImagePng($png);
// Destroy image
ImageDestroy($png);
?>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=10548