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

Tes*_*son 8 php gd kerning

使用imagettftext()和imagefttext()函数进行PHP更新字距调整问题之前,已经知道这个问题, 但是没有解决方案;

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

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

PHP5.2,ubuntu(不错)

在此输入图像描述

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

在此输入图像描述

PHP5.3.2,MAMP OSX(可怕)

在此输入图像描述

这有什么解决方案吗?

任何安装了5.3.6的人都可以试试这个吗?

问候,// t

Iir*_*ayn 2

下载字体(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, 0, 0, 0, 127);
$black = imagecolorallocate($img, 0, 0, 0);
imagefill($img, 0, 0, $bg);

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

imagepng($img, 'test.png');
imagedestroy($img);
?>
Run Code Online (Sandbox Code Playgroud)

输出:

尝试复制有问题的第二张图像的输出