From e26d641b85d27c6726efef0abd2998a12a70ad14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Mon, 20 Oct 2014 22:40:53 +0200 Subject: [PATCH] Make MathML mode work on mobile devices - load ext.math.css on mobile devices - move the @font-face rules for the Latin Modern WOFF fonts into a separate Desktop-only stylesheet. Change-Id: Ifca3679185a4675bc31dff99a086fef740b9dab5 --- Math.hooks.php | 1 + Math.php | 6 ++++++ modules/ext.math.css | 7 ------- modules/ext.math.desktop.css | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 modules/ext.math.desktop.css diff --git a/Math.hooks.php b/Math.hooks.php index 8fadacb..6749a79 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -135,6 +135,7 @@ class MathHooks { } $parser->getOutput()->addModuleStyles( array( 'ext.math.styles' ) ); if ( $mode == MW_MATH_MATHML ) { + $parser->getOutput()->addModuleStyles( array( 'ext.math.desktop.styles' ) ); $parser->getOutput()->addModules( array( 'ext.math.scripts' ) ); } // Writes cache if rendering was successful diff --git a/Math.php b/Math.php index bfa3685..c4ccba9 100644 --- a/Math.php +++ b/Math.php @@ -240,6 +240,12 @@ $wgResourceModules['ext.math.styles'] = array( 'localBasePath' => __DIR__ . '/modules', 'remoteExtPath' => 'Math/modules', 'styles' => 'ext.math.css', + 'targets' => array( 'desktop', 'mobile' ), +); +$wgResourceModules['ext.math.desktop.styles'] = array( + 'localBasePath' => __DIR__ . '/modules', + 'remoteExtPath' => 'Math/modules', + 'styles' => 'ext.math.desktop.css', ); $wgResourceModules['ext.math.scripts'] = array( 'localBasePath' => __DIR__ . '/modules', diff --git a/modules/ext.math.css b/modules/ext.math.css index 66e31c8..881a886 100644 --- a/modules/ext.math.css +++ b/modules/ext.math.css @@ -26,13 +26,6 @@ m|math { font-family: Cambria, Cambria Math, Latin Modern Math, STIX Math, LatinModernMathWOFF, serif; } -@font-face { - /* WOFF version of Latin Modern Math. - See https://github.com/fred-wang/MathFonts */ - font-family: LatinModernMathWOFF; - src: url(./LatinModern/latinmodern-math.woff); -} - /* Default style for the image fallback. */ /* Note: We had to use !important rules because of conflicts with the style generated by Mathoid. See https://gerrit.wikimedia.org/r/#/c/166213/ */ diff --git a/modules/ext.math.desktop.css b/modules/ext.math.desktop.css new file mode 100644 index 0000000..ad7da83 --- /dev/null +++ b/modules/ext.math.desktop.css @@ -0,0 +1,14 @@ +/* + Document : ext.math. + Created on : 20.10.2014, 22:00:00 + Author : fredw (Frédéric Wang) + Description: + Additional style, to load only on desktop. +*/ + +@font-face { + /* WOFF version of Latin Modern Math. + See https://github.com/fred-wang/MathFonts */ + font-family: LatinModernMathWOFF; + src: url(./LatinModern/latinmodern-math.woff); +}