r91815 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91814‎ | r91815 | r91816 >
Date:06:42, 10 July 2011
Author:santhosh
Status:resolved (Comments)
Tags:
Comment:
if we scale the $(body), interface is becoming wrong. Apply the font scaling, if present in configuration to selected nodes.
Modified paths:
  • /trunk/extensions/WebFonts/js/webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/js/webfonts.js
@@ -58,9 +58,12 @@
5959 //scale the font of the page. Scale is in percentage.
6060 // For example scale = 1.2 means scale the font by 120 percentage
6161 if ( 'scale' in config ) {
62 - $.webfonts.scale("body", config.scale);
 62+ $.webfonts.scale(config.scale);
6363 }
64 -
 64+ else{
 65+ $.webfonts.scale(1);
 66+ }
 67+
6568 if ( 'normalization' in config ) {
6669 $(document).ready(function() {
6770 $.webfonts.normalize(config.normalization);
@@ -86,14 +89,10 @@
8790
8891 /**
8992 * Scale the font of the page by given percentage
90 - * @param selecter CSS selector
9193 * @param percentage of scale. eg 1.2 for 120% scale
9294 */
93 - scale : function (selecter, percentage){
94 - $(selecter).each(function(i) {
95 - var currentSize = parseInt($(this).css("font-size"));
96 - $(this).css("font-size", Math.round( currentSize * percentage));
97 - });
 95+ scale : function (percentage){
 96+ $("p,li,h1,h2,h3,h4,h5,textarea,input").css('font-size', percentage + "em");
9897 },
9998
10099 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r94038Remove implementation of font-scale. Need to find a better way to achieve uni...santhosh06:14, 7 August 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   00:28, 12 July 2011

What about divs, definition lists, blockquotes, tables, and other things that aren't in that list?

#Comment by Santhosh.thottingal (talk | contribs)   06:19, 7 August 2011

There are some fonts which require scaling by applications. For example Malayalam font Meera relies on fontconfig(http://www.freedesktop.org/wiki/Software/fontconfig). The rules in fontconfig will say how much the font need to be scaled to match other fonts. More here- http://fedoraproject.org/wiki/Fontconfig_packaging_tips#Auto-scaling_problem_fonts. If we are not doing this scaling, the font will be small. But I am yet to figure out a way to do uniform scaling. I saw CSS3 @fontface specification mentioning about this. But it seems browsers are not supporting synthetic scaling of fonts- my bug report on mozilla bugzilla - https://bugzilla.mozilla.org/show_bug.cgi?id=675656 Changed the implementation of scale funcation as a TODO item in r94038 for now.

#Comment by Santhosh.thottingal (talk | contribs)   10:08, 16 August 2011

Changing to new since it is addressed in r94038

#Comment by Santhosh.thottingal (talk | contribs)   10:10, 16 August 2011

Changing to new since it is addressed in r94038

#Comment by Nikerabbit (talk | contribs)   11:10, 16 August 2011

Marking as resolved. Scaling is currently disabled until we figure out a way to do it that is good enough. That discussion doesn't need to be in here.

Status & tagging log