The font_identifier is an integer returned by imagepsloadfont. The size argument
is in pixels. The spacing argument controls vertical spacing between lines of text. The
letting argument controls horizontal spacing between characters. Both are expressed in
units of 1/1000th of an em-square, and are added to the default spacing or leading for a
font. They may be positive or negative. The angle argument specifies a number of
degrees to rotate from normal left-to-right orientation.
See imagepstext, below, for an example.
integer imagepscopyfont(integer font_identifier)
The imagepscopyfont function copies a font loaded with imagepsloadfont into another
font identifier. This allows you to have an original version of the font in memory and
another copy you've stretched or slanted.
<?
/
Draw text using a Postscript font
Draw normal, stretched and slanted
/
//set parameters for text
$font_file = "ComputerModern-Roman";
$size = 20;
$angle = 0;
$text = "PHP";
$antialias_steps = 16;
$spacing = 0;
$letting = 0;
//create red square
$image = imagecreate(300, 300);
$colorRed = imagecolorallocate($image, 0xFF, 0x00, 0x00);
$colorBlack = imagecolorallocate($image, 0, 0, 0);
imagefill($image, 10, 10, $colorRed);
//Load font
if(!($myFont = imagepsloadfont($font_file)))
{
print("Unable to load font!");
exit();
}
//make extended font
$myFontExtended = imagepscopyfont($myFont);
imagepsextendfont($myFont, 1.5);
//make slanted font
$myFontSlanted = imagepscopyfont($myFont);
imagepsslantfont($myFont, 1.5);
//write normal text
imagepstext($image, $text, $myFont, $size,