r104662 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104661‎ | r104662 | r104663 >
Date:09:53, 30 November 2011
Author:santhosh
Status:ok
Tags:
Comment:
Add version number to the fonts and use that in the css. This enables us to push latest version of the font by overriding the cached version.

(i18n card #278)
Modified paths:
  • /trunk/extensions/WebFonts/resources/ext.webfonts.fontlist.js (modified) (history)
  • /trunk/extensions/WebFonts/resources/ext.webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/resources/ext.webfonts.js
@@ -104,12 +104,17 @@
105105 var fontconfig = mw.webfonts.config.fonts[fontFamily];
106106 var base = mw.config.get( 'wgExtensionAssetsPath' ) + '/WebFonts/fonts/';
107107 var fontFormats = [];
 108+ var version = "0.0";
 109+ if ( 'version' in fontconfig ) {
 110+ version = fontconfig.version;
 111+ }
 112+ var versionSuffix = "?version=" + version;
108113 var styleString =
109114 "<style type='text/css'>\n@font-face {\n"
110115 + "\tfont-family: '"+fontFamily+"';\n";
111116
112117 if ( 'eot' in fontconfig ) {
113 - styleString += "\tsrc: url('"+base+fontconfig.eot+"');\n";
 118+ styleString += "\tsrc: url('" + base+ fontconfig.eot + versionSuffix+ "');\n";
114119 }
115120
116121 styleString += "\tsrc: ";
@@ -122,15 +127,15 @@
123128 }
124129
125130 if ( 'woff' in fontconfig ) {
126 - fontFormats.push( "\t\turl('"+base+fontconfig.woff+"') format('woff')" );
 131+ fontFormats.push( "\t\turl('" + base + fontconfig.woff + versionSuffix + "') format('woff')" );
127132 }
128133
129134 if ( 'svg' in fontconfig ) {
130 - fontFormats.push( "\t\turl('"+base+fontconfig.svg+"#"+fontFamily+"') format('svg')" );
 135+ fontFormats.push( "\t\turl('" + base + fontconfig.svg + versionSuffix + "#" + fontFamily + "') format('svg')" );
131136 }
132137
133138 if ( 'ttf' in fontconfig ) {
134 - fontFormats.push( "\t\turl('"+base+fontconfig.ttf+"') format('truetype')" );
 139+ fontFormats.push( "\t\turl('" + base + fontconfig.ttf + versionSuffix + "') format('truetype')" );
135140 }
136141
137142 styleString += fontFormats.join() + ";\n"
Index: trunk/extensions/WebFonts/resources/ext.webfonts.fontlist.js
@@ -10,168 +10,194 @@
1111 "Iranian Sans": {
1212 eot: "Arab/IranianSans.eot",
1313 ttf: "Arab/IranianSans.ttf",
14 - woff: "Arab/IranianSans.woff"
 14+ woff: "Arab/IranianSans.woff",
 15+ version: "1.0"
1516 },
1617
1718 "Lohit Bengali": {
1819 eot: "Beng/Lohit-Bengali.eot",
1920 ttf: "Beng/Lohit-Bengali.ttf",
20 - woff: "Beng/Lohit-Bengali.woff"
 21+ woff: "Beng/Lohit-Bengali.woff",
 22+ version: "2.5.0"
2123 },
2224
2325 "Lohit Assamese": {
2426 eot: "Beng/Lohit-Assamese.eot",
2527 ttf: "Beng/Lohit-Assamese.ttf",
26 - woff: "Beng/Lohit-Assamese.woff"
 28+ woff: "Beng/Lohit-Assamese.woff",
 29+ version: "2.5.0"
2730 },
2831
2932 "Lohit Devanagari": {
3033 eot: "Deva/Lohit-Devanagari.eot",
3134 ttf: "Deva/Lohit-Devanagari.ttf",
32 - woff: "Deva/Lohit-Devanagari.woff"
 35+ woff: "Deva/Lohit-Devanagari.woff",
 36+ version: "2.5.0"
3337 },
3438
3539 "Samyak Devanagari": {
3640 eot: "Deva/SamyakDevanagari.eot",
3741 ttf: "Deva/SamyakDevanagari.ttf",
38 - woff: "Deva/SamyakDevanagari.woff"
 42+ woff: "Deva/SamyakDevanagari.woff",
 43+ version: "1.0"
3944 },
4045
4146 AbyssinicaSIL: {
4247 eot: "Ethi/AbyssinicaSIL-R.eot",
4348 ttf: "Ethi/AbyssinicaSIL-R.ttf",
44 - woff: "Ethi/AbyssinicaSIL-R.woff"
 49+ woff: "Ethi/AbyssinicaSIL-R.woff",
 50+ version: "1.2"
4551 },
4652
4753 "Lohit Gujarati": {
4854 eot: "Gujr/Lohit-Gujarati.eot",
4955 ttf: "Gujr/Lohit-Gujarati.ttf",
50 - woff: "Gujr/Lohit-Gujarati.woff"
 56+ woff: "Gujr/Lohit-Gujarati.woff",
 57+ version: "2.5.0"
5158 },
5259
5360 "Samyak Gujarati": {
5461 eot: "Gujr/SamyakGujarati.eot",
5562 ttf: "Gujr/SamyakGujarati.ttf",
56 - woff: "Gujr/SamyakGujarati.woff"
 63+ woff: "Gujr/SamyakGujarati.woff",
 64+ version: "1.0"
5765 },
5866
5967 "Miriam CLM": {
6068 eot: "Hebr/MiriamCLM-Book.eot",
6169 ttf: "Hebr/MiriamCLM-Book.ttf",
62 - woff: "Hebr/MiriamCLM-Book.woff"
 70+ woff: "Hebr/MiriamCLM-Book.woff",
 71+ version: "0.105"
6372 },
6473
6574 "Taamey Frank CLM": {
6675 eot: "Hebr/TaameyFrankCLM.eot",
6776 ttf: "Hebr/TaameyFrankCLM.ttf",
6877 woff: "Hebr/TaameyFrankCLM.woff",
69 - svg: "Hebr/TaameyFrankCLM.svg"
 78+ svg: "Hebr/TaameyFrankCLM.svg",
 79+ version: "0.110"
7080 },
7181
7282 KhmerOS: {
7383 eot: "Khmr/KhmerOS.eot",
7484 ttf: "Khmr/KhmerOS.ttf",
7585 woff: "Khmr/KhmerOS.woff",
76 - svg: "Khmr/KhmerOS.svg"
 86+ svg: "Khmr/KhmerOS.svg",
 87+ version: "1.10"
7788 },
7889
7990 KhmerOSbattambang: {
8091 eot: "Khmr/KhmerOSbattambang.eot",
8192 ttf: "Khmr/KhmerOSbattambang.ttf",
8293 woff: "Khmr/KhmerOSbattambang.woff",
83 - svg: "Khmr/KhmerOSbattambang.svg"
 94+ svg: "Khmr/KhmerOSbattambang.svg",
 95+ version: "1.10"
8496 },
8597
8698 KhmerOSbokor: {
8799 eot: "Khmr/KhmerOSbokor.eot",
88100 ttf: "Khmr/KhmerOSbokor.ttf",
89101 woff: "Khmr/KhmerOSbokor.woff",
90 - svg: "Khmr/KhmerOSbokor.svg"
 102+ svg: "Khmr/KhmerOSbokor.svg",
 103+ version: "1.10"
91104 },
92105
93106 KhmerOSfreehand: {
94107 eot: "Khmr/KhmerOSfreehand.eot",
95108 ttf: "Khmr/KhmerOSfreehand.ttf",
96109 woff: "Khmr/KhmerOSfreehand.woff",
97 - svg: "Khmr/KhmerOSfreehand.svg"
 110+ svg: "Khmr/KhmerOSfreehand.svg",
 111+ version: "1.10"
98112 },
99113
100114 KhmerOSfasthand: {
101115 eot: "Khmr/KhmerOSfasthand.eot",
102116 ttf: "Khmr/KhmerOSfasthand.ttf",
103117 woff: "Khmr/KhmerOSfasthand.woff",
104 - svg: "Khmr/KhmerOSfasthand.svg"
 118+ svg: "Khmr/KhmerOSfasthand.svg",
 119+ version: "1.10"
105120 },
106121
107122 KhmerOSmuol: {
108123 eot: "Khmr/KhmerOSmuol.eot",
109124 ttf: "Khmr/KhmerOSmuol.ttf",
110125 woff: "Khmr/KhmerOSmuol.woff",
111 - svg: "Khmr/KhmerOSmuol.svg"
 126+ svg: "Khmr/KhmerOSmuol.svg",
 127+ version: "1.10"
112128 },
113129
114130 KhmerOSmuollight: {
115131 eot: "Khmr/KhmerOSmuollight.eot",
116132 ttf: "Khmr/KhmerOSmuollight.ttf",
117133 woff: "Khmr/KhmerOSmuollight.woff",
118 - svg: "Khmr/KhmerOSmuollight.svg"
 134+ svg: "Khmr/KhmerOSmuollight.svg",
 135+ version: "1.10"
119136 },
120137
121138 KhmerOSmuolpali: {
122139 eot: "Khmr/KhmerOSmuolpali.eot",
123140 ttf: "Khmr/KhmerOSmuolpali.ttf",
124141 woff: "Khmr/KhmerOSmuolpali.woff",
125 - svg: "Khmr/KhmerOSmuolpali.svg"
 142+ svg: "Khmr/KhmerOSmuolpali.svg",
 143+ version: "1.10"
126144 },
127145
128146 KhmerOSsiemreap: {
129147 eot: "Khmr/KhmerOSsiemreap.eot",
130148 ttf: "Khmr/KhmerOSsiemreap.ttf",
131149 woff: "Khmr/KhmerOSsiemreap.woff",
132 - svg: "Khmr/KhmerOSsiemreap.svg"
 150+ svg: "Khmr/KhmerOSsiemreap.svg",
 151+ version: "1.10"
133152 },
134153
135154 Kedage: {
136155 eot: "Knda/Kedage.eot",
137156 ttf: "Knda/Kedage.ttf",
138 - woff: "Knda/Kedage.woff"
 157+ woff: "Knda/Kedage.woff",
 158+ version: "1.06"
139159 },
140160
141161 "Lohit Kannada": {
142162 eot: "Knda/Lohit-Kannada.eot",
143163 ttf: "Knda/Lohit-Kannada.ttf",
144 - woff: "Knda/Lohit-Kannada.woff"
 164+ woff: "Knda/Lohit-Kannada.woff",
 165+ version: "2.5.0"
145166 },
146167
147168 "Charis SIL": {
148169 eot: "Latn/CharisSIL-R.eot",
149170 ttf: "Latn/CharisSIL-R.ttf",
150 - woff: "Latn/CharisSIL-R.woff"
 171+ woff: "Latn/CharisSIL-R.woff",
 172+ version: "4.011"
151173 },
152174
153175 Perizia: {
154176 eot: "Latn/Perizia.eot",
155177 ttf: "Latn/Perizia.ttf",
156 - woff: "Latn/Perizia.woff"
 178+ woff: "Latn/Perizia.woff",
 179+ version: "0.1"
157180 },
158181
159182 RufScript: {
160183 eot: "Latn/Rufscript.eot",
161184 ttf: "Latn/Rufscript.ttf",
162 - woff: "Latn/Rufscript.woff"
 185+ woff: "Latn/Rufscript.woff",
 186+ version: "0.1"
163187 },
164188
165189 Ubuntu: {
166190 eot: "Latn/ubuntu-r-webfont.eot",
167191 ttf: "Latn/ubuntu-r.ttf",
168192 woff: "Latn/ubuntu-r-webfont.woff",
169 - svg: "Latn/ubuntu-r-webfont.svg"
 193+ svg: "Latn/ubuntu-r-webfont.svg",
 194+ version: "0.69"
170195 },
171196
172197 AnjaliOldLipi: {
173198 eot: "Mlym/AnjaliOldLipi.eot",
174199 ttf: "Mlym/AnjaliOldLipi.ttf",
175 - woff: "Mlym/AnjaliOldLipi.woff"
 200+ woff: "Mlym/AnjaliOldLipi.woff",
 201+ version: "0.730"
176202 },
177203
178204 Meera: {
@@ -187,7 +213,8 @@
188214 "ൿ": "ക്‍ ",
189215 "ൻ‍റ": "ന്റ",
190216 "ന്‍റെ": "ന്റെ"
191 - }
 217+ },
 218+ version: "4.5"
