note 97767 modified in function.imagettftext by danbrown

From: Date: Fri, 07 May 2010 12:34:26 +0000
Subject: note 97767 modified in function.imagettftext by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169055@lists.php.net to get a copy of this message
In order to pass text of RTL language to imagettftext function, I used this function. <?php function revUni($text) { $wordsArray = explode(" ", $text); $rtlCompleteText=''; for ($i = sizeOf($wordsArray); $i > -1; $i = $i-1) { //$lettersArray = explode("|", str_replace(";|", ";", $wordsArray[$i])); $lettersArray = explode(";", $wordsArray[$i]); $rtlWord=''; for ($k = sizeOf($lettersArray); $k > -1; $k = $k-1) { if (strlen($lettersArray[$k]) > 1) { // make sure its full unicode letter $rtlWord = $rtlWord."".$lettersArray[$k].";"; } } $rtlCompleteText = $rtlCompleteText." ".$rtlWord; } return $rtlCompleteText; } ?> --was-- In order to pass text of RTL language to imagettftext function, I used this function. function revUni($text) { $wordsArray = explode(" ", $text); $rtlCompleteText=''; for ($i = sizeOf($wordsArray); $i > -1; $i = $i-1) { //$lettersArray = explode("|", str_replace(";|", ";", $wordsArray[$i])); $lettersArray = explode(";", $wordsArray[$i]); $rtlWord=''; for ($k = sizeOf($lettersArray); $k > -1; $k = $k-1) { if (strlen($lettersArray[$k]) > 1) { // make sure its full unicode letter $rtlWord = $rtlWord."".$lettersArray[$k].";"; } } $rtlCompleteText = $rtlCompleteText." ".$rtlWord; } return $rtlCompleteText; } http://php.net/manual/en/function.imagettftext.php

« previous php.notes (#169055) next »