Search code examples
phpphp-gd

Recognizing the Serbian Alphabet in PHP GD


I am trying to use some siberian alphabet name with PHP gd, but each time, I am getting error with ambigious letter. Below is my code :-

function properText($text){
        $text = mb_convert_encoding($text, "HTML-ENTITIES", "UTF-8");
        $text = preg_replace('~^(&([a-zA-Z0-9]);)~',htmlentities('${1}'),$text);
        return($text);
    }
    $im = imagecreatefrompng('testcreating.png');
    $returnedtext = properText('Jelena Jovanić');
    imagettftext($im, 11, 0, 90, 195, 0x000000, 'transcript.ttf', $returnedtext);
    imagealphablending($im, true);
    imagesavealpha($im, true);
    imageJpeg($im, "testcreating.jpg", 85);
    imagedestroy($im);
    return HTML::image('testcreating.jpg');

But it is not able to recognise letter ć, it is giving ambigous code.

How can i resolve it.

Thanks


Solution

  • The font you're using "transcript.ttf" must support the alphabet you want to use.

    I can't vouch for any of theses but i found a site that claims theses fonts will support the Siberian alphabet: http://www.fontsquirrel.com/fonts/list/language/serbian