imagestring() with .gdf file on Solaris 10
[email protected] (Leif Neve) Fri, 16 Jan 2009 16:22:22 -0500 (EST)
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <[email protected]> |
We can't get the imagestring() function to work with non-built-in
fonts. It works fine with built-in fonts (1-5). We have tried a
number of .gdf files unsuccessfully. We know the .gdf files are
loading successfully because we can use GD functions to report their width
and height correctly.
We are running fully patched Solaris 10 and PHP-5.2.6. We have run tests
both against PHP using the bundled GD library and also against PHP linked
against a separately built GD 2.0.35 library.
The following script fails:
$font = imageloadfont('anonymous.gdf');
$fontWidth = imagefontwidth($font);
$fontHeight = imagefontheight($font);
$text = 'Hello World';
$im = imagecreate(strlen($text) * $fontWidth, $fontHeight);
$bgColor = imagecolorallocate($im, 255, 255, 255);
$fgColor = imagecolorallocate($im, 0, 0, 255);
imagestring($im, $font, 0, 0, $text, $fgColor);
header('Content-Type: image/png');
imagepng($im);
The above script works if you change the first line to:
$font = 5;
-Leif