http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95840

Revision: 95840
Author:   nikerabbit
Date:     2011-08-31 08:23:57 +0000 (Wed, 31 Aug 2011)
Log Message:
-----------
Condense the font definition structure by isolating basepath - part of bug 29318

Modified Paths:
--------------
    trunk/extensions/WebFonts/WebFonts.config.php
    trunk/extensions/WebFonts/js/webfonts.js

Modified: trunk/extensions/WebFonts/WebFonts.config.php
===================================================================
--- trunk/extensions/WebFonts/WebFonts.config.php       2011-08-31 07:22:00 UTC 
(rev 95839)
+++ trunk/extensions/WebFonts/WebFonts.config.php       2011-08-31 08:23:57 UTC 
(rev 95840)
@@ -5,35 +5,35 @@
  * @file
  * @ingroup Extensions
  */
-$fontsPath = "$wgScriptPath/extensions/WebFonts/fonts";
 $wgWebFonts = array(
+       'basepath' => "$wgScriptPath/extensions/WebFonts/fonts/",
        'fonts' => array(
                'RufScript' => array(
-                       'eot' => "$fontsPath/en/Rufscript.eot",
-                       'ttf' => "$fontsPath/en/Rufscript.ttf",
-                       'woff' => "$fontsPath/en/Rufscript.woff",
+                       'eot' => "en/Rufscript.eot",
+                       'ttf' => "en/Rufscript.ttf",
+                       'woff' => "en/Rufscript.woff",
                ),
 
                'Perizia' => array(
-                       'eot' => "$fontsPath/en/Perizia.eot",
-                       'ttf' => "$fontsPath/en/Perizia.ttf",
-                       'woff' => "$fontsPath/en/Perizia.woff",
+                       'eot' => "en/Perizia.eot",
+                       'ttf' => "en/Perizia.ttf",
+                       'woff' => "en/Perizia.woff",
                ),
                'Ubuntu' => array(
-                       'eot' => "$fontsPath/en/ubuntu-r-webfont.eot",
-                       'ttf' => "$fontsPath/en/ubuntu-r.ttf",
-                       'woff' => "$fontsPath/en/ubuntu-r-webfont.woff",
-                       'svg' => "$fontsPath/en/ubuntu-r-webfont.svg",
+                       'eot' => "en/ubuntu-r-webfont.eot",
+                       'ttf' => "en/ubuntu-r.ttf",
+                       'woff' => "en/ubuntu-r-webfont.woff",
+                       'svg' => "en/ubuntu-r-webfont.svg",
                        ),
-               'AnjaliOldLipi' => array(
-                       'eot' => "$fontsPath/ml/AnjaliOldLipi.eot",
-                       'ttf' => "$fontsPath/ml/AnjaliOldLipi.ttf",
-                       'woff' => "$fontsPath/ml/AnjaliOldLipi.woff",
+               'AnjaliOldLipi' => array(
+                       'eot' => "ml/AnjaliOldLipi.eot",
+                       'ttf' => "ml/AnjaliOldLipi.ttf",
+                       'woff' => "ml/AnjaliOldLipi.woff",
                ),
                'Meera' => array(
-                       'eot' => "$fontsPath/ml/Meera.eot",
-                       'ttf' => "$fontsPath/ml/Meera.ttf",
-                       'woff' => "$fontsPath/ml/Meera.woff",
+                       'eot' => "ml/Meera.eot",
+                       'ttf' => "ml/Meera.ttf",
+                       'woff' => "ml/Meera.woff",
                        'scale' => 1.5,
                        'normalization' => array(
                                "ൾ" => "ള്‍",
@@ -48,9 +48,9 @@
                                ),
 
                'Rachana' => array(
-                       'eot' => "$fontsPath/ml/Rachana.eot",
-                       'ttf' => "$fontsPath/ml/Rachana.ttf",
-                       'woff' => "$fontsPath/ml/Rachana.woff",
+                       'eot' => "ml/Rachana.eot",
+                       'ttf' => "ml/Rachana.ttf",
+                       'woff' => "ml/Rachana.woff",
                        'normalization' => array(
                                "ൾ" => "ള്‍",
                                "ൻ" => "ന്‍",
@@ -63,9 +63,9 @@
                                )
                                ),
                'RaghuMalayalam' => array(
-                       'eot' => "$fontsPath/ml/RaghuMalayalam.eot",
-                       'ttf' => "$fontsPath/ml/RaghuMalayalam.ttf",
-                       'woff' => "$fontsPath/ml/RaghuMalayalam.woff",
+                       'eot' => "ml/RaghuMalayalam.eot",
+                       'ttf' => "ml/RaghuMalayalam.ttf",
+                       'woff' => "ml/RaghuMalayalam.woff",
                        'normalization' => array(
                                "ൾ" => "ള്‍",
                                "ൻ" => "ന്‍",
@@ -78,148 +78,148 @@
                                )
                                ),
                'Lohit Oriya' => array(
-                       'eot' => "$fontsPath/or/Lohit-Oriya.eot",
-                       'ttf' => "$fontsPath/or/Lohit-Oriya.ttf",
-                       'woff' => "$fontsPath/or/Lohit-Oriya.woff",
+                       'eot' => "or/Lohit-Oriya.eot",
+                       'ttf' => "or/Lohit-Oriya.ttf",
+                       'woff' => "or/Lohit-Oriya.woff",
                                ),
                'Lohit Tamil' => array(
-                       'eot' => "$fontsPath/ta/Lohit-Tamil.eot",
-                       'ttf' => "$fontsPath/ta/Lohit-Tamil.ttf",
-                       'woff' => "$fontsPath/ta/Lohit-Tamil.woff",
+                       'eot' => "ta/Lohit-Tamil.eot",
+                       'ttf' => "ta/Lohit-Tamil.ttf",
+                       'woff' => "ta/Lohit-Tamil.woff",
                                ),
                'Lohit Telugu' => array(
-                       'eot' => "$fontsPath/te/LohitTelugu.eot",
-                       'ttf' => "$fontsPath/te/LohitTelugu.ttf",
-                       'woff' => "$fontsPath/te/LohitTelugu.woff",
+                       'eot' => "te/LohitTelugu.eot",
+                       'ttf' => "te/LohitTelugu.ttf",
+                       'woff' => "te/LohitTelugu.woff",
                                ),
                'Lohit Bengali' => array(
-                       'eot' => "$fontsPath/bn/LohitBengali.eot",
-                       'ttf' => "$fontsPath/bn/LohitBengali.ttf",
-                       'woff' => "$fontsPath/bn/LohitBengali.woff",
+                       'eot' => "bn/LohitBengali.eot",
+                       'ttf' => "bn/LohitBengali.ttf",
+                       'woff' => "bn/LohitBengali.woff",
                                ),
                'Samyak Gujarati' => array(
-                       'eot' => "$fontsPath/gu/SamyakGujarati.eot",
-                       'ttf' => "$fontsPath/gu/SamyakGujarati.ttf",
-                       'woff' => "$fontsPath/gu/SamyakGujarati.woff",
+                       'eot' => "gu/SamyakGujarati.eot",
+                       'ttf' => "gu/SamyakGujarati.ttf",
+                       'woff' => "gu/SamyakGujarati.woff",
                                ),
                'Lohit Hindi' => array(
-                       'eot' => "$fontsPath/hi/LohitHindi.eot",
-                       'ttf' => "$fontsPath/hi/LohitHindi.ttf",
-                       'woff' => "$fontsPath/hi/LohitHindi.woff",
+                       'eot' => "hi/LohitHindi.eot",
+                       'ttf' => "hi/LohitHindi.ttf",
+                       'woff' => "hi/LohitHindi.woff",
                                ),
                'Samyak Devanagari' => array(
-                       'eot' => "$fontsPath/hi/SamyakDevanagari.eot",
-                       'ttf' => "$fontsPath/hi/SamyakDevanagari.ttf",
-                       'woff' => "$fontsPath/hi/SamyakDevanagari.woff",
+                       'eot' => "hi/SamyakDevanagari.eot",
+                       'ttf' => "hi/SamyakDevanagari.ttf",
+                       'woff' => "hi/SamyakDevanagari.woff",
                                ),
                'Miriam CLM' => array(
-                       'eot' => "$fontsPath/he/MiriamCLM-Book.eot",
-                       'ttf' => "$fontsPath/he/MiriamCLM-Book.ttf",
-                       'woff' => "$fontsPath/he/MiriamCLM-Book.woff",
+                       'eot' => "he/MiriamCLM-Book.eot",
+                       'ttf' => "he/MiriamCLM-Book.ttf",
+                       'woff' => "he/MiriamCLM-Book.woff",
                                ),              
                'Taamey Frank CLM' => array(
-                       'eot' => "$fontsPath/he/TaameyFrankCLM.eot",
-                       'ttf' => "$fontsPath/he/TaameyFrankCLM.ttf",
-                       'woff' => "$fontsPath/he/TaameyFrankCLM.woff",
-                       'svg' => "$fontsPath/he/TaameyFrankCLM.svg",
+                       'eot' => "he/TaameyFrankCLM.eot",
+                       'ttf' => "he/TaameyFrankCLM.ttf",
+                       'woff' => "he/TaameyFrankCLM.woff",
+                       'svg' => "he/TaameyFrankCLM.svg",
                                ),
                'Kedage' => array(
-                       'eot' => "$fontsPath/kn/Kedage.eot",
-                       'ttf' => "$fontsPath/kn/Kedage.ttf",
-                       'woff' => "$fontsPath/kn/Kedage.woff",
+                       'eot' => "kn/Kedage.eot",
+                       'ttf' => "kn/Kedage.ttf",
+                       'woff' => "kn/Kedage.woff",
                                ),
                'Lohit Kannada' => array(
-                       'eot' => "$fontsPath/kn/LohitKannada.eot",
-                       'ttf' => "$fontsPath/kn/LohitKannada.ttf",
-                       'woff' => "$fontsPath/kn/LohitKannada.woff",
+                       'eot' => "kn/LohitKannada.eot",
+                       'ttf' => "kn/LohitKannada.ttf",
+                       'woff' => "kn/LohitKannada.woff",
                                ),
                'Masterpiece Uni Sans' => array(
-                       'eot' => "$fontsPath/my/MasterpieceUniSans.eot",
-                       'ttf' => "$fontsPath/my/MasterpieceUniSans.ttf",
-                       'woff' => "$fontsPath/my/MasterpieceUniSans.woff",
-                       'svg' =>  "$fontsPath/my/MasterpieceUniSans.svg",
+                       'eot' => "my/MasterpieceUniSans.eot",
+                       'ttf' => "my/MasterpieceUniSans.ttf",
+                       'woff' => "my/MasterpieceUniSans.woff",
+                       'svg' =>  "my/MasterpieceUniSans.svg",
                ),
                'Padauk-Regular' => array(
-                       'eot' => "$fontsPath/my/Padauk-Regular.eot",
-                       'ttf' => "$fontsPath/my/Padauk-Regular.ttf",
-                       'woff' => "$fontsPath/my/Padauk-Regular.woff",
-                       'svg' =>  "$fontsPath/my/Padauk-Regular.svg",
+                       'eot' => "my/Padauk-Regular.eot",
+                       'ttf' => "my/Padauk-Regular.ttf",
+                       'woff' => "my/Padauk-Regular.woff",
+                       'svg' =>  "my/Padauk-Regular.svg",
                ),
                'Myanmar3' => array(
-                       'eot' => "$fontsPath/my/Myanmar3.eot",
-                       'ttf' => "$fontsPath/my/Myanmar3.ttf",
-                       'woff' => "$fontsPath/my/Myanmar3.woff",
-                       'svg' =>  "$fontsPath/my/Myanmar3.svg",
+                       'eot' => "my/Myanmar3.eot",
+                       'ttf' => "my/Myanmar3.ttf",
+                       'woff' => "my/Myanmar3.woff",
+                       'svg' =>  "my/Myanmar3.svg",
                ),
                'Yunghkio' => array(
-                       'eot' => "$fontsPath/my/Yunghkio.eot",
-                       'ttf' => "$fontsPath/my/Yunghkio.ttf",
-                       'woff' => "$fontsPath/my/Yunghkio.woff",
-                       'svg' =>  "$fontsPath/my/Yunghkio.svg",
+                       'eot' => "my/Yunghkio.eot",
+                       'ttf' => "my/Yunghkio.ttf",
+                       'woff' => "my/Yunghkio.woff",
+                       'svg' =>  "my/Yunghkio.svg",
                ),
                'KhmerOSbattambang' => array(
-                       'eot' => "$fontsPath/km/KhmerOSbattambang.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSbattambang.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSbattambang.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSbattambang.svg",
+                       'eot' => "km/KhmerOSbattambang.eot",
+                       'ttf' => "km/KhmerOSbattambang.ttf",
+                       'woff' => "km/KhmerOSbattambang.woff",
+                       'svg' =>  "km/KhmerOSbattambang.svg",
                ),
                'KhmerOSbokor' => array(
-                       'eot' => "$fontsPath/km/KhmerOSbokor.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSbokor.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSbokor.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSbokor.svg",
+                       'eot' => "km/KhmerOSbokor.eot",
+                       'ttf' => "km/KhmerOSbokor.ttf",
+                       'woff' => "km/KhmerOSbokor.woff",
+                       'svg' =>  "km/KhmerOSbokor.svg",
                ),
                'KhmerOS' => array(
-                       'eot' => "$fontsPath/km/KhmerOS.eot",
-                       'ttf' => "$fontsPath/km/KhmerOS.ttf",
-                       'woff' => "$fontsPath/km/KhmerOS.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOS.svg",
+                       'eot' => "km/KhmerOS.eot",
+                       'ttf' => "km/KhmerOS.ttf",
+                       'woff' => "km/KhmerOS.woff",
+                       'svg' =>  "km/KhmerOS.svg",
                ),
                'KhmerOSsiemreap' => array(
-                       'eot' => "$fontsPath/km/KhmerOSsiemreap.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSsiemreap.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSsiemreap.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSsiemreap.svg",
+                       'eot' => "km/KhmerOSsiemreap.eot",
+                       'ttf' => "km/KhmerOSsiemreap.ttf",
+                       'woff' => "km/KhmerOSsiemreap.woff",
+                       'svg' =>  "km/KhmerOSsiemreap.svg",
                ),
                'KhmerOSmuollight' => array(
-                       'eot' => "$fontsPath/km/KhmerOSmuollight.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSmuollight.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSmuollight.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSmuollight.svg",
+                       'eot' => "km/KhmerOSmuollight.eot",
+                       'ttf' => "km/KhmerOSmuollight.ttf",
+                       'woff' => "km/KhmerOSmuollight.woff",
+                       'svg' =>  "km/KhmerOSmuollight.svg",
                ),
                'KhmerOSmuol' => array(
-                       'eot' => "$fontsPath/km/KhmerOSmuol.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSmuol.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSmuol.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSmuol.svg",
+                       'eot' => "km/KhmerOSmuol.eot",
+                       'ttf' => "km/KhmerOSmuol.ttf",
+                       'woff' => "km/KhmerOSmuol.woff",
+                       'svg' =>  "km/KhmerOSmuol.svg",
                ),
                'KhmerOSmuolpali' => array(
-                       'eot' => "$fontsPath/km/KhmerOSmuolpali.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSmuolpali.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSmuolpali.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSmuolpali.svg",
+                       'eot' => "km/KhmerOSmuolpali.eot",
+                       'ttf' => "km/KhmerOSmuolpali.ttf",
+                       'woff' => "km/KhmerOSmuolpali.woff",
+                       'svg' =>  "km/KhmerOSmuolpali.svg",
                ),
                'KhmerOSfreehand' => array(
-                       'eot' => "$fontsPath/km/KhmerOSfreehand.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSfreehand.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSfreehand.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSfreehand.svg",
+                       'eot' => "km/KhmerOSfreehand.eot",
+                       'ttf' => "km/KhmerOSfreehand.ttf",
+                       'woff' => "km/KhmerOSfreehand.woff",
+                       'svg' =>  "km/KhmerOSfreehand.svg",
                ),
                'KhmerOSfasthand' => array(
-                       'eot' => "$fontsPath/km/KhmerOSfasthand.eot",
-                       'ttf' => "$fontsPath/km/KhmerOSfasthand.ttf",
-                       'woff' => "$fontsPath/km/KhmerOSfasthand.woff",
-                       'svg' =>  "$fontsPath/km/KhmerOSfasthand.svg",
+                       'eot' => "km/KhmerOSfasthand.eot",
+                       'ttf' => "km/KhmerOSfasthand.ttf",
+                       'woff' => "km/KhmerOSfasthand.woff",
+                       'svg' =>  "km/KhmerOSfasthand.svg",
                ),
                'Pagul' => array(
-                       'eot' => "$fontsPath/saz/Pagul.eot",
-                       'ttf' => "$fontsPath/saz/Pagul.ttf",
-                       'woff' => "$fontsPath/saz/Pagul.woff",
+                       'eot' => "saz/Pagul.eot",
+                       'ttf' => "saz/Pagul.ttf",
+                       'woff' => "saz/Pagul.woff",
                ),
                'AbyssinicaSIL'=> array(
-                       'eot' => "$fontsPath/gez/AbyssinicaSIL-R.eot",
-                       'ttf' => "$fontsPath/gez/AbyssinicaSIL-R.ttf",
-                       'woff' => "$fontsPath/gez/AbyssinicaSIL-R.woff",
+                       'eot' => "gez/AbyssinicaSIL-R.eot",
+                       'ttf' => "gez/AbyssinicaSIL-R.ttf",
+                       'woff' => "gez/AbyssinicaSIL-R.woff",
                ),
                ),
 

Modified: trunk/extensions/WebFonts/js/webfonts.js
===================================================================
--- trunk/extensions/WebFonts/js/webfonts.js    2011-08-31 07:22:00 UTC (rev 
95839)
+++ trunk/extensions/WebFonts/js/webfonts.js    2011-08-31 08:23:57 UTC (rev 
95840)
@@ -108,23 +108,24 @@
                 */
                loadcss: function(fontfamily){
                        var fontconfig = $.webfonts.config.fonts[fontfamily];
+                       var base = $.webfonts.config.basepath;
                        var styleString =
                                "<style type='text/css'>\n@font-face {\n"
                                + "\tfont-family: '"+fontfamily+"';\n";
                        if ( 'eot' in fontconfig ) {
-                               styleString += "\tsrc: 
url('"+fontconfig.eot+"');\n";
+                               styleString += "\tsrc: 
url('"+base+fontconfig.eot+"');\n";
                        }
                        //If the font is present locally, use it.
                        styleString += "\tsrc: local('"+ fontfamily +"'),";
 
                        if ( 'woff' in fontconfig ) {
-                               styleString += "\t\turl('"+fontconfig.woff+"') 
format('woff'),";
+                               styleString += 
"\t\turl('"+base+fontconfig.woff+"') format('woff'),";
                        }
                        if ( 'svg' in fontconfig ) {
-                               styleString += 
"\t\turl('"+fontconfig.svg+"#"+fontfamily+"') format('svg'),";
+                               styleString += 
"\t\turl('"+base+fontconfig.svg+"#"+fontfamily+"') format('svg'),";
                        }
                        if ( 'ttf' in fontconfig ) {
-                               styleString += "\t\turl('"+fontconfig.ttf+"') 
format('truetype');\n";
+                               styleString += 
"\t\turl('"+base+fontconfig.ttf+"') format('truetype');\n";
                        }
 
                        styleString += "\tfont-weight: normal;\n}\n</style>\n";


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to