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)
imagepsextendfont
(PHP 4, PHP 5)
imagepsextendfont — フォントを展開または圧縮する
説明
bool imagepsextendfont
( resource
$font_index
, float $extend
)
フォント(font_index)を展開または圧縮します。
パラメータextendの値が1より小さい場合、
フォントの圧縮が行われます。
返り値
成功した場合に TRUE を、失敗した場合に FALSE を返します。
例
例1 imagepsextendfont() の例
<?php
// .pfb フォントファイルを読み込みます
$font = imagepsloadfont('./px3l.pfb');
// フォントを展開します
imagepsextendfont($font, 2.5);
// ここでフォントに対して何らかの操作をします
// フォントをメモリから開放します
imagepsfreefont($font);
?>
注意
注意: この関数は、PHP が --with-t1lib を指定してコンパイルされている場合のみ使用可能です。
admin at studio-gepard dot pl
03-Dec-2009 02:17
Pascal@TeamX
21-May-2003 03:28
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);
