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 public static function resolveFont(string $font = 'Arial'): array
{ {
$fonts = [ return $font
'Arial' => '', ? ['name' => $font, 'url' => sprintf('https://fonts.googleapis.com/css2?family=%s&display=swap', $font)]
'Inter' => 'https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap', : ['name' => 'Arial', 'url' => ''];
'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']];
} }
} }