Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to properly write unicode words to image using PHP imgttftext() function
    primarykey
    data
    text
    <p>I am trying to write some Urdu text on an image using imgttftext() function of PHP. It does not display the characters unless I convert the text using the following code:</p> <pre><code>function convert($text){ $out=""; mb_language('uni'); mb_internal_encoding('UTF-8'); $text = mb_convert_encoding($text, 'HTML-ENTITIES',"UTF-8"); $text = html_entity_decode($text,ENT_NOQUOTES, "ISO-8859-1"); for($i = 0; $i &lt; strlen($text); $i++) { $letter = $text[$i]; $num = ord($letter); if($num&gt;127) { $out .= "&amp;#$num;"; } else { $out .= $letter; } } return $out; } </code></pre> <p>Now, the text e.g. عچں (which contains the three characters ع چ ں) is printed on to the image as separate and full characters instead of cutting and joining the characters to form an Urdu word like عچں.</p> <p>I have used the characters ا ب ت ث with codes U+0627, U+0628, U+0629 and so on from this page <a href="http://en.wikipedia.org/wiki/List_of_Unicode_characters#Arabic" rel="nofollow">http://en.wikipedia.org/wiki/List_of_Unicode_characters#Arabic</a></p> <p>I have shared the code here: <a href="https://code.google.com/p/urdu-captcha/downloads/list" rel="nofollow">https://code.google.com/p/urdu-captcha/downloads/list</a></p> <blockquote> <p>Note: I have added space between the characters in the code provided removing which makes no difference to how the text is displayed on the image.</p> </blockquote> <p>How do I make it write the characters joined together to form proper words?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload