问题
I am using 000webhost.com and trying to draw a graph, but I get this error, JpGraph Error: 25049 Font file "../src/font/verdanab.ttf" is not readable or does not exist. I downloaded all the fonts and uploaded on my host, but I still get this error, probably my root is wrong. I really need help.
回答1:
In case you still need help or someone else finds this useful...
Your host probably has some ttf fonts already, so you should start by finding their path. In my case it was something like /usr/share/fonts/dejavu. Look around, it should be easy to find the one you're looking for. If you can't find or don't want to use your host fonts, you can install new ones. Jpgraph has constants for the most popular packages.
Once you identify the right path, go to file jpg-config.inc.php in your source directory and change the line that defines the ttf dir to the path you found in step 1:
define('TTF_DIR','/usr/share/fonts/dejavu/');
Note the last '/', make sure you don't forget that.
- Now you have to know how to refer to your fonts in the code, e.g. FF_DV_SERIF for the deja vu serif font. Go to file jpgraph_ttf.inc.php. There you'll find the constants for each package. The code is well documented so you should have no problem.
Cheers.
Edit: For MacOS10 (with e.g. MAMP) it might be something like:
define('TTF_DIR','/Library/Fonts/');
define('MBTTF_DIR','/Library/Fonts/');
来源:https://stackoverflow.com/questions/11107113/jpgraph-font-error