downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

imagepsslantfont> <imagepsfreefont
[edit] Last updated: Fri, 25 May 2012

view this page in

imagepsloadfont

(PHP 4, PHP 5)

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

说明

resource imagepsloadfont ( string $filename )

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

Example #1 imagepsloadfont() 例子

<?php
header
("Content-type: image/png");
$im imagecreatetruecolor(35045);
$black imagecolorallocate($im000);
$white imagecolorallocate($im255255255);
imagefilledrectangle($im0034944$white);
$font imagepsloadfont("bchbi.pfb"); // or locate your .pfb files on your machine
imagepstext($im"Testing... It worked!"$font32$white$black3232);
imagepsfreefont($font);
imagepng($im);
imagedestroy($im);
?>

Note: 此函数仅在 PHP 编译时指定了 --with-t1lib[=DIR] 时可用。

参见 imagepsfreefont()

参数

filename

Path to the Postscript font file.

返回值

In the case everything went right, a valid font index will be returned and can be used for further purposes. Otherwise the function returns FALSE.

范例

Example #2 imagepsloadfont() example

<?php
// Create a new image instance
$im imagecreatetruecolor(35045);

// Allocate colors and fill the background
$black imagecolorallocate($im000);
$white imagecolorallocate($im255255255);
imagefilledrectangle($im0034944$white);

// Load a font, write to the image and free the font from memory
$font imagepsloadfont("bchbi.pfb");
imagepstext($im"Testing... It worked!"$font32$white$black3232);
imagepsfreefont($font);

// Output the image
header('Content-type: image/png');

imagepng($im);
imagedestroy($im);
?>

注释

Note: 此函数仅在 PHP 编译时指定了 --with-t1lib[=DIR] 时可用。

参见



add a note add a note User Contributed Notes imagepsloadfont
seymour at itsyourdomain dot com 11-Feb-2004 05:45
I had to use a full path to the font file or else I received errors from t1lib. Using just a filename, I received error 14. Using ./filename I received error 2.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites