imagettftext希伯来语中的php函数?

时间:2019-01-05 22:13:11

标签: php

我需要用希伯来语字母写到imagettftext()GD2,怎么办?

到目前为止,这是迄今为止我对女巫的最佳解决方案:

<?php
$language_into = 'he';
$im = ImageCreateFromPNG('test.png'); 
$black = ImageColorAllocate($im, 0, 0, 0);
ImageColorTransparent($im, $black);
ImageSaveAlpha($im, true);
$text = "בְּרֵאשִׁית";
//Reverse string for RTL languages 
switch($language_into)
{
    case 'he':
    case 'ar':
        preg_match_all ('/./us' , $text, $rtl);
        $text = join ('' , array_reverse($rtl[0])); 
    break;

    default:
    break;
}
//Link: http://titus.fkidg1.uni-frankfurt.de/unicode/tituut.asp
ImageTtfText($im, 18, 0, 12, 36, $black, "tituscbz.ttf", $text);
Header('Content-Type: image/png');
Header("Expires: Mon, 1, 1999 05:00:00 GMT");
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-store, no-cache, must-revalidate");
Header("Cache-Control: post-check=0, pre-check=0", false);
Header("Pragma: no-cache");
imagepng($im);
imagedestroy($im);

0 个答案:

没有答案