From 55fff62fb454412ba90c72ccea3598ef02c4b58e Mon Sep 17 00:00:00 2001 From: Jonathan Harker Date: Wed, 22 Sep 2021 20:44:13 +1200 Subject: [PATCH] MDL-72646 theme: update font download MIME types, RFC-8081 --- theme/font.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/theme/font.php b/theme/font.php index 18d0f3198b0..7a8f43a4000 100644 --- a/theme/font.php +++ b/theme/font.php @@ -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!!!