pchart错误:消息:imageftbbox()[function.imageftbbox]:无效的字体文件名

时间:2011-08-31 15:36:51

标签: php fonts xampp gdlib pchart

我尝试了很多不同的方法,现在我尽可能明确。我在Windows 7上使用xampp和PHP / pChart。在我的代码中,我有:

<?php
    include('pChart/pData.class');     
    include('pChart/pChart.class');  
    putenv('GDFONTPATH=' . 'C:\Windows');

        ...
    $Test->setFontProperties("/Fonts/tahoma.ttf",8);  
        ...
?>

我确实在字体前添加了'/',以便库不会意外地附加.ttf,在某些情况下我会读到.ttf。

非常感谢任何有关此事的协助。

1 个答案:

答案 0 :(得分:0)

我几天前使用pChart并在从pChart文档中复制粘贴示例代码时遇到同样的错误。只需尝试通过添加完整的绝对路径来添加字体位置:

$font_folder = $_SERVER['DOCUMENT_ROOT']."/libs/pChart/fonts/";
$Test->setFontProperties($font_folder."/Fonts/tahoma.ttf",8); 

我将pChart库存储在[root]/libs/pChart/中。当然你必须确保你有一个“fonts”文件夹。我的代码可以正常使用它。所以我猜你的错误在于尝试分配系统字体而不是本地包含。