192219 },
193220
194221 Rachana: {
@@ -203,7 +230,8 @@
204231 "ൿ": "ക്‍ ",
205232 "ൻ‍റ": "ന്റ",
206233 "ന്‍റെ": "ന്റെ"
207 - }
 234+ },
 235+ version: "4.5"
208236 },
209237
210238 RaghuMalayalam: {
@@ -219,89 +247,103 @@
220248 "ൿ": "ക്‍ ",
221249 "ൻ‍റ": "ന്റ",
222250 "ന്‍റെ": "ന്റെ"
223 - }
 251+ },
 252+ version: "2.0"
224253 },
225254
226255 "Masterpiece Uni Sans": {
227256 eot: "Mymr/MasterpieceUniSans.eot",
228257 ttf: "Mymr/MasterpieceUniSans.ttf",
229258 woff: "Mymr/MasterpieceUniSans.woff",
230 - svg: "Mymr/MasterpieceUniSans.svg"
 259+ svg: "Mymr/MasterpieceUniSans.svg",
 260+ version: "0.5"
231261 },
232262
233263 Myanmar3: {
234264 eot: "Mymr/Myanmar3.eot",
235265 ttf: "Mymr/Myanmar3.ttf",
236266 woff: "Mymr/Myanmar3.woff",
237 - svg: "Mymr/Myanmar3.svg"
 267+ svg: "Mymr/Myanmar3.svg",
 268+ version: "3.0"
238269 },
239270
240271 "Padauk-Regular": {
241272 eot: "Mymr/Padauk-Regular.eot",
242273 ttf: "Mymr/Padauk-Regular.ttf",
243274 woff: "Mymr/Padauk-Regular.woff",
244 - svg: "Mymr/Padauk-Regular.svg"
 275+ svg: "Mymr/Padauk-Regular.svg",
 276+ version: "2.8"
245277 },
246278
247279 Yunghkio: {
248280 eot: "Mymr/Yunghkio.eot",
249281 ttf: "Mymr/Yunghkio.ttf",
250282 woff: "Mymr/Yunghkio.woff",
251 - svg: "Mymr/Yunghkio.svg"
 283+ svg: "Mymr/Yunghkio.svg",
 284+ version: "1.0"
252285 },
253286
254287 "Lohit Oriya": {
255288 eot: "Orya/Lohit-Oriya.eot",
256289 ttf: "Orya/Lohit-Oriya.ttf",
257 - woff: "Orya/Lohit-Oriya.woff"
 290+ woff: "Orya/Lohit-Oriya.woff",
 291+ version: "2.5.0"
258292 },
259293
260294 Utkal: {
261295 eot: "Orya/utkal.eot",
262296 ttf: "Orya/utkal.ttf",
263 - woff: "Orya/utkal.woff"
 297+ woff: "Orya/utkal.woff",
 298+ version: "0.13"
264299 },
265300
266301 Pagul: {
267302 eot: "Saur/Pagul.eot",
268303 ttf: "Saur/Pagul.ttf",
269 - woff: "Saur/Pagul.woff"
 304+ woff: "Saur/Pagul.woff",
 305+ version: "1.0"
270306 },
271307
272308 "Lohit Tamil": {
273309 eot: "Taml/Lohit-Tamil.eot",
274310 ttf: "Taml/Lohit-Tamil.ttf",
275 - woff: "Taml/Lohit-Tamil.woff"
 311+ woff: "Taml/Lohit-Tamil.woff",
 312+ version: "2.5.0"
276313 },
277314
278315 Thendral: {
279316 eot: "Taml/ThendralUni.eot",
280317 ttf: "Taml/ThendralUni.ttf",
281 - woff: "Taml/ThendralUni.woff"
 318+ woff: "Taml/ThendralUni.woff",
 319+ version: "1.0"
282320 },
283321
284322 Thenee: {
285323 eot: "Taml/TheneeUni.eot",
286324 ttf: "Taml/TheneeUni.ttf",
287 - woff: "Taml/TheneeUni.woff"
 325+ woff: "Taml/TheneeUni.woff",
 326+ version: "1.0"
288327 },
289328
290329 "Lohit Telugu": {
291330 eot: "Telu/Lohit-Telugu.eot",
292331 ttf: "Telu/Lohit-Telugu.ttf",
293 - woff: "Telu/Lohit-Telugu.woff"
 332+ woff: "Telu/Lohit-Telugu.woff",
 333+ version: "2.5.0"
294334 },
295335
296336 "Lohit Punjabi": {
297337 eot: "Guru/Lohit-Punjabi.eot",
298338 ttf: "Guru/Lohit-Punjabi.ttf",
299 - woff: "Guru/Lohit-Punjabi.woff"
 339+ woff: "Guru/Lohit-Punjabi.woff",
 340+ version: "2.5.0"
300341 },
301342
302343 "Saab": {
303344 eot: "Guru/Saab.eot",
304345 ttf: "Guru/Saab.ttf",
305 - woff: "Guru/Saab.woff"
 346+ woff: "Guru/Saab.woff",
 347+ version: "0.91"
306348 }
307349
308350 },

Status & tagging log