Skip to content

Commit ea1e6d4

Browse files
committed
Add exception when imageftbox() fails
1 parent 76e96d3 commit ea1e6d4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Drivers/Gd/FontProcessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public function boxSize(string $text, FontInterface $font): SizeInterface
5353
string: $text,
5454
);
5555

56+
if ($box === false) {
57+
throw new FontException('Unable to calculate box size of font ' . $font->filename() . '.');
58+
}
59+
5660
// build size from points
5761
return new Rectangle(
5862
width: intval(abs($box[6] - $box[4])), // difference of upper-left-x and upper-right-x

0 commit comments

Comments
 (0)