zhuanzhou
zhuanzhou

Reputation: 2443

using GD library drawing in php?

the system is window xp.now, i using GD library to draw a chart set the font path as this:

    putenv('GDFONTPATH=c:\windows\Fonts');
    $fontname='arial';
   $bbox=imagettfbbox($font_size,0,$fontname,$button_text);

the programme gave me a tip: can't find the font? but in my window xp system, there is a font named arial in the Fonts file. why ?

test code:

 putenv('GDFONTPATH=C:\\WINDOWS\\Fonts');
 $fontname='arial';
$char="test";
$size=20;
$bbox=imagettfbbox($size,0,$fontname,$char);

it show invalidate font filename,

Upvotes: 1

Views: 372

Answers (2)

zhuanzhou
zhuanzhou

Reputation: 2443

GDFONTPATH can't use under window. you should use absolute path directly.

Upvotes: 0

Devator
Devator

Reputation: 3904

On Windows you have to use double backslashes, like so: putenv('GDFONTPATH=c:\\windows\\Fonts');

Upvotes: 1

Related Questions