Pregunta

Saber que este problema ha sido abordado antes enPhp Update Kerning Problem con imagettftext () y imageftText () Funcionespero solución de la solución;

Php5.3 parece tener problemas de kerning al imprimir texto:

Mire la 'X' en los siguientes ejemplos (Font: Ubuntu-M.Ttf):

Php5.2, Ubuntu (bueno)

enter image description here

Php5.3.2, ubuntu (peor, x está engordado)

enter image description here

Php5.3.2, Mamp OSX (horrible)

enter image description here

Hay alguna solución para esto?

¿Alguien con 5.3.6 instalado cuidado para probar esto?

Saludos, // t

¿Fue útil?

Solución

Intenté replicar la imagen central con mi máquina de inicio después de descargar la fuente (versión 0.71.2 de la familia de fuentes Ubuntu). Arch Linux, X86_64, PHP 5.3.6, GD 2.0.34 (BUNDLED), Patch Suhosin, Freetype 2.4.4. Mejor kerning en E y X.

Generación de imágenes:

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

Producción:

output of attempt to duplicate second image in question

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top