php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45176 Create image from ttf file failed
Submitted: 2008-06-04 14:24 UTC Modified: 2009-03-10 01:00 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: heyond at yahoo dot com dot cn Assigned: pajoye (profile)
Status: No Feedback Package: GD related
PHP Version: 5.2.6 OS: windows 2003
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: heyond at yahoo dot com dot cn
New email:
PHP Version: OS:

 

 [2008-06-04 14:24 UTC] heyond at yahoo dot com dot cn
Description:
------------
I try to create a font image from ttf file, but I encounted a error :

Warning: imagettftext() [function.imagettftext]: Unable to find a CharMap that I can handle in D:\www\mvc\ttf2.php on line 49

only few ttf file like this, I guess the freetypes version too lower.

Reproduce code:
---------------
imagettftext($im, $fontsize, 0, $x, $y, $fgcolor, $fontfile, 'abc');

Expected result:
----------------
a binary image.

Actual result:
--------------
Warning: imagettftext() [function.imagettftext]: Unable to find a CharMap that I can handle in D:\www\guomo.com\ttf.php on line 33
??JFIF?>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ?C    $.' ",#(7),01444'9=82<.342?C  2!!22222222222222222222222222222222222222222222222222?(J"? ??}!1AQa"q2???#B??R??$3br? %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz????????????????????????????????????????????????????????????????????????? ??w!1AQaq"2?B???? #3R?br?$4??&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz????????????????????????????????????????????????????????????????????????? ??J(??͂?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-04 16:23 UTC] pajoye@php.net
"Warning: imagettftext() [function.imagettftext]: Unable to find a
CharMap that I can handle in D:\www\guomo.com\ttf.php on line 33"

Is a pretty clear error message.

Please provide a link to the font you are using a complete script to reproduce your problem.


 [2008-06-05 06:38 UTC] heyond at yahoo dot com dot cn
http://www.guomo.com/data/fonts/174.ttf
 [2008-06-05 06:45 UTC] heyond at yahoo dot com dot cn
The completed script is:
<?php

define('BG1',  'DDD4BB');

header("Content-type: image/jpeg");

$word = 'abc';//$word = '????'
$wordnum = 6;

$word = iconv('GBK', 'UTF-8', $word);

//$fontfile = './data/fonts/1.ttf';//http://www.guomo.com/data/fonts/1.ttf This file '1.ttf' is normal
$fontfile = './data/fonts/174.ttf';//http://www.guomo.com/data/fonts/174.ttf This file '174.ttf' is abnormal

$width = 30
$height = 40;

$fontsize = 20;
$x = 0;
$y = $fontsize + 10;

$im = imagecreate($wordnum * $width, $height);
$bgcolor = imagecolorallocate($im, hexdec(substr(BG1, 0, 2)), hexdec(substr(BG1, 2, 2)), hexdec(substr(BG1, 4, 2)));
$fgcolor = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 0, 0, $bgcolor);

imagettftext($im, $fontsize, 0, $x, $y, $fgcolor, $fontfile, $word);
imagejpeg($im);
imagedestroy($im);
exit;

?>
 [2008-12-16 10:08 UTC] patrick dot landolt at artack dot ch
I also have the same problem with GD on PHP V5.2.6 installed. My font is a chinese one.
 [2009-03-02 15:49 UTC] pajoye@php.net
I need:
- a small script to reproduce what you are doing
- All fonts files you use with the script

Without that, I can't help you to solve this problem, if there is any.
 [2009-03-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-13 13:49 UTC] sridevigara at gmail dot com
Hi 
i am trying to create a image using hindi mangal (unicode) font text but i am facing a problem that matras are coming properly .Can anyone help me
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 21:01:28 2024 UTC