From:             mohamnag at gmail dot com
Operating system: Ubuntu Gusty
PHP version:      5.2.5
PHP Bug Type:     GD related
Bug description:  Problem in displaying right to left connected languages (like 
persian, arabic)

Description:
------------
There is an issue displaying Persian characters in GD generated images.
In persian, characters are arranged right to left (I mean first char is
the most right hand arranged one). In addition characters are connected.
For example while ی and ک are being written when separated,
they should be written یک when connected. So not only they
should be arranged right to left but also the shape of characters change
during connections.
However displaying text using GD don't arrange persian characters right to
left nor connects them correctly.
Some persian developers have made a php function which corrects the
problem here: http://persiangd.berlios.de/doku.php
but I think it should be solved globally in the original lib.


Reproduce code:
---------------
header("Content-type: image/png");
//uncomment to correct issue:
//include("fagd.php");

$text="یک";

$im = imagecreate(800, 40);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);

//uncomment to correct issue:
//$text = fagd($string,'fa');

$font = dirname(__FILE__).'/tahoma.ttf';

// Add the text
imagettftext($im, 20, 0, 20, 25, $black, $font,$text);

imagepng($im);
imagedestroy($im);


Expected result:
----------------
this is an image displaying the correct output resulting from passing the
text to imagettftext(), after being parsed using the fagd() function
(provided by persian developers to correct the issue):
http://khone.ir/test/t2.png

Actual result:
--------------
this is an image displaying the problematic view resulting from direct
input of persian text to imagettftext():
http://khone.ir/test/t1.png

-- 
Edit bug report at http://bugs.php.net/?id=43899&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43899&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43899&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43899&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43899&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43899&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43899&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43899&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43899&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43899&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43899&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43899&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43899&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43899&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43899&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43899&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43899&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43899&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43899&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43899&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43899&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43899&r=mysqlcfg

Reply via email to