/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/jax/output/HTML-CSS/imageFonts.js * * Implements the image fallback fonts for the HTML-CSS OutputJax. * * --------------------------------------------------------------------- * * Copyright (c) 2009-2013 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */(function(l,d,k){l.Register.LoadHook(d.fontDir+"/fontdata.js",function(){d.Augment({allowWebFonts:!1,imgDir:d.webfontDir+"/png",imgPacked:MathJax.isPacked?"":"/unpacked",imgSize:["050","060","071","085",100,120,141,168,200,238,283,336,400,476],imgBaseIndex:4,imgSizeForEm:{},imgSizeForScale:{},imgZoom:1,handleImg:function(a,c,b,e,d){d.length&&this.addText(a,d);var g=b[5].orig;g||(g=b[5].orig=[b[0],b[1],b[2],b[3],b[4]]);d=this.imgZoom;a.scale||(a.scale=1);var f=this.imgIndex(a.scale*d);f==this.imgEmWidth.length-1&&1.1e.length;)e="0"+e;e=c+"/"+e+".png";f=b[5].img[f];c={width:Math.floor(f[0]/d+.5)+"px",height:Math.floor(f[1]/d+.5)+"px"};f[2]&&(c.verticalAlign=Math.floor(-f[2]/d+.5)+"px");0>b[3]&&(c.marginLeft=this.Em(b[3]/1E3));b[4]!=b[2]&&(c.marginRight=this.Em((b[2]-b[4])/1E3));this.msieIE6&&(c.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src\x3d'"+k.fileURL(e)+"', sizingMethod\x3d'scale')",e=this.directory+"/blank.gif");this.addElement(a,"img",{src:k.fileURL(e),style:c,isMathJax:!0});return""},defineImageData:function(a){for(var c in a)if(a.hasOwnProperty(c)){var b=d.FONTDATA.FONTS[c];if(b){c=a[c];for(var e in c)c.hasOwnProperty(e)&&b[e]&&(b[e][5]={img:c[e]})}}},initImg:function(a){this.imgSizeForEm[this.em]&&(this.imgBaseIndex=this.imgSizeForEm[this.em]);a=0;for(var c=this.imgEmWidth.length-1;athis.em-this.imgEmWidth[a-1]&&a--;this.imgSizeForEm[this.em]=this.imgBaseIndex=a;this.imgZoom=this.imgBrowserZoom()},imgIndex:function(a){if(!a)return this.imgBaseIndex;this.imgSizeForScale[this.em]||(this.imgSizeForScale[this.em]={});if(this.imgSizeForScale[this.em][a])return this.imgSizeForScale[this.em][a];for(var c=this.em*a,b=0,d=this.imgEmWidth.length-1;bc-this.imgEmWidth[b-1]&&b--;return this.imgSizeForScale[this.em][a]=b},imgBrowserZoom:function(){return 1}});l.Browser.Select({Firefox:function(a){var c=d.addElement(document.body,"div",{style:{display:"none",visibility:"hidden",overflow:"scroll",position:"absolute",top:0,left:0,width:"200px",height:"200px",padding:0,border:0,margin:0}}),b=d.addElement(c,"div",{style:{position:"absolute",left:0,top:0,right:0,bottom:0,padding:0,border:0,margin:0}});d.Augment({imgSpaceBug:!0,imgSpace:"\u00a0",imgZoomLevel:a.isMac?{50:.3,30:.5,22:.67,19:.8,16:.9,15:1,13:1.1,12:1.2,11:1.33,10:1.5,9:1.7,7:2,6:2.4,5:3,0:15}:{56:.3,34:.5,25:.67,21:.8,19:.9,17:1,15:1.1,14:1.2,13:1.33,11:1.5,10:1.7,8:2,7:2.4,6:3,0:17},imgZoomDiv:c,imgBrowserZoom:function(){var a=this.imgZoomLevel;c.style.display="";var d=c.offsetWidth-b.offsetWidth,d=a[d]?a[d]:a[0]/d;c.style.display="none";return d}})},Safari:function(a){d.Augment({imgBrowserZoom:function(){return 3}})},Chrome:function(a){d.Augment({imgHeightBug:!0,imgBrowserZoom:function(){return 3}})},Opera:function(a){d.Augment({imgSpaceBug:!0,imgSpace:"\u00a0\u00a0",imgDoc:"BackCompat"==document.compatMode?document.body:document.documentElement,imgBrowserZoom:function(){if(a.isMac)return 3;var c=this.imgDoc.clientHeight,b=Math.floor(15*c/window.innerHeight);this.imgDoc.clientWidth