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 — Extender o condensar una fuente
Descripción
bool imagepsextendfont
( resource
$font_index
, float $extend
)
Extiende o condensa una fuente (font_index), si
el valor del parámetro extend es menor
que 1 se condensará la fuente.
Parámetros
-
font_index -
Un recurso de fuente, devuelto por imagepsloadfont().
-
extend -
Valor de extensión, debe ser mayor que 0.
Valores devueltos
Devuelve TRUE en caso de éxito o FALSE en caso de error.
Ejemplos
Ejemplo #1 Ejemplo de imagepsextendfont()
<?php
// Cargar un archivo de fuente .pfb
$fuente = imagepsloadfont('./px3l.pfb');
// Extender la fuente por 2.5
imagepsextendfont($fuente, 2.5);
// Hacer cualesquiera operaciones con la fuente aquÃ
// Liberar la fuente de la memoria
imagepsfreefont($fuente);
?>
Notas
Nota: Esta función sólo está disponible si PHP fue compilado usando --with-t1lib[=DIR] .
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);
