php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34268 imagettftext broken with Umlauts
Submitted: 2005-08-26 15:22 UTC Modified: 2005-08-26 16:34 UTC
From: mb at imp dot ch Assigned: pajoye (profile)
Status: Not a bug Package: GD related
PHP Version: 4.4.0 OS: FreeBSD 4.11
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mb at imp dot ch
New email:
PHP Version: OS:

 

 [2005-08-26 15:22 UTC] mb at imp dot ch
Description:
------------
After Upgrading PHP from 4.3.3 to 4.4.0, rendered text   
with imagettftext() doesn't show Umlauts in some cases.  
It doesn't matter if the string is utf8 encoded or not,  
the result is the same.  
 
If an Umlaut is followed by a space, it is correctly 
printed:  
 
// Works 
 
$text = 'Testing\xe4 ...'; 
 
But if it is followed by some other Umlaut or 
a different char, it doesn't work at all. 
 
 // Doesn't work 
$text = 'Testing\xe4a ...'; 
 
Any ideas ? 
 
Installed packages are: 
 
gd-2.0.33_1,1 
freetype2-2.1.4_1 

Reproduce code:
---------------
<?php

 // Set the content-type
 header("Content-type: image/png");

 // Create the image
 $im = imagecreatetruecolor(400, 30);

 // Create some colors
 $white = imagecolorallocate($im, 255, 255, 255);
 $grey = imagecolorallocate($im, 128, 128, 128);
 $black = imagecolorallocate($im, 128, 128, 0);

 // Doesn't work
 $text = ' 5 Testing\xe4a ...';

 // Works
 $text = ' 5 Testing\xe4 ...';

 // Replace path by your own font path
 $font = arialn.ttf';

 // Add some shadow to the text
 imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

 // Add the text
 imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

 // Using imagepng() results in clearer text compared with imagejpeg()
 imagepng($im);
 imagedestroy($im);
 ?>

Expected result:
----------------
 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-26 15:26 UTC] pajoye@php.net
Please try using this CVS snapshot:

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

Use the bundled GD ("configure --with-gd", be sure that no gd developement files are in the std path).

If the problem persists, please provide the fonts and small script to reproduce the problem.
 [2005-08-26 16:28 UTC] mb at imp dot ch
It is no option to use php5. This is a production system
on ISP side.

The problem seems to be the FreeBSD port. In some versions
it had this option definded:

--enable-gd-jis-conv

I've removed it and now it works.

Martin
 [2005-08-26 16:34 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 10:01:30 2025 UTC