note 38314 added to function.imagettftext
| From: | jimmy at producks dot net | Date: | Tue, 16 Dec 2003 16:32:31 +0000 |
| Subject: | note 38314 added to function.imagettftext | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62073@lists.php.net to get a copy of this message | ||
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ä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).
----
Manual Page -- http://www.php.net/manual/en/function.imagettftext.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38314
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38314&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38314&report=yes
Search -- http://master.php.net/manage/user-notes.php