| Summary: | lang/php4 with builtin gd does not render characters above 0x7f | ||
|---|---|---|---|
| Product: | Ports & Packages | Reporter: | wolfgang |
| Component: | Individual Port(s) | Assignee: | Alex Dupre <ale> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | CC: | wolfgang |
| Priority: | Normal | ||
| Version: | Latest | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: freebsd-ports-bugs->ale Over to the maintainer. State Changed From-To: open->closed Fixed in 4.3.7 release. |
When you try to render text containing characters above 0x7f, e.g. a german "umlaut", into a graphic, all characters > 0x7f are rendered as an empty block. I haven't tried this on non-FreeBSD systems yet, but there is some evidence this is a FreeBSD- and not a PHP problem: This bug creates a problem for users of the typo3 CMS system in creating graphical menues. All users reporting this problem on the typo3 mailing lists where using FreeBSD, while most(?) of the typo3 users apparently use Linux. Fix: You can work around the problem by compiling lang/php4 in a way that it uses graphics/gd instead of the builtin gd bundled with php4. To do this change the Line in lang/php4/Makefile saying CONFIGURE_ARGS+=--with-gd \ into CONFIGURE_ARGS+=--with-gd=${LOCALBASE} \ and build lang/php4 after installing graphics/gd first. Be aware that this minimal Makefile patch doesn't register the dependency from ang/php4 to graphics/gd, to do this you would probably have to add a LIB_DEPENDS line as well. How-To-Repeat: The php-script imgtest.php below here demonstrates the problem. It should generate a jpg containing the text "Bäh!" (note the second letter is a german a-umlaut). The second character is displayed as an empty white block with black borders instead. I used an arial-font from the x11-fonts/webfonts port, but any other ttf-font containing that character should do. Just change /usr/X11R6/lib/X11/fonts/webfonts/arial.ttf to the font you want to use. --- imgtest.php begins here --- <?php header("Content-type: image/jpeg"); $im = imagecreate(400, 30); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); imagettftext($im, 20, 0, 10, 20, $black, // Replace path with your own font path: "/usr/X11R6/lib/X11/fonts/webfonts/arial.ttf", utf8_encode("Bäh!")); imagejpeg($im); imagedestroy($im); ?> --- imgtest.php ends here ---