#23527 [Opn->Fbk]: PostScript Type 1 font do not render properly

From: Date: Thu, 08 May 2003 01:31:17 +0000
Subject: #23527 [Opn->Fbk]: PostScript Type 1 font do not render properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39266@lists.php.net to get a copy of this message
 ID:               23527
 Updated by:       iliaa@php.net
 Reported By:      nid at home dot se
-Status:           Open
+Status:           Feedback
 Bug Type:         GD related
 Operating System: Linux Slackware 8
 PHP Version:      4.3.1
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Seems to work fine here, all letters are properly alligned.


Previous Comments:
------------------------------------------------------------------------

[2003-05-07 09:10:17] nid at home dot se

Adding some more information along with a code-snippet

t1lib version: 1.3.1
Apache version: 1.3.27

The font can be fetched from the location in the main-comment.

When running the code, notice that G and Q does render differently from
the rest of the characters.

----------[Code starts]-------------

$font_1 = imagepsloadfont('./AkzGBS20.pfb');

define('ANTIALIAS_MEDIUM',16);

$text = 'abcdefghijklmnopqrstuvxyz';

$x = 15;
$size = 12;
$y = 0;
$space = 0;
$tight = 0;
$angle = 0;
$antialias = ANTIALIAS_MEDIUM;

$text = strtoupper($text.'');

list($lx,$ly,$rx,$ry) =
imagepsbbox($text,$font_1,$size,$space,$tight,$angle);
$w = $rx + 30;
$h = 18;
$y = 12;

$img = imagecreate($w,$h);
$fg_color = imagecolorallocate($img,133,118,98);
$bg_color = imagecolorallocate($img,255,255,255);

imagefill($img,2,2,$bg_color);
imagepstext($img,$text,$font_1,$size,$fg_color,$bg_color,$x,$y,$space,$tight,$angle,$antialias);
imagepng('test.png');
imagedestroy($img);
echo '<img src=test.png><br>';

--------------[Code ends]------------

------------------------------------------------------------------------

[2003-05-07 08:52:57] nid at home dot se

When installing PHP 4.3.x GD/t1lib stops behave properly. When showing
a PS1-type font in an image, some characters get the wrong size.

When downgrading to PHP 4.2.3 the problem went away.

Using the bundled version of GD did not make any difference. Tried with
bundled (4.3.x) and GD 2.0.8 (both with 4.3.x and 4.2.x).

The steps I went through are:
1. loading the font with imagepsloadfont('AkzGBS20.pfb');
2. Encoding the font with imagepsencodefont('8859.enc'); (even tried
without this)
3. Executed this command:
imagepstext($img,$text,$font_1,$size,$fg_color,$bg_color,$x,$y,$space,$tight,$angle,$antialias);
4. Imagepng()

variables:
$size = 12, $space = 0, $angle = 0, $antialias = 16

The code was run with the same source on 4.2.3, 4.3.0 and 4.3.1, and
the problem started occuring on 4.3.0.

The font did have access to .afm-file, but it did not make any
difference.

The font-file can be located at:
http://www.delta-projects.com/AkzGBS20.pfb

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=23527&edit=1



Thread (14 messages)

« previous php.bugs (#39266) next »