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

Revision: 97808
Author:   santhosh
Date:     2011-09-22 11:22:03 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Add support for loading the fonts based on lang attribute(If available and if 
the tag does not define its own font-family). Ref bug 29000.

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

Modified: trunk/extensions/WebFonts/js/webfonts.js
===================================================================
--- trunk/extensions/WebFonts/js/webfonts.js    2011-09-22 11:06:48 UTC (rev 
97807)
+++ trunk/extensions/WebFonts/js/webfonts.js    2011-09-22 11:22:03 UTC (rev 
97808)
@@ -183,6 +183,20 @@
                                        });
                                }
                        });
+                       
+                       //if there are tags with lang attribute, 
+                       $('body').find('*[lang]').each(function(index) {
+                               //check the availability of font.
+                               if(languages[this.lang]){
+                                       //add a font-family style if it does 
not have any
+                                       if( !this.style.fontFamily) {
+                                               //use the default font, ie the 
first one.
+                                               
fontFamilies.push(languages[this.lang][0]);
+                                               $(this).css('font-family', 
languages[this.lang][0]);
+                                       }
+                               }
+                       });
+                       
                        //get unique list
                        fontFamilies = $.unique(fontFamilies);
                        //load css for each of the item in fontfamily list


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

Reply via email to