查看文章
 
imagestring的中文支持问题
2007/07/15 2:39 P.M.

摸索了半天,终于找到解决方案了

<?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一起吗?

看看你的网络够不够快了
浏览会卡吗?


类别:编程开发||添加到搜藏 |分享到i贴吧|浏览(2022)|评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
     

   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu