| LAST | Fonts: PostScript | NEXT |
| PostScript |
| The PostScript font functions made available by the T1Lib library provide a much higher degree of control than the TrueType functions. Note the ability to control inter-character spacing (tightness), multiple levels of antialiasing, as well as slant (italicize) and extend (embold) fonts. Note also that, like imageDestroy(), you have to clean up after yourself with imagePSFreeFont(). |
| int imagePSLoadFont ( string filename ) If everything went right, a valid font index will be returned and can be used for further purposes. Otherwise, the function returns FALSE and prints a message describing what went wrong. |
| array imagePSText ( resource image, string text, int font, int size, int foreground, int background, int x, int y [, int space [, int tightness [, float angle [, int antialias_steps]]]]) foreground is the color in which the text will be painted. background is the color to which the text will try to fade in with antialiasing. No pixels with the color background are actually painted, so the background image does not need to be of solid color. The coordinates given by x, y will define the origin (or reference point) of the first character (roughly the lower-left corner of the character). This is different from the imageString(), where x, y define the upper-right corner of the first character. space allows you to change the default value of a space in a font. This amount is added to the normal value and can also be negative. tightness allows you to control the amount of white space between characters. This amount is added to the normal character width and can also be negative. angle is in degrees. size is expressed in pixels. antialias_steps allows you to control the number of colours used for antialiasing text. Allowed values are 4 and 16. The higher value is recommended for text sizes lower than 20, where the effect in text quality is quite visible. With bigger sizes, use 4 as it's less computationally intensive. Parameters space and tightness are expressed in character space units, where 1 unit is 1/1000th of an em-square. This function returns an array containing the following elements: (0 => lower left x-coordinate, 1 => lower left y-coordinate, 2 => upper right x-coordinate, 3 => upper right y-coordinate ). array imagePSBBox ( string text, int Font, int size [, int space [, int tightness [, float angle]]]) |
|
TIP: The paramter text must be a string. In the example below, PHP will quit with an error if $text is undefined:
To easily avoid this situation, simply enclose the $text variable in quotes:
|
| void imagePSFreeFont ( int fontindex ) Frees memory used by a PostScript Type 1 font. |
| bool imagePSExtendFont ( int font_index, float extend) Extend or condense a font (font_index), if the value of the extend parameter is less than one you will be condensing the font. bool imagePSSlantFont ( int font_index, float slant ) |
| int imagePSEncodeFont ( int font_index, string encodingfile ) Loads a character encoding vector from from a file (*.enc) and changes the fonts encoding vector to it. As a PostScript fonts default vector lacks most of the character positions above 127, you'll definitely want to change this if you use an other language than english. |
| int imagePSCopyFont ( int fontindex ) Use this function if you need make further modifications to the font, for example extending/condensing, slanting it or changing it's character encoding vector, but need to keep the original as well. Note that the font you want to copy must be one obtained using imagePSLoadFont(), not a font that is itself a copied one. You can make modifications to it before copying. If you use this function, you must free the fonts obtained this way yourself and in reverse order. Otherwise your script will hang. If everything went right, a valid font index will be returned and can be used for further purposes. Otherwise the function returns FALSE and prints a message describing what went wrong. |
| LAST | Table of Contents | Function Index | NEXT |