Manual - BCGFontPhp

Introduction

This class allows you to draw text with the built-in fonts from PHP.

Methods

BCGFontPhp's Methods

Code Example


// To get an example on how to use this class, check barcode classes.

Method explanations

  • __construct($font) — Creates the font based on PHP fonts
    Description
    Creates 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
    Description
    Gets the text associated with the label.
    Returns
    string
  • setText($text) — Sets the text associated with the label
    Description
    Sets the text associated with the label.
  • getRotationAngle() — Gets the rotation angle in degree
    Description
    Gets the rotation angle for the image in degrees. (clockwise)
    Returns
    int - value between 0 and 360
  • setRotationAngle($rotationAngle) — Sets the rotation angle in degree
    Description
    Sets 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 text
    Description
    Sets the color behind the text.
  • getForegroundColor() — Gets the color of the text
    Description
    Gets the color of the text.
    Returns
  • setForegroundColor($foregroundColor) — Sets the color of the text
  • getDimension() — Gets the dimension of the text
    Description
    Gets 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 image
    Description
    $im is an image resource.
    Draws the text with at the position $x, and $y.