imagepsloadfont

(PHP 3 >= 3.0.9, PHP 4, PHP 5)

imagepsloadfont -- 从文件中加载一个 PostScript Type 1 字体

说明

int imagepsloadfont ( string filename )

如果一切正常,将返回一个合法的字体索引以备使用。否则返回 FALSE 并显示一条信息说明哪里错了,而你无法直接读取此信息,因为当前是以图像格式在输出。

<?php
header
("Content-type: image/jpeg");
$im = imagecreate (350, 45);
$black = imagecolorallocate ($im, 0, 0, 0);
$white = imagecolorallocate ($im, 255, 255, 255);
$font = imagepsloadfont ("bchbi.pfb"); // or locate your .pfb files on your machine
imagepstext ($im, "Testing... It worked!", $font, 32, $white, $black, 32, 32);
imagepsfreefont ($font);
imagejpeg ($im, "", 100); //for best quality...your mileage may vary
imagedestroy ($im);
?>

参见 imagepsfreefont()