<?php
declare(strict_types=1);

$fontBytes = base64_decode(file_get_contents("fixture-font.base64"), true);
file_put_contents("fixture.ttf", $fontBytes);
$font = __DIR__ . "/fixture.ttf";
$box = imageftbbox(18.0, 0.0, $font, "Чашка");
$xs = [$box[0], $box[2], $box[4], $box[6]];
$ys = [$box[1], $box[3], $box[5], $box[7]];
$width = max($xs) - min($xs) + 8;
$height = max($ys) - min($ys) + 8;
$x = 4 - min($xs);
$y = 4 - min($ys);
echo $width > 8 && $height > 8 && $y >= 4 ? "box with padding ready\n" : "invalid\n";
