1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Update automatic font resolving

This commit is contained in:
Benjamin Beganović 2021-10-27 15:03:51 +02:00
parent ab8b7c4427
commit f4979fb0a4

View File

@ -273,20 +273,8 @@ class Helpers
*/
public static function resolveFont(string $font = 'Arial'): array
{
$fonts = [
'Arial' => '',
'Inter' => 'https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap',
'Roboto' => 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap',
'Irish Grover' => 'https://fonts.googleapis.com/css2?family=Irish+Grover&display=swap',
];
if (array_key_exists($font, $fonts)) {
return [
'name' => $font,
'url' => $fonts[$font],
];
}
return ['name' => 'Arial', 'url' => $fonts['Arial']];
return $font
? ['name' => $font, 'url' => sprintf('https://fonts.googleapis.com/css2?family=%s&display=swap', $font)]
: ['name' => 'Arial', 'url' => ''];
}
}