PHP Classes

can't find fonts?

Recommend this page to a friend!

      ATextImage  >  All threads  >  can't find fonts?  >  (Un) Subscribe thread alerts  
Subject:can't find fonts?
Summary:Could not find/open font in /var/www/textImage/class.atextimage
Author:Vampyre Bytes
Date:2006-10-28 09:49:00
Update:2006-10-29 01:23:09

  1. can't find fonts?   Reply   Report abuse  
Vampyre Bytes - 2006-10-28 09:49:00
I've tried it with various fonts in the same directory as the class file and the demo files. The form lists the fonts in the directory just fine, but no matter which ttf I use, I get "Could not find/open font in /var/www/textImage/class.atextimage.php on line XXX"

I've adjusted permissions to 775 and made sure that the files belonged to teh PHP/Apache "user".

I know this isn't a problem specific to your class, since I tried a similar class to similar results, though in that other class, I was able to use "arial.ttf" and a special font "ASANEW.TTF".

Any advice? (PHP 5.12/Apache 2.0.55 on a Ubuntu (6.06LTS) Linux system (Debian based, with the 2.6.15-27 kernel) GD installed and enabled.)
phpinfo() output about GD:
GD Support enabled
GD Version 2.0 or higher
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.10
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled

  2. Re: can't find fonts?   Reply   Report abuse  
Vampyre Bytes - 2006-10-28 10:27:35 - In reply to message 1 from Vampyre Bytes
I managed to get it working by doing the following:

$fontpath = realpath('./fonts/');

to each file where calling the class.

Then naming the font without the .tff

I also changed the demoform.php font selection to be
$fonts = glob("./fonts/{*.ttf,*.TTF}", GLOB_BRACE);

print "<select name='fnt'>";

foreach($fonts as $font){

$sel=($fnt==$font)?' selected':'';

print "<option value='$font'$sel>$font</option>\n";


print "</select><br>\n";

This seems to work for most of my fonts. (there are still a couple of symbol fonts that give me a diffwerent error about not drawing the glyph...)

  3. Re: can't find fonts?   Reply   Report abuse  
George Clarke - 2006-10-29 01:23:09 - In reply to message 2 from Vampyre Bytes
Thank you for using my ATextImage class. I am sorry for the problems you have had with it but am glad you were able to work them out ok.