PHP 5.4.31 Released

imagepsextendfont

(PHP 4, PHP 5)

imagepsextendfont扩充或精简字体

说明

bool imagepsextendfont ( resource $font_index , float $extend )

扩充或精简某字体(font_index)。如果 extend 参数的值小于一则是精简该字体。

参数

font_index

imagepsloadfont() 返回的字体资源。

extend

扩展的值,必须大于 0。

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

Example #1 imagepsextendfont() 例子

<?php
// Load a .pfb font file
$font imagepsloadfont('./px3l.pfb');

// Extend the font by 2.5
imagepsextendfont($font2.5);

// Do any operations with the font here

// Free the font from memory
imagepsfreefont($font);
?>

注释

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

add a note add a note

User Contributed Notes 2 notes

up
1
admin at studio-gepard dot pl
4 years ago
It is impossible to use this function with a TrueType (.ttf) fonts.You need to convert font to PostScript Type1 (.pfb) on your own (google - there are free converters too)
up
1
Pascal@TeamX
11 years ago
Just for the less experienced PHP-Hackers, like me ;-)

header("Content-type: image/png");
$text = "hello world";
$val = 1.2;
$font = imagepsloadfont(" path to font ");
$im = imagecreate(200, 200);
$color_bg = imagecolorallocate($im, 255, 255, 255);
$color_font = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 0, 0, $color_font);

imagepsextendfont($font, $val);

$bound = imagepstext($im, $text, $font, 25, $color_bg, $color_font, 10, 100, 0, 0, 0, 4);
imagepng($im);
imagedestroy($im);
To Top