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

GD和php 5.3中的字距调整问题

发布时间:2020-12-13 13:08:10 所属栏目:PHP教程 来源:网络整理
导读:知道这个问题之前已经得到了解决 PHP update kerning problem with imagettftext() and imagefttext() functions 但没有解决方案; PHP5.3在打印文本时似乎有字距调整问题: 查看以下示例中的’x'(字体:Ubuntu-M.ttf): PHP5.2,ubuntu(不错) PHP5.3.2,ubuntu
知道这个问题之前已经得到了解决
PHP update kerning problem with imagettftext() and imagefttext() functions
但没有解决方案;

PHP5.3在打印文本时似乎有字距调整问题:

查看以下示例中的’x'(字体:Ubuntu-M.ttf):

PHP5.2,ubuntu(不错)

PHP5.3.2,ubuntu(更糟糕的是,x是肥胖的)

PHP5.3.2,MAMP OSX(太可怕了)

这有什么解决方案吗?

有5.3.6安装的人试试这个吗?

问候,
//?

下载字体后,我试图用我的家用机器复制中间图像(Ubuntu字体系列的0.71.2版本). Arch Linux,x86_64,PHP 5.3.6,GD 2.0.34(捆绑),Suhosin补丁,FreeType 2.4.4.我最好在e和x上进行字距调整.

图像生成:

<?php
$img = imagecreatetruecolor(158,72);
imagesavealpha($img,true);

$bg = imagecolorallocatealpha($img,127);
$black = imagecolorallocate($img,0);
imagefill($img,$bg);

$text = "testar text"; // - was attempt at no aa,like example
imagettftext($img,24,36,-($black),'Ubuntu-M',$text);
$text = "med text";
imagefttext($img,12,72,$black,$text);

imagepng($img,'test.png');
imagedestroy($img);
?>

输出:

(编辑:李大同)

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

    推荐文章
      热点阅读