Problema di kerning in GD e PHP 5.3
Domanda
Conoscere questo problema è stato induzionato primaPHP Update Kerning Problem con le funzioni ImageTTFText () e ImageftText ()Ma Witout Solution;
PHP5.3 sembra avere problemi di kerning durante la stampa del testo:
Guarda la "X" nei seguenti esempi (Font: Ubuntu-m.ttf):
Php5.2, ubuntu (buono)
Php5.3.2, ubuntu (peggio, x è ingrassato)
PHP5.3.2, MAMP OSX (orribile)
c'è qualche soluzione a questo?
Qualcuno con 5.3.6 installata per provare questo?
Saluti, // T
Soluzione
Ho tentato di replicare l'immagine centrale con la mia macchina da casa dopo aver scaricato il carattere (versione 0.71.2 della famiglia dei caratteri Ubuntu). Arch Linux, X86_64, PHP 5.3.6, GD 2.0.34 (bundled), Patch Suhosin, FreeType 2.4.4. È stato meglio deridere su E e X.
Generazione di immagini:
<?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);
?>
Produzione: