摸索了半天,终于找到解决方案了
<?php
// Set the content-type
header("Content-type: image/gif");
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = iconv('gb2312','utf-8','中');
// Replace path by your own font path
$font = 'simsun.ttc';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagegif($im);
imagedestroy($im);
?>
simsun.ttc是字体文件
似乎比较大的样子--
不知道会不会太慢
或者可以碰碰运气
使用
$font = 'C:/windows/fonts/simsun.ttc';
不过万一对方的字体不是放在这个位置怎么办?
是了,问题:
关于字体
不是上网浏览的时候,如果英文平台下就会提示下载字体吗?
那么...
这些字体存在哪里--?
是和windows下的fonts一起吗?
看看你的网络够不够快了
浏览会卡吗?