Skip to main content
gamedev.net
🔒 Locked

Linux GDfontpath

Started by Cygnus_X Jun 9, 2004 at 4:24 PM 2 replies 6.3k views
Original Post
Cygnus_X
Cygnus_X
Does anyone know the GDfontpath for a linux server? I''m trying to generate a web poll, and the code requires me to know where the font .ttf (i think its .ttf.. maybe .tff?) files are located.... in particularly, new times roman.... and since I''m not familiar with linux, I have no clue where that would be. Any help would be much appreciated. And, if you want to see the problem in action... my web page is cygnux.ineedhosting.net but, you''ll have to register and then try to ''vote'' to see where the error comes in. I can also provide the code if it would be helpful.
Null and Void
Null and Void
It depends. The correct system-wide location for font files is "/usr/share/fonts". Font files can also be in one of many X-specific directories (if X is even installed on the server), a common one being "/usr/lib/X11/fonts" (often with a "TrueType" directory inside of it). Times New Roman is a font family owned by Microsoft, don''t expect it to exist on most *nix machines. See this for installation information for various distributions. Look around in those directories for something suitable if you need to pick one exact file, as you say.

Cygnus_X
Cygnus_X
Thanks... but I still can''t seem to resolve the problem.... let me elaborate what all I''m doing.

For starters, when I ran all my code for generating a poll on my windows platform, it worked fine. But now, I''m getting an error message saying "cannot find/open font in /home/cygnuxi/public_html/functions_poll.php"

Ok, great... so what is causing that message to be generated...? Well, first, I used the following command (which has been modified from the origional windows version). The code looks as follows:

putenv(''GDFONTPATH=/usr/share/fonts/'');

I also tried useing:

putenv(''GDFONTPATH=/usr/share/fonts/truetype/'');

Then, I set my font variable to ''arial'' (I also tried ''arial.ttf'') which is required by other PHP functions such as ImageTTFText(). For one reason or another, the error message I''m getting seems to indicate that PHP can''t find font.ttf file in order to use it. At the moment, I''d take any text style as long as I can get it to work.

Now, even after these modifications, I still have the error. I don''t physically own the server, so I can''t exactally boot up linux and look at all the settings/files/folders. But, I do have access to CPanel... not that I really know how to use it.

Hopefully this explains everything. If you have any questions, let me know.... and Thanks again : )

Cygnus_X
Cygnus_X
Ok... I solved my own problem.... go me. But I figured I''d post it just in case someone later down the road found this forum and had the same problem I did.

Pretty much, I uploaded the font.ttf file with a binary setting in FTP.... "didn''t" set the envioronment variable (ie, no putenv or gdfontpath), then used the following:

$font = realpath("arial.ttf");

Worked like a charm... now all I have to do is figure out how to set permissions such that PHP can generate an image, and then save it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.