Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Cygnus_X

Linux GDfontpath

This topic is 5180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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 : )

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!