Index: trunk/extensions/WebFonts/WebFonts.config.php |
— | — | @@ -1,246 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Configuration file for webfonts |
5 | | - * First font is the default font for the language |
6 | | - * @file |
7 | | - * @ingroup Extensions |
8 | | - */ |
9 | | -$wgWebFonts = array( |
10 | | - 'basepath' => "$wgScriptPath/extensions/WebFonts/fonts/", |
11 | | - 'fonts' => array( |
12 | | - 'RufScript' => array( |
13 | | - 'eot' => "en/Rufscript.eot", |
14 | | - 'ttf' => "en/Rufscript.ttf", |
15 | | - 'woff' => "en/Rufscript.woff", |
16 | | - ), |
17 | | - |
18 | | - 'Perizia' => array( |
19 | | - 'eot' => "en/Perizia.eot", |
20 | | - 'ttf' => "en/Perizia.ttf", |
21 | | - 'woff' => "en/Perizia.woff", |
22 | | - ), |
23 | | - 'Ubuntu' => array( |
24 | | - 'eot' => "en/ubuntu-r-webfont.eot", |
25 | | - 'ttf' => "en/ubuntu-r.ttf", |
26 | | - 'woff' => "en/ubuntu-r-webfont.woff", |
27 | | - 'svg' => "en/ubuntu-r-webfont.svg", |
28 | | - ), |
29 | | - 'AnjaliOldLipi' => array( |
30 | | - 'eot' => "ml/AnjaliOldLipi.eot", |
31 | | - 'ttf' => "ml/AnjaliOldLipi.ttf", |
32 | | - 'woff' => "ml/AnjaliOldLipi.woff", |
33 | | - ), |
34 | | - 'Meera' => array( |
35 | | - 'eot' => "ml/Meera.eot", |
36 | | - 'ttf' => "ml/Meera.ttf", |
37 | | - 'woff' => "ml/Meera.woff", |
38 | | - 'scale' => 1.5, |
39 | | - 'normalization' => array( |
40 | | - "ൾ" => "ള്", |
41 | | - "ൻ" => "ന്", |
42 | | - "ർ" => "ര്", |
43 | | - "ൺ " => "ണ്", |
44 | | - "ൽ" => "ല്", |
45 | | - "ൿ" => "ക് ", |
46 | | - "ൻറ" => "ന്റ", |
47 | | - "ന്റെ" => "ന്റെ" |
48 | | - ) |
49 | | - ), |
50 | | - |
51 | | - 'Rachana' => array( |
52 | | - 'eot' => "ml/Rachana.eot", |
53 | | - 'ttf' => "ml/Rachana.ttf", |
54 | | - 'woff' => "ml/Rachana.woff", |
55 | | - 'normalization' => array( |
56 | | - "ൾ" => "ള്", |
57 | | - "ൻ" => "ന്", |
58 | | - "ർ" => "ര്", |
59 | | - "ൺ " => "ണ്", |
60 | | - "ൽ" => "ല്", |
61 | | - "ൿ" => "ക് ", |
62 | | - "ൻറ" => "ന്റ", |
63 | | - "ന്റെ" => "ന്റെ" |
64 | | - ) |
65 | | - ), |
66 | | - 'RaghuMalayalam' => array( |
67 | | - 'eot' => "ml/RaghuMalayalam.eot", |
68 | | - 'ttf' => "ml/RaghuMalayalam.ttf", |
69 | | - 'woff' => "ml/RaghuMalayalam.woff", |
70 | | - 'normalization' => array( |
71 | | - "ൾ" => "ള്", |
72 | | - "ൻ" => "ന്", |
73 | | - "ർ" => "ര്", |
74 | | - "ൺ " => "ണ്", |
75 | | - "ൽ" => "ല്", |
76 | | - "ൿ" => "ക് ", |
77 | | - "ൻറ" => "ന്റ", |
78 | | - "ന്റെ" => "ന്റെ" |
79 | | - ) |
80 | | - ), |
81 | | - 'Lohit Oriya' => array( |
82 | | - 'eot' => "or/Lohit-Oriya.eot", |
83 | | - 'ttf' => "or/Lohit-Oriya.ttf", |
84 | | - 'woff' => "or/Lohit-Oriya.woff", |
85 | | - ), |
86 | | - 'Lohit Tamil' => array( |
87 | | - 'eot' => "ta/Lohit-Tamil.eot", |
88 | | - 'ttf' => "ta/Lohit-Tamil.ttf", |
89 | | - 'woff' => "ta/Lohit-Tamil.woff", |
90 | | - ), |
91 | | - 'Lohit Telugu' => array( |
92 | | - 'eot' => "te/LohitTelugu.eot", |
93 | | - 'ttf' => "te/LohitTelugu.ttf", |
94 | | - 'woff' => "te/LohitTelugu.woff", |
95 | | - ), |
96 | | - 'Lohit Bengali' => array( |
97 | | - 'eot' => "bn/LohitBengali.eot", |
98 | | - 'ttf' => "bn/LohitBengali.ttf", |
99 | | - 'woff' => "bn/LohitBengali.woff", |
100 | | - ), |
101 | | - 'Samyak Gujarati' => array( |
102 | | - 'eot' => "gu/SamyakGujarati.eot", |
103 | | - 'ttf' => "gu/SamyakGujarati.ttf", |
104 | | - 'woff' => "gu/SamyakGujarati.woff", |
105 | | - ), |
106 | | - 'Lohit Hindi' => array( |
107 | | - 'eot' => "hi/LohitHindi.eot", |
108 | | - 'ttf' => "hi/LohitHindi.ttf", |
109 | | - 'woff' => "hi/LohitHindi.woff", |
110 | | - ), |
111 | | - 'Samyak Devanagari' => array( |
112 | | - 'eot' => "hi/SamyakDevanagari.eot", |
113 | | - 'ttf' => "hi/SamyakDevanagari.ttf", |
114 | | - 'woff' => "hi/SamyakDevanagari.woff", |
115 | | - ), |
116 | | - 'Miriam CLM' => array( |
117 | | - 'eot' => "he/MiriamCLM-Book.eot", |
118 | | - 'ttf' => "he/MiriamCLM-Book.ttf", |
119 | | - 'woff' => "he/MiriamCLM-Book.woff", |
120 | | - ), |
121 | | - 'Taamey Frank CLM' => array( |
122 | | - 'eot' => "he/TaameyFrankCLM.eot", |
123 | | - 'ttf' => "he/TaameyFrankCLM.ttf", |
124 | | - 'woff' => "he/TaameyFrankCLM.woff", |
125 | | - 'svg' => "he/TaameyFrankCLM.svg", |
126 | | - ), |
127 | | - 'Kedage' => array( |
128 | | - 'eot' => "kn/Kedage.eot", |
129 | | - 'ttf' => "kn/Kedage.ttf", |
130 | | - 'woff' => "kn/Kedage.woff", |
131 | | - ), |
132 | | - 'Lohit Kannada' => array( |
133 | | - 'eot' => "kn/LohitKannada.eot", |
134 | | - 'ttf' => "kn/LohitKannada.ttf", |
135 | | - 'woff' => "kn/LohitKannada.woff", |
136 | | - ), |
137 | | - 'Masterpiece Uni Sans' => array( |
138 | | - 'eot' => "my/MasterpieceUniSans.eot", |
139 | | - 'ttf' => "my/MasterpieceUniSans.ttf", |
140 | | - 'woff' => "my/MasterpieceUniSans.woff", |
141 | | - 'svg' => "my/MasterpieceUniSans.svg", |
142 | | - ), |
143 | | - 'Padauk-Regular' => array( |
144 | | - 'eot' => "my/Padauk-Regular.eot", |
145 | | - 'ttf' => "my/Padauk-Regular.ttf", |
146 | | - 'woff' => "my/Padauk-Regular.woff", |
147 | | - 'svg' => "my/Padauk-Regular.svg", |
148 | | - ), |
149 | | - 'Myanmar3' => array( |
150 | | - 'eot' => "my/Myanmar3.eot", |
151 | | - 'ttf' => "my/Myanmar3.ttf", |
152 | | - 'woff' => "my/Myanmar3.woff", |
153 | | - 'svg' => "my/Myanmar3.svg", |
154 | | - ), |
155 | | - 'Yunghkio' => array( |
156 | | - 'eot' => "my/Yunghkio.eot", |
157 | | - 'ttf' => "my/Yunghkio.ttf", |
158 | | - 'woff' => "my/Yunghkio.woff", |
159 | | - 'svg' => "my/Yunghkio.svg", |
160 | | - ), |
161 | | - 'KhmerOSbattambang' => array( |
162 | | - 'eot' => "km/KhmerOSbattambang.eot", |
163 | | - 'ttf' => "km/KhmerOSbattambang.ttf", |
164 | | - 'woff' => "km/KhmerOSbattambang.woff", |
165 | | - 'svg' => "km/KhmerOSbattambang.svg", |
166 | | - ), |
167 | | - 'KhmerOSbokor' => array( |
168 | | - 'eot' => "km/KhmerOSbokor.eot", |
169 | | - 'ttf' => "km/KhmerOSbokor.ttf", |
170 | | - 'woff' => "km/KhmerOSbokor.woff", |
171 | | - 'svg' => "km/KhmerOSbokor.svg", |
172 | | - ), |
173 | | - 'KhmerOS' => array( |
174 | | - 'eot' => "km/KhmerOS.eot", |
175 | | - 'ttf' => "km/KhmerOS.ttf", |
176 | | - 'woff' => "km/KhmerOS.woff", |
177 | | - 'svg' => "km/KhmerOS.svg", |
178 | | - ), |
179 | | - 'KhmerOSsiemreap' => array( |
180 | | - 'eot' => "km/KhmerOSsiemreap.eot", |
181 | | - 'ttf' => "km/KhmerOSsiemreap.ttf", |
182 | | - 'woff' => "km/KhmerOSsiemreap.woff", |
183 | | - 'svg' => "km/KhmerOSsiemreap.svg", |
184 | | - ), |
185 | | - 'KhmerOSmuollight' => array( |
186 | | - 'eot' => "km/KhmerOSmuollight.eot", |
187 | | - 'ttf' => "km/KhmerOSmuollight.ttf", |
188 | | - 'woff' => "km/KhmerOSmuollight.woff", |
189 | | - 'svg' => "km/KhmerOSmuollight.svg", |
190 | | - ), |
191 | | - 'KhmerOSmuol' => array( |
192 | | - 'eot' => "km/KhmerOSmuol.eot", |
193 | | - 'ttf' => "km/KhmerOSmuol.ttf", |
194 | | - 'woff' => "km/KhmerOSmuol.woff", |
195 | | - 'svg' => "km/KhmerOSmuol.svg", |
196 | | - ), |
197 | | - 'KhmerOSmuolpali' => array( |
198 | | - 'eot' => "km/KhmerOSmuolpali.eot", |
199 | | - 'ttf' => "km/KhmerOSmuolpali.ttf", |
200 | | - 'woff' => "km/KhmerOSmuolpali.woff", |
201 | | - 'svg' => "km/KhmerOSmuolpali.svg", |
202 | | - ), |
203 | | - 'KhmerOSfreehand' => array( |
204 | | - 'eot' => "km/KhmerOSfreehand.eot", |
205 | | - 'ttf' => "km/KhmerOSfreehand.ttf", |
206 | | - 'woff' => "km/KhmerOSfreehand.woff", |
207 | | - 'svg' => "km/KhmerOSfreehand.svg", |
208 | | - ), |
209 | | - 'KhmerOSfasthand' => array( |
210 | | - 'eot' => "km/KhmerOSfasthand.eot", |
211 | | - 'ttf' => "km/KhmerOSfasthand.ttf", |
212 | | - 'woff' => "km/KhmerOSfasthand.woff", |
213 | | - 'svg' => "km/KhmerOSfasthand.svg", |
214 | | - ), |
215 | | - 'Pagul' => array( |
216 | | - 'eot' => "saz/Pagul.eot", |
217 | | - 'ttf' => "saz/Pagul.ttf", |
218 | | - 'woff' => "saz/Pagul.woff", |
219 | | - ), |
220 | | - 'AbyssinicaSIL'=> array( |
221 | | - 'eot' => "gez/AbyssinicaSIL-R.eot", |
222 | | - 'ttf' => "gez/AbyssinicaSIL-R.ttf", |
223 | | - 'woff' => "gez/AbyssinicaSIL-R.woff", |
224 | | - ), |
225 | | - ), |
226 | | - |
227 | | - 'languages' => array( |
228 | | - // 'en' => array( 'RufScript', 'Perizia', 'Ubuntu' ), |
229 | | - 'ml' => array( 'AnjaliOldLipi', 'Meera', 'Rachana', 'RaghuMalayalam' ), |
230 | | - 'or' => array( 'Lohit Oriya' ), |
231 | | - 'ta' => array( 'Lohit Tamil' ), |
232 | | - 'te' => array( 'Lohit Telugu' ), |
233 | | - 'bn' => array( 'Lohit Bengali' ), |
234 | | - 'as' => array( 'Lohit Bengali' ), |
235 | | - 'gu' => array( 'Samyak Gujarati' ), |
236 | | - 'hi' => array( 'Samyak Devanagari', 'Lohit Hindi' ), |
237 | | - 'mr' => array( 'Samyak Devanagari', 'Lohit Hindi' ), |
238 | | - 'ks' => array( 'Samyak Devanagari', 'Lohit Hindi' ), |
239 | | - 'he' => array( 'Miriam CLM', 'Taamey Frank CLM' ), |
240 | | - 'kn' => array( 'Kedage', 'Lohit Kannada' ), |
241 | | - 'my' => array( 'Masterpiece Uni Sans', 'Padauk-Regular', 'Myanmar3', 'Yunghkio' ), |
242 | | - 'km' => array( 'KhmerOSbattambang', 'KhmerOSsiemreap', 'KhmerOS', 'KhmerOSbokor', 'KhmerOSmuollight', 'KhmerOSmuol', 'KhmerOSmuolpali', 'KhmerOSfreehand', 'KhmerOSfasthand' ), |
243 | | - 'saz' => array( 'Pagul' ), |
244 | | - 'am' => array( 'AbyssinicaSIL' ), |
245 | | - 'ti' => array( 'AbyssinicaSIL' ), |
246 | | - ), |
247 | | - ); |
Index: trunk/extensions/WebFonts/js/webfonts.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | |
6 | 6 | |
7 | 7 | oldconfig: false, |
8 | | - config : mw.config.get( "wgWebFonts" ), |
| 8 | + config : $.webfonts.config, |
9 | 9 | /* Version number */ |
10 | 10 | version: "0.1.2", |
11 | 11 | set: function( font ) { |
— | — | @@ -16,9 +16,9 @@ |
17 | 17 | if ( !font in $.webfonts.config.fonts ) { |
18 | 18 | console.log( "Requested unknown font", font ); |
19 | 19 | return; |
20 | | - } else { |
21 | | - config = $.webfonts.config.fonts[font]; |
22 | 20 | } |
| 21 | + var config = $.webfonts.config.fonts[font]; |
| 22 | + |
23 | 23 | //load the style sheet for the font |
24 | 24 | $.webfonts.loadcss(font); |
25 | 25 | |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | $.webfonts.oldconfig = { |
29 | 29 | "font-family": $("body").css('font-family'), |
30 | 30 | "font-size": $("body").css('font-size') |
31 | | - } |
| 31 | + }; |
32 | 32 | } |
33 | 33 | |
34 | 34 | //Set the font, fallback fonts.Need to change the fonts of Input Select and Textarea explicitly. |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | */ |
110 | 110 | loadcss: function(fontfamily){ |
111 | 111 | var fontconfig = $.webfonts.config.fonts[fontfamily]; |
112 | | - var base = $.webfonts.config.basepath; |
| 112 | + var base = mw.config.get( "wgExtensionAssetsPath" ) + "/WebFonts/fonts/"; |
113 | 113 | var styleString = |
114 | 114 | "<style type='text/css'>\n@font-face {\n" |
115 | 115 | + "\tfont-family: '"+fontfamily+"';\n"; |
— | — | @@ -139,7 +139,20 @@ |
140 | 140 | * It also apply the font from cookie, if any. |
141 | 141 | */ |
142 | 142 | setup: function() { |
143 | | - var config = mw.config.get( "wgWebFontsAvailable" ); |
| 143 | + var config = []; |
| 144 | + var languages = $.webfonts.config.languages; |
| 145 | + var requested = [wgUserLanguage, wgContentLanguage]; |
| 146 | + for (var i = 0; i < requested.length; i++) { |
| 147 | + if (requested[i] in languages) { |
| 148 | + var fonts = languages[requested[i]]; |
| 149 | + for (var j = 0; j < fonts.length; j++) { |
| 150 | + if ( $.inArray(fonts[j], config) === -1 ) { |
| 151 | + config.push(fonts[j]); |
| 152 | + } |
| 153 | + } |
| 154 | + } |
| 155 | + } |
| 156 | + |
144 | 157 | // Build font dropdown |
145 | 158 | $.webfonts.buildMenu(config ); |
146 | 159 | //see if there is a font in cookie |
Index: trunk/extensions/WebFonts/js/webfonts.fontlist.js |
— | — | @@ -0,0 +1,258 @@ |
| 2 | +/** |
| 3 | + * Configuration file for webfonts |
| 4 | + * First font is the default font for the language |
| 5 | + */ |
| 6 | + |
| 7 | +(function ($) { |
| 8 | + $.webfonts = {}; |
| 9 | + |
| 10 | + $.webfonts.config = { |
| 11 | + fonts: { |
| 12 | + RufScript: { |
| 13 | + eot: "en/Rufscript.eot", |
| 14 | + ttf: "en/Rufscript.ttf", |
| 15 | + woff: "en/Rufscript.woff" |
| 16 | + }, |
| 17 | + Perizia: { |
| 18 | + eot: "en/Perizia.eot", |
| 19 | + ttf: "en/Perizia.ttf", |
| 20 | + woff: "en/Perizia.woff" |
| 21 | + }, |
| 22 | + Ubuntu: { |
| 23 | + eot: "en/ubuntu-r-webfont.eot", |
| 24 | + ttf: "en/ubuntu-r.ttf", |
| 25 | + woff: "en/ubuntu-r-webfont.woff", |
| 26 | + svg: "en/ubuntu-r-webfont.svg" |
| 27 | + }, |
| 28 | + |
| 29 | + AnjaliOldLipi: { |
| 30 | + eot: "ml/AnjaliOldLipi.eot", |
| 31 | + ttf: "ml/AnjaliOldLipi.ttf", |
| 32 | + woff: "ml/AnjaliOldLipi.woff" |
| 33 | + }, |
| 34 | + Meera: { |
| 35 | + eot: "ml/Meera.eot", |
| 36 | + ttf: "ml/Meera.ttf", |
| 37 | + woff: "ml/Meera.woff", |
| 38 | + scale: 1.5, |
| 39 | + normalization: { |
| 40 | + "ൾ": "ള്", |
| 41 | + "ൻ": "ന്", |
| 42 | + "ർ": "ര്", |
| 43 | + "ൺ ": "ണ്", |
| 44 | + "ൽ": "ല്", |
| 45 | + "ൿ": "ക് ", |
| 46 | + "ൻറ": "ന്റ", |
| 47 | + "ന്റെ": "ന്റെ" |
| 48 | + } |
| 49 | + }, |
| 50 | + Rachana: { |
| 51 | + eot: "ml/Rachana.eot", |
| 52 | + ttf: "ml/Rachana.ttf", |
| 53 | + woff: "ml/Rachana.woff", |
| 54 | + normalization: { |
| 55 | + "ൾ": "ള്", |
| 56 | + "ൻ": "ന്", |
| 57 | + "ർ": "ര്", |
| 58 | + "ൺ ": "ണ്", |
| 59 | + "ൽ": "ല്", |
| 60 | + "ൿ": "ക് ", |
| 61 | + "ൻറ": "ന്റ", |
| 62 | + "ന്റെ": "ന്റെ" |
| 63 | + } |
| 64 | + }, |
| 65 | + RaghuMalayalam: { |
| 66 | + eot: "ml/RaghuMalayalam.eot", |
| 67 | + ttf: "ml/RaghuMalayalam.ttf", |
| 68 | + woff: "ml/RaghuMalayalam.woff", |
| 69 | + normalization: { |
| 70 | + "ൾ": "ള്", |
| 71 | + "ൻ": "ന്", |
| 72 | + "ർ": "ര്", |
| 73 | + "ൺ ": "ണ്", |
| 74 | + "ൽ": "ല്", |
| 75 | + "ൿ": "ക് ", |
| 76 | + "ൻറ": "ന്റ", |
| 77 | + "ന്റെ": "ന്റെ" |
| 78 | + } |
| 79 | + }, |
| 80 | + |
| 81 | + "Lohit Oriya": { |
| 82 | + eot: "or/Lohit-Oriya.eot", |
| 83 | + ttf: "or/Lohit-Oriya.ttf", |
| 84 | + woff: "or/Lohit-Oriya.woff" |
| 85 | + }, |
| 86 | + "Lohit Tamil": { |
| 87 | + eot: "ta/Lohit-Tamil.eot", |
| 88 | + ttf: "ta/Lohit-Tamil.ttf", |
| 89 | + woff: "ta/Lohit-Tamil.woff" |
| 90 | + }, |
| 91 | + |
| 92 | + "Lohit Telugu": { |
| 93 | + eot: "te/LohitTelugu.eot", |
| 94 | + ttf: "te/LohitTelugu.ttf", |
| 95 | + woff: "te/LohitTelugu.woff" |
| 96 | + }, |
| 97 | + |
| 98 | + "Lohit Bengali": { |
| 99 | + eot: "bn/LohitBengali.eot", |
| 100 | + ttf: "bn/LohitBengali.ttf", |
| 101 | + woff: "bn/LohitBengali.woff" |
| 102 | + }, |
| 103 | + |
| 104 | + "Samyak Gujarati": { |
| 105 | + eot: "gu/SamyakGujarati.eot", |
| 106 | + ttf: "gu/SamyakGujarati.ttf", |
| 107 | + woff: "gu/SamyakGujarati.woff" |
| 108 | + }, |
| 109 | + |
| 110 | + "Lohit Hindi": { |
| 111 | + eot: "hi/LohitHindi.eot", |
| 112 | + ttf: "hi/LohitHindi.ttf", |
| 113 | + woff: "hi/LohitHindi.woff" |
| 114 | + }, |
| 115 | + "Samyak Devanagari": { |
| 116 | + eot: "hi/SamyakDevanagari.eot", |
| 117 | + ttf: "hi/SamyakDevanagari.ttf", |
| 118 | + woff: "hi/SamyakDevanagari.woff" |
| 119 | + }, |
| 120 | + |
| 121 | + "Miriam CLM": { |
| 122 | + eot: "he/MiriamCLM-Book.eot", |
| 123 | + ttf: "he/MiriamCLM-Book.ttf", |
| 124 | + woff: "he/MiriamCLM-Book.woff" |
| 125 | + }, |
| 126 | + "Taamey Frank CLM": { |
| 127 | + eot: "he/TaameyFrankCLM.eot", |
| 128 | + ttf: "he/TaameyFrankCLM.ttf", |
| 129 | + woff: "he/TaameyFrankCLM.woff", |
| 130 | + svg: "he/TaameyFrankCLM.svg" |
| 131 | + }, |
| 132 | + |
| 133 | + Kedage: { |
| 134 | + eot: "kn/Kedage.eot", |
| 135 | + ttf: "kn/Kedage.ttf", |
| 136 | + woff: "kn/Kedage.woff" |
| 137 | + }, |
| 138 | + "Lohit Kannada": { |
| 139 | + eot: "kn/LohitKannada.eot", |
| 140 | + ttf: "kn/LohitKannada.ttf", |
| 141 | + woff: "kn/LohitKannada.woff" |
| 142 | + }, |
| 143 | + |
| 144 | + "Masterpiece Uni Sans": { |
| 145 | + eot: "my/MasterpieceUniSans.eot", |
| 146 | + ttf: "my/MasterpieceUniSans.ttf", |
| 147 | + woff: "my/MasterpieceUniSans.woff", |
| 148 | + svg: "my/MasterpieceUniSans.svg" |
| 149 | + }, |
| 150 | + "Padauk-Regular": { |
| 151 | + eot: "my/Padauk-Regular.eot", |
| 152 | + ttf: "my/Padauk-Regular.ttf", |
| 153 | + woff: "my/Padauk-Regular.woff", |
| 154 | + svg: "my/Padauk-Regular.svg" |
| 155 | + }, |
| 156 | + Myanmar3: { |
| 157 | + eot: "my/Myanmar3.eot", |
| 158 | + ttf: "my/Myanmar3.ttf", |
| 159 | + woff: "my/Myanmar3.woff", |
| 160 | + svg: "my/Myanmar3.svg" |
| 161 | + }, |
| 162 | + Yunghkio: { |
| 163 | + eot: "my/Yunghkio.eot", |
| 164 | + ttf: "my/Yunghkio.ttf", |
| 165 | + woff: "my/Yunghkio.woff", |
| 166 | + svg: "my/Yunghkio.svg" |
| 167 | + }, |
| 168 | + |
| 169 | + KhmerOSbattambang: { |
| 170 | + eot: "km/KhmerOSbattambang.eot", |
| 171 | + ttf: "km/KhmerOSbattambang.ttf", |
| 172 | + woff: "km/KhmerOSbattambang.woff", |
| 173 | + svg: "km/KhmerOSbattambang.svg" |
| 174 | + }, |
| 175 | + KhmerOSbokor: { |
| 176 | + eot: "km/KhmerOSbokor.eot", |
| 177 | + ttf: "km/KhmerOSbokor.ttf", |
| 178 | + woff: "km/KhmerOSbokor.woff", |
| 179 | + svg: "km/KhmerOSbokor.svg" |
| 180 | + }, |
| 181 | + KhmerOS: { |
| 182 | + eot: "km/KhmerOS.eot", |
| 183 | + ttf: "km/KhmerOS.ttf", |
| 184 | + woff: "km/KhmerOS.woff", |
| 185 | + svg: "km/KhmerOS.svg" |
| 186 | + }, |
| 187 | + KhmerOSsiemreap: { |
| 188 | + eot: "km/KhmerOSsiemreap.eot", |
| 189 | + ttf: "km/KhmerOSsiemreap.ttf", |
| 190 | + woff: "km/KhmerOSsiemreap.woff", |
| 191 | + svg: "km/KhmerOSsiemreap.svg" |
| 192 | + }, |
| 193 | + KhmerOSmuollight: { |
| 194 | + eot: "km/KhmerOSmuollight.eot", |
| 195 | + ttf: "km/KhmerOSmuollight.ttf", |
| 196 | + woff: "km/KhmerOSmuollight.woff", |
| 197 | + svg: "km/KhmerOSmuollight.svg" |
| 198 | + }, |
| 199 | + KhmerOSmuol: { |
| 200 | + eot: "km/KhmerOSmuol.eot", |
| 201 | + ttf: "km/KhmerOSmuol.ttf", |
| 202 | + woff: "km/KhmerOSmuol.woff", |
| 203 | + svg: "km/KhmerOSmuol.svg" |
| 204 | + }, |
| 205 | + KhmerOSmuolpali: { |
| 206 | + eot: "km/KhmerOSmuolpali.eot", |
| 207 | + ttf: "km/KhmerOSmuolpali.ttf", |
| 208 | + woff: "km/KhmerOSmuolpali.woff", |
| 209 | + svg: "km/KhmerOSmuolpali.svg" |
| 210 | + }, |
| 211 | + KhmerOSfreehand: { |
| 212 | + eot: "km/KhmerOSfreehand.eot", |
| 213 | + ttf: "km/KhmerOSfreehand.ttf", |
| 214 | + woff: "km/KhmerOSfreehand.woff", |
| 215 | + svg: "km/KhmerOSfreehand.svg" |
| 216 | + }, |
| 217 | + KhmerOSfasthand: { |
| 218 | + eot: "km/KhmerOSfasthand.eot", |
| 219 | + ttf: "km/KhmerOSfasthand.ttf", |
| 220 | + woff: "km/KhmerOSfasthand.woff", |
| 221 | + svg: "km/KhmerOSfasthand.svg" |
| 222 | + }, |
| 223 | + |
| 224 | + Pagul: { |
| 225 | + eot: "saz/Pagul.eot", |
| 226 | + ttf: "saz/Pagul.ttf", |
| 227 | + woff: "saz/Pagul.woff" |
| 228 | + }, |
| 229 | + AbyssinicaSIL: { |
| 230 | + eot: "gez/AbyssinicaSIL-R.eot", |
| 231 | + ttf: "gez/AbyssinicaSIL-R.ttf", |
| 232 | + woff: "gez/AbyssinicaSIL-R.woff" |
| 233 | + } |
| 234 | + }, |
| 235 | + |
| 236 | + languages: { |
| 237 | + // en: [ "RufScript", "Perizia", "Ubuntu" ], |
| 238 | + ml: [ "AnjaliOldLipi", "Meera", "Rachana", "RaghuMalayalam" ], |
| 239 | + or: [ "Lohit Oriya" ], |
| 240 | + ta: [ "Lohit Tamil" ], |
| 241 | + te: [ "Lohit Telugu" ], |
| 242 | + bn: [ "Lohit Bengali" ], |
| 243 | + as: [ "Lohit Bengali" ], |
| 244 | + gu: [ "Samyak Gujarati" ], |
| 245 | + hi: [ "Samyak Devanagari", "Lohit Hindi" ], |
| 246 | + mr: [ "Samyak Devanagari", "Lohit Hindi" ], |
| 247 | + ks: [ "Samyak Devanagari", "Lohit Hindi" ], |
| 248 | + he: [ "Miriam CLM", "Taamey Frank CLM" ], |
| 249 | + kn: [ "Kedage", "Lohit Kannada" ], |
| 250 | + my: [ "Masterpiece Uni Sans", "Padauk-Regular", "Myanmar3", "Yunghkio" ], |
| 251 | + km: [ "KhmerOSbattambang", "KhmerOSsiemreap", "KhmerOS", "KhmerOSbokor", |
| 252 | + "KhmerOSmuollight", "KhmerOSmuol", "KhmerOSmuolpali", |
| 253 | + "KhmerOSfreehand", "KhmerOSfasthand" ], |
| 254 | + saz: [ "Pagul" ], |
| 255 | + am: [ "AbyssinicaSIL" ], |
| 256 | + ti: [ "AbyssinicaSIL" ] |
| 257 | + } |
| 258 | + }; |
| 259 | +})(jQuery); |
\ No newline at end of file |
Property changes on: trunk/extensions/WebFonts/js/webfonts.fontlist.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 260 | + native |
Index: trunk/extensions/WebFonts/WebFonts.php |
— | — | @@ -32,11 +32,8 @@ |
33 | 33 | |
34 | 34 | // Register auto load for the page class |
35 | 35 | $wgAutoloadClasses['WebFontsHooks'] = "$dir/WebFonts.hooks.php"; |
36 | | -require_once( "$dir/WebFonts.config.php" ); |
37 | 36 | |
38 | 37 | $wgHooks['BeforePageDisplay'][] = 'WebFontsHooks::addModules'; |
39 | | -$wgHooks['ResourceLoaderGetConfigVars'][] = 'WebFontsHooks::addConfig'; |
40 | | -$wgHooks['MakeGlobalVariablesScript'][] = 'WebFontsHooks::addVariables'; |
41 | 38 | $wgHooks['GetPreferences'][] = 'WebFontsHooks::addPreference'; |
42 | 39 | |
43 | 40 | $wgWebFontsEnabled = true; |
— | — | @@ -47,4 +44,11 @@ |
48 | 45 | 'localBasePath' => dirname( __FILE__ ), |
49 | 46 | 'remoteExtPath' => 'WebFonts', |
50 | 47 | 'messages' => array( 'webfonts-load', 'webfonts-reset' ), |
| 48 | + 'dependencies' => 'webfonts.fontlist', |
51 | 49 | ); |
| 50 | + |
| 51 | +$wgResourceModules['webfonts.fontlist'] = array( |
| 52 | + 'scripts' => 'js/webfonts.fontlist.js', |
| 53 | + 'localBasePath' => dirname( __FILE__ ), |
| 54 | + 'remoteExtPath' => 'WebFonts', |
| 55 | +); |
Index: trunk/extensions/WebFonts/WebFonts.hooks.php |
— | — | @@ -9,49 +9,15 @@ |
10 | 10 | // WebFonts hooks |
11 | 11 | class WebFontsHooks { |
12 | 12 | |
13 | | - /* Functions */ |
14 | | - public static function addConfig( &$vars ) { |
15 | | - global $wgWebFontsEnabled; |
16 | | - global $wgUser; |
17 | | - if ( $wgUser->getOption( 'webfontsDisable' ) ) { |
18 | | - // User disabled WebFonts |
19 | | - return true; |
20 | | - } |
21 | | - $vars['wgWebFontsEnabled'] = $wgWebFontsEnabled; |
22 | | - return true; // Hooks must return value |
23 | | - } |
24 | | - |
25 | | - public static function addVariables( &$vars ) { |
26 | | - global $wgWebFonts, $wgLang; |
27 | | - $vars['wgWebFonts'] = (array)$wgWebFonts; |
28 | | - $vars['wgWebFontsAvailable'] = self::getSchemes(); // Note: scheme names must be keys, not values |
29 | | - return true; |
30 | | - } |
31 | | - |
32 | 13 | public static function addModules( $out, $skin ) { |
33 | 14 | global $wgUser; |
34 | | - if ( $wgUser->getOption( 'webfontsDisable' ) ) { |
35 | | - // User disabled WebFonts |
36 | | - return true; |
| 15 | + if ( !$wgUser->getOption( 'webfontsDisable' ) ) { |
| 16 | + $out->addModules( 'webfonts' ); |
37 | 17 | } |
38 | | - $out->addModules( 'webfonts' ); |
| 18 | + |
39 | 19 | return true; // Hooks must return value |
40 | 20 | } |
41 | 21 | |
42 | | - /** |
43 | | - * Get the available schemes for the user and content language |
44 | | - * @return array( scheme name => module name ) |
45 | | - */ |
46 | | - protected static function getSchemes() { |
47 | | - global $wgLanguageCode, $wgLang, $wgWebFonts; |
48 | | - $userlangCode = $wgLang->getCode(); |
49 | | - $contlangSchemes = isset( $wgWebFonts['languages'][$wgLanguageCode] ) ? |
50 | | - $wgWebFonts['languages'][$wgLanguageCode] : array(); |
51 | | - $userlangSchemes = isset( $wgWebFonts['languages'][$userlangCode] ) ? |
52 | | - $wgWebFonts['languages'][$userlangCode] : array(); |
53 | | - return $userlangSchemes + $contlangSchemes; |
54 | | - } |
55 | | - |
56 | 22 | public static function addPreference( $user, &$preferences ) { |
57 | 23 | // A checkbox in preferences to disable WebFonts |
58 | 24 | $preferences['webfontsDisable'] = array( |