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字体和代码.任何人都可以帮我吗?

解决方法:

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

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...