TrueType Fonts


TrueType Fonts Interface

Describes TrueType interface.

ttfBox

Retrieve the bounding box of a text using TrueType fonts. Throw GdException if error. Throw ValidationException if invalid.

$ttf = [
    "size" => 10,
    "angle" => 45,
    "font" => "arial.ttf",
    "text" => "the quick brown fox jumps over the lazy dog",
    "option" => [
        "linespacing" => 2.5
    ]
];

$box = $gd->ttfBox($ttf);
boxDescription
x1lowest X position
y1lowest Y position
x2highest X position
y2highest Y position
widthwidth of the box
heightheight of the box
x-centercenter X position
y-centercenter Y position
x-bottom-leftlower left corner, X position
y-bottom-leftlower left corner, Y position
x-bottom-rightlower right corner, X position
y-bottom-rightlower right corner, Y position
x-top-rightupper right corner, X position
y-top-rightupper right corner, Y position
x-top-leftupper left corner, X position
y-top-leftupper left corner, Y position

ttfText

Return an instance with the provided TrueType fonts text. Throw GdException if error. Throw ValidationException if invalid.

$ttf = [
    "x" => 45,
    "y" => 60,
    "size" => 10,
    "angle" => 45,
    "font" => "arial.ttf",
    "text" => "the quick brown fox jumps over the lazy dog",
    "color" => 0x336699CC,
    "option" => [
        "linespacing" => 2.5
    ]
];

$gd = $gd->ttfText($ttf);