note 38314 rejected from function.imagettftext by nlopess

From: Date: Tue, 16 Dec 2003 16:35:15 +0000
Subject: note 38314 rejected from function.imagettftext by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62074@lists.php.net to get a copy of this message
Note Submitter: jimmy@producks.net ---- If you get the problem described below with squares in place of characters with the high bit set despite a correct font, a workaround seems to be using the unicode-encoding mentioned in the Description. You could for example use "T&#228;star" instead of "Tästar". One solution would also be to use the following function for doing this conversion automatically: function ttfStringEncode ($str) { $ret = ""; for ($idx = 0; $idx < strlen($str); $idx++) { if (ord($str{$idx}) > 127) { $ret .= "&#" . ord($str{$idx}) . ";"; } else { $ret .= $str{$idx}; } } return $ret; } If anyone have any suggestions for a more transparent workaround or a suggestion for where the bug is, I would be very thankful if you sent me an email about this. The bug appears to be either in the function or in the version of freetype used (I've tested freetype2-2.1.5), since using ImageString works flawlessly and the font obviously is OK (otherwise using the function above wouldn't work, and it does).

« previous php.notes (#62074) next »