2012-08-12 49 views
0

我正在使用以下代碼來生成基於文本的圖像。除了字母「a」和「A」分別表示爲å和Å以外,一切正常。爲什麼?imagettftext(),GD,TrueType字體和字母'a'/'A'(奇怪)

一切看起來不錯,但一/ A.

header('Content-Type: image/png'); 

// Create the image 
$im = imagecreatetruecolor(400, 30); 

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

// The text to draw 
//$text = @$_GET['text']; 
$text = "qwertyuiopASDFGHJKLasdfghjklzxcvbnm"; 

// Replace path by your own font path 
$font = 'arial.ttf'; 

// Add some shadow to the text 
//imagettftext($im, 12, 0, 11, 21, $grey, $font, $text); 

// Add the text 
imagettftext($im, 12, 0, 10, 20, $black, $font, $text); 

// Using imagepng() results in clearer text compared with imagejpeg() 
imagepng($im); 
imagedestroy($im); 

謝謝! =)

編輯: 快照IMG的:enter image description here

EDIT2: 這是否斷定什麼? http://en.wikipedia.org/wiki/%C3%85#On_computers

+0

這聽起來很奇怪。你能展示一個這樣的圖像的屏幕截圖嗎? – 2012-08-12 13:00:05

+0

這聽起來很奇怪。而且我想說,除非可以使用坐在前面的系統並調試問題,否則很難說。此外,你在那裏的死代碼在我眼中有一種氣味,你自己是問題的一部分,而不是解決方案。 – hakre 2012-08-12 13:01:42

+0

有圖像。而且,死碼不應該在那裏。無論如何,問題依然存在。 – 2012-08-12 13:04:34

回答

0

解決的問題:

字體helonia.ttf有一些奇怪。 Idk什麼,但它做到了。

我試過arial.ttd,問題解決了!

感謝所有幫助!