Manual - BCGFontPhp

Introduction

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

BCGFontPhp's Methods

Code Example

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

Methods Explanation

  • __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.
  • getDimension() — Gets the dimension of the text
    Description
    Gets the width and height in pixels depending on the font and the entered text.
    Returns
    array(int, int) - [0] is the width, [1] is the height
  • draw($im, $color, $x, $y) — Draws the text on the image
    Description
    $im is a GD2 image resource.
    Draws the text with the color $color at the position $x, $y. $color must be a color already associated with the GD2 image. If you used a BCGColor color, you will have to use the allocate() method first.