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 — Bir PS yazı tipini geniÅŸletir veya daraltır
Açıklama
bool imagepsextendfont
( resource
$yazıtipi
, float $katsayı
)
yazıtipi tanıtıcısı ile belirtilen PS yazı tipini
genişletir veya daraltır; katsayı birden büyükse
genişletir, küçükse daraltır.
DeÄŸiÅŸtirgeler
-
yazıtipi -
imagepsloadfont() tarafından döndürülen bir yazı tipi özkaynağı.
-
katsayı -
Yazı tipi genişlik çarpanı. Sıfırdan büyük olmalıdır.
Dönen Değerler
Başarı durumunda TRUE, başarısızlık durumunda FALSE döner.
Örnekler
Örnek 1 - imagepsextendfont() örneği
<?php
//Bir .pfb yazı tipi dosyası yükleyelim
$font = imagepsloadfont('./px3l.pfb');
// Yazı tipini 2.5 kere genişletiyoruz
imagepsextendfont($font, 2.5);
// Burada yazı tipini kullanıyoruz
// İşimiz bitince yazı tipine ayrılan belleği serbest bırakıyoruz
imagepsfreefont($font);
?>
Notlar
Bilginize: Bu işlev sadece, PHP, --with-t1lib[=DİZİN] seçeneği ile derlenmişse kullanılabilir.
admin at studio-gepard dot pl ¶
3 years ago
Pascal@TeamX ¶
10 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);
