导航首页 » 技术教程 » PHP:imagepsloadfont()的用法_GD库图像处理函数
PHP:imagepsloadfont()的用法_GD库图像处理函数 157 2023-12-15   

imagepsloadfont

(PHP 4, PHP 5)

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

说明

resource imagepsloadfont ( string $filename )

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

参数

filename

Postscript 字体文件的路径。

返回值

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

范例

Example #1 imagepsloadfont() 例子

<?php
// Create a new image instance
$im = imagecreatetruecolor(350, 45);

// Allocate colors and fill the background
$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 349, 44, $white);

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

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

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

注释

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

参见

imagepsfreefont() - 释放一个 PostScript Type 1 字体所占用的内存


!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103