加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 16:04:53 所属栏目:PHP教程 来源:网络整理
导读:我试图使用php imagettftext()函数将马拉雅拉姆语(印度语)单词转换为图像.我也在使用Malayalam字体.这是我正在使用的代码块. // malayalam word$utf8str = "???????";// buffer output in case there are errorsob_start();// create blank image$im = image
我试图使用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);
imagefilledrectangle($im,imagesx($im),imagesy($im),$white);

// write the text to image
$font = "anjali.ttf";
$color = imagecolorallocatealpha($im,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字体和代码.任何人都可以帮我吗?

解决方法

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读