微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 在imagettftext()中使用马拉雅拉姆语单词

我试图使用PHP imagettftext()函数将马拉雅拉姆语(印度语)单词转换为图像.我也在使用Malayalam字体.这是我正在使用的代码块.

// malayalam word
$utf8str = "കറുപ്പ്";

// buffer output in case there are errors
ob_start();

// create blank image
$im = imagecreatetruecolor(400,40);
$white = imagecolorallocate($im,255,255,255);
imagefilledrectangle($im,0,0,imagesx($im),imagesy($im),$white);

// write the text to image
$font = "anjali.ttf";
$color = imagecolorallocatealpha($im, 50, 50, 50, 0); // dark gray
$size = 20;
$angle = 0;
$x = 5;
$y = 25;
imagettftext($im, $size, $angle, $x, $y , $color, $font, $utf8str);

// display the image, if no errors
$err = ob_get_clean();
if( !$err ) {
    header("Content-type: image/png");
    imagepng($im);
}

使用此代码,我得到以下输出

enter image description here

我已经尝试了很多来自stackoverflow的Malayalam字体和代码.任何人都可以帮我吗?

解决方法:

经过长时间的研究,我发现现有的马拉雅拉姆字体并不支持所有字符.我们将不得不等待支持所有角色的新字体出现.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