Tamil unicode font in php gd

Many people have asked similar questions. Most of them recommend using the correct fonts. I have tried most of the tamil utf fonts available. I haven't found a complete solution.

Once out of the fonts, it looks like you need to change the text.

கு → This is the only letter combined of two letters.
க ு → These are two letters used to create one letter.

function str_split_unicode($str, $length = 1) {
$tmp = preg_split('~~u', $str, -1, PREG_SPLIT_NO_EMPTY);
if ($length > 1) {
    $chunks = array_chunk($tmp, $length);
    foreach ($chunks as $i => $chunk) {
        $chunks[$i] = join('', (array) $chunk);
    }
    $tmp = $chunks;
}
return $tmp;

      

}

I used the above function to find these two letters.

$text = "கு";//க ு
$text_array = str_split_unicode($text);
print_r($text_array);

Array ( [0] => க [1] => ு )

$font_path = 'TSCu_SaiIndira.ttf';
$image = imagecreatetruecolor(200, 200);
$white = imagecolorallocate($image, 255, 255, 255);
//$sentence = utf8_decode($sentence);

imagettftext($image, 26, 0, 75, 100, $white, $font_path, $text);

// Send Image to Browser
imagejpeg($image,"o.jpg",100);

// Clear Memory
imagedestroy($image);

      

It didn't work.

$text = $text_array[1].$text_array[0];

      

However, it didn't work. But I tried this method on some other emails, it worked. For example, he worked on this word. "ஜெ".

The word for "ஜெ" is the sound "A". The word for "கு" is the sound "Uooo".

+3


source to share





All Articles