3

問題のスクリーンショット:

ここに画像の説明を入力

Font Squirrel の sample fonts widgetなどと同じフォント品質を取得しようとしていますが、フォントが粗くなり続けます。Photoshop で滑らかです。注: 「怠惰な犬」の部分は、私が太字にしているわけではありません。

PHPは次のとおりです。

<?php 
putenv('GDFONTPATH=' . realpath('.'));

$font = $_GET['font'] . '.ttf';
$text = 'The Quick Brown Fox Jumps over the Lazy Dog';

// Create the image
function imageCreateTransparent($x, $y) { 
    $imageOut = imagecreate($x, $y);
    $colourBlack = imagecolorallocate($imageOut, 0, 0, 0);
    imagecolortransparent($imageOut, $colourBlack);
    return $imageOut;
}

$image = imageCreateTransparent(600, 800);

// Create some colors
$white = imagecolorallocate($image, 255, 255, 255);
$grey = imagecolorallocate($image, 128, 128, 128);
$black = imagecolorallocate($image, 0, 0, 0);
imagefilledrectangle($image, 0, 0, 399, 29, $white);



// Add the text
imagettftext($image, 20, 0, 10, 20, $black, $font, $text);
imagepng($image);
imagealphablending($image, true);
imagedestroy($image);
?>

HTML:<img src="fontgen.php?font=Aller_Rg" alt="" />

フォントの高品質の結果を得るにはどうすればよいですか?

4

2 に答える 2

0

左側の 400 ピクセルでのみ背景を明示的に白くしているためだと思われます。その右側はおそらくまだ透明で、いくつかの副作用があります。はr、先ほど作成した白い背景を越えて始まる最初の文字です。

于 2013-06-08T13:12:25.340 に答える