#37009 [Fbk]: I got wrong letter Å and å !
| From: | derick@php.net | Date: | Sat, 08 Apr 2006 00:41:52 +0000 |
| Subject: | #37009 [Fbk]: I got wrong letter Å and å ! | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95457@lists.php.net to get a copy of this message | ||
ID: 37009
Updated by: derick@php.net
Reported By: bengt at sm7jqb dot se
Status: Feedback
Bug Type: GD related
Operating System: RedHat Linux 7.3
PHP Version: 4.4.2
New Comment:
The built in fonts in GD all use latin2 which doesn't have your
characters in the same places as the latin1 you're using. ..
Previous Comments:
------------------------------------------------------------------------
[2006-04-07 16:49:26] pajoye@php.net
Can you provide a 3-5lines script to reproduce your problem?
A static string, imagestring, imagepng, that's all.
------------------------------------------------------------------------
[2006-04-07 16:27:07] bengt at sm7jqb dot se
Hi,
It is basicly this line doing wrong
imagestring($im, $font, $px, $py, $text, $black);
And I think it is something wrong in the 'font' data !
You can se it here http://sm7jqb.se/PHP/
It is ´L it shuld be an Å
The text on that button shuld be "Test-ÅÄÖ-åäö"
------------------------------------------------------------------------
[2006-04-07 15:25:37] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2006-04-07 15:13:32] bengt at sm7jqb dot se
Description:
------------
This line prtoduse vrong letter 'Å' and 'å' !
<br />
<img
src="http://sm7jqb.se/PHP/knappjpeg.php?bild=knapp&text=Test-ÅÄÖ-åäö&font=3&height=20"> *.jpeg
Is that bug fixed in the new 4.4.2 ?
Reproduce code:
---------------
<?php
header("Content-type: image/jpeg");
$text = $_GET['text'];
$bild = $_GET['bild'];
if ( !$_GET['font'] ) $font = 3; else $font = $_GET['font'];
$bgimg = imagecreatefromjpeg("./bild/".$bild.".jpg");
if ( !$_GET['height'] )
$height = imagesy($bgimg); else $height = $_GET['height'];
// Gör en lagom stor ny bild
if ( $width < ((strlen($text)*9.0)+11))
$width = (strlen($text)*9.0)+11;
$im = imagecreate($width, $height);
$bgc = imagecolorallocate($im, 255, 255, 200);
$black = imagecolorallocate($im, 0, 0, 0);
$grey = imagecolorallocate($im, 100, 100, 100);
$ltgrey = imagecolorallocate($im, 250, 250, 250);
imagefill($im,0,0,$bgc);
// Vänster del
$dst_x = 0;
$dst_y = 0;
$src_x = 0;
$src_y = 0;
if ( imagesx($bgimg) < ((int)imagesx($im)/2+0.9) ) $src_w =
((int)imagesx($bgimg)/2+0.9); else
$src_w = ((int)imagesx($im)/2+0.9);
$src_h = imagesy($im);
imageCopyMerge($im, $bgimg, $dst_x, $dst_y, $src_x, $src_y, $src_w,
$src_h, 100);
$dst_x = $src_w;
$src_x = imagesx($bgimg)-$src_w;
while ( ($dst_x+$src_w) < (imagesx($im)-$src_w) ) {
$src_x = 1;
imageCopyMerge($im, $bgimg, $dst_x, $dst_y, $src_x, $src_y, $src_w,
$src_h, 100);
$dst_x += $src_w-1;
}
// Höger del
if ( imagesx($bgimg) < ((int)imagesx($im)/2+0.9) ) {
$src_w = imagesx($bgimg);
$src_x = 1;
}
else
$src_w = ((int)imagesx($im)/2+1.9);
$dst_x = imagesx($im) - $src_w + 1;
imageCopyMerge($im, $bgimg, $dst_x, $dst_y, $src_x, $src_y, $src_w,
$src_h, 100);
// Lägg på texten
$px = (imagesx($im) - 7.0 * strlen($text)) / 2;
$py = (imagesy($im) - 13.0) / 2;
if ( $_GET['shadow'] == 'grey' )
imagestring($im, $font, $px+2, $py+2, $text, $grey);
if ( $_GET['shadow'] == 'ltgrey' )
imagestring($im, $font, $px+2, $py+2, $text, $ltgrey);
imagestring($im, $font, $px, $py, $text, $black);
imagejpeg($im);
imagedestroy($im);
imagedestroy($bgimg);
?>
Expected result:
----------------
I vant the text on my button but I got wrong letter 'Å' and 'å'
Try it!
Actual result:
--------------
You can run the script your self to se
http://www.sm7jqb.se/PHP/knappjpeg.php?bild=knapp&text=Test-ÅÄÖ-åäö&font=3&height=20
Thanks!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37009&edit=1