質問

この問題を知っていることは以前に高められていますphp update kerning kerning ubsex witしかし、賢明な解決策。

php5.3はテキストを印刷するときにkerningの問題を抱えているようです。

次の例の「x」を見てください(font:ubuntu-m.ttf):

php5.2、ubuntu(良い)

enter image description here

php5.3.2、ubuntu(さらに悪いことに、xは肥育します)

enter image description here

php5.3.2、mamp osx(恐ろしい)

enter image description here

これに対する解決策はありますか?

5.3.6がこれを試すためにケアをインストールした人はいますか?

よろしく、// t

役に立ちましたか?

解決

フォント(Ubuntu Fontファミリーのバージョン0.71.2)をダウンロードした後、ホームマシンで中央の画像を再現しようとしました。 Arch Linux、X86_64、PHP 5.3.6、GD 2.0.34(バンドル)、Suhosin Patch、Freetype 2.4.4。 EとXの両方でKerningを獲得しました。

画像生成:

<?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);
?>

出力:

output of attempt to duplicate second image in question

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top