Skip to content

Commit 1b8cda0

Browse files
committed
refactor: invert font check logic
1 parent cef8caa commit 1b8cda0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Exporter.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ protected function setOptions(array $options)
6868
return;
6969
}
7070

71-
$font = $options['font'];
72-
if (!\is_file($font)) {
73-
$basename = \basename($font, '.ttf');
74-
$font = __DIR__ . "/../font/$basename.ttf";
71+
if (\is_file($options['font'])) {
72+
$this->font = $options['font'];
73+
74+
return;
7575
}
7676

77-
if (!\is_file($font)) {
77+
$base = \basename($options['font'], '.ttf');
78+
if (!\is_file($font = __DIR__ . "/../font/$base.ttf")) {
7879
throw new \InvalidArgumentException('The given font doesnot exist.');
7980
}
8081

0 commit comments

Comments
 (0)