MDL-72646 theme: update font download MIME types, RFC-8081

This commit is contained in:
Jonathan Harker 2021-09-22 20:44:13 +12:00
parent d24a4ab56f
commit 55fff62fb4

View file

@ -17,7 +17,7 @@
/**
* This file is responsible for serving the fonts used in CSS.
*
* Note: it is recommended to use only WOFF (Web Open Font Format) fonts.
* Note: it is recommended to use only WOFF2 (Web Open Font Format v2) fonts.
*
* @package core
* @copyright 2013 Petr Skoda (skodak) {@link http://skodak.org}
@ -63,20 +63,20 @@ if (empty($component) or $component === 'moodle' or $component === 'core') {
if (preg_match('/^[a-z0-9_-]+\.woff2$/i', $font, $matches)) {
$font = $matches[0];
$mimetype = 'application/font-woff2';
$mimetype = 'font/woff2';
} else if (preg_match('/^[a-z0-9_-]+\.woff$/i', $font, $matches)) {
// This is the real standard!
$font = $matches[0];
$mimetype = 'application/font-woff';
$mimetype = 'font/woff';
} else if (preg_match('/^[a-z0-9_-]+\.ttf$/i', $font, $matches)) {
$font = $matches[0];
$mimetype = 'application/x-font-ttf';
$mimetype = 'font/ttf';
} else if (preg_match('/^[a-z0-9_-]+\.otf$/i', $font, $matches)) {
$font = $matches[0];
$mimetype = 'application/x-font-opentype';
$mimetype = 'font/otf';
} else if (preg_match('/^[a-z0-9_-]+\.eot$/i', $font, $matches)) {
// IE8 must die!!!