Manual - Font File

Introduction

This class allows you to draw text with a desired font.

Methods

BCGFontFile's Methods

Code Example


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

Method explanations

  • __construct() — Creates the font with the size
    Description
    Creates the class. The first argument is the path of the .ttf file you want to use. The second argument is the size in point (pt) of the font you want to use.
  • 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
    $image is an image resource.
    Draws the text at the position $x, $y.