Req #43899 [Sus->Opn]: Problem in displaying right to left connected languages (like persian, arabic)
| From: | cmb@php.net | Date: | Wed, 25 Aug 2021 11:54:05 +0000 |
| Subject: | Req #43899 [Sus->Opn]: Problem in displaying right to left connected languages (like persian, arabic) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236061@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=43899&edit=1
ID: 43899
Updated by: cmb@php.net
Reported by: mohamnag at gmail dot com
Summary: Problem in displaying right to left connected
languages (like persian, arabic)
-Status: Suspended
+Status: Open
Type: Feature/Change Request
Package: GD related
Operating System: *
PHP Version: 6
Block user comment: N
Private report: N
New Comment:
CTL support is available as of GD 2.3.0, but that has not yet been
ported to the bundled GD.
Previous Comments:
------------------------------------------------------------------------
[2016-09-14 14:08:51] cmb@php.net
Indeed, libgd does not yet support complex text layout except in
master, but this is not a bug, but rather a missing feature.
Anyhow, I'm suspending this ticket until libgd actually releases
CTL support.
------------------------------------------------------------------------
[2016-09-14 14:05:29] cmb@php.net
Related To: Bug #72912
------------------------------------------------------------------------
[2008-10-27 12:58:26] jani@php.net
Assigned to the GD maintainer.
------------------------------------------------------------------------
[2008-01-20 12:28:29] mohamnag at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=43899&edit=1