Manual - Font Php
Introduction
This class allows you to draw text with the built-in fonts from PHP.
Methods
BCGFontPhp's Methods
-
__constructor__(
$font ) — Creates the font based on PHP fonts - getText() — Gets the text associated with the label
-
setText(
$text ) — Sets the text associated with the label - getRotationAngle() — Gets the rotation angle in degree
-
setRotationAngle(
$rotationAngle ) — Sets the rotation angle in degree - getBackgroundColor() — Gets the color behind the text
-
setBackgroundColor(
$backgroundColor ) — Sets the color behind the text - getForegroundColor() — Gets the color of the text
-
setForegroundColor(
$foregroundColor ) — Sets the color of the text - getDimension() — Gets the dimension of the text
-
draw(
$im ,$x ,$y ) — Draws the text on the image
Code Example
// To get an example on how to use this class, check barcode classes.
Method explanations
-
__constructor__(
$font ) — Creates the font based on PHP fontsDescriptionCreates the class. The argument must be an integer between 1 and 5. You can load your own fonts by using a higher number than 5. See imageloadfont() from PHP.net for more information. -
getText()
—
Gets the text associated with the label
DescriptionGets the text associated with the label.Returns
string -
setText(
$text ) — Sets the text associated with the labelDescriptionSets the text associated with the label. -
getRotationAngle()
—
Gets the rotation angle in degree
DescriptionGets the rotation angle for the image in degrees. (clockwise)Returns
int - value between 0 and 360 -
setRotationAngle(
$rotationAngle ) — Sets the rotation angle in degreeDescriptionSets the rotation angle for the image in degrees. (clockwise)
Note that your server may not support the imagerotate() function. -
getBackgroundColor()
—
Gets the color behind the text
Returns
-
setBackgroundColor(
$backgroundColor ) — Sets the color behind the textDescriptionSets the color behind the text. -
getForegroundColor()
—
Gets the color of the text
DescriptionGets the color of the text.Returns
-
setForegroundColor(
$foregroundColor ) — Sets the color of the text -
getDimension()
—
Gets the dimension of the text
DescriptionGets the width and height in pixel depending on the font and the entered text.Returns[0] is the width, [1] is the height
-
draw(
$im ,$x ,$y ) — Draws the text on the imageDescription$image is an image resource.
Draws the text with at the position$x , and$y .