imagettftext(); で左から右ではなく、右から左に文字列を書きたい。関数
角度変数がこれを制御することをマニュアルで読みました.0角度は左から右を意味すると書かれているので、180、360を試しましたが、何も起こりません
右から左に書くには、どの角度に置く必要がありますか
ヘブライ文字をサポートする font.ttf でヘブライ語のテキスト文字列を書いています
<?php
$white = imagecolorallocate($background, 255, 255, 255);
$fontfile = "davidtr.ttf";
$string = "מחלדגכ";
imagettftext($background, 12, 360, 3, 17, $white, $fontfile, $string);
?>
この関数 strrev() も使用しました。
$white = imagecolorallocate($background, 255, 255, 255);
$fontfile = "davidtr.ttf";
$string = strrev("עברית");
//imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function');
imagettftext($background, 12, 0, 3, 17, $white, $fontfile, $string);
テキストが画像上で台無しになりました 一部の文字は白いボックスです
次に、この関数を使用しました:
function utf8_strrev($str){
preg_match_all('/./us', $str, $ar);
return join('',array_reverse($ar[0]));
}
それは私を大いに助けましたが、今では整数も逆になりました
$string = "מחל 65 דגכ";
echo utf8_strrev($string);
//Now string revered but 65 converted to 56
整数ではなくヘブライ文字のみが反転する、より良い解決策を教えてください。