Annotation of loncom/html/adm/jsMath/plugins/smallFonts.js, revision 1.1

1.1     ! albertel    1: /*
        !             2:  *  smallFonts.js
        !             3:  *  
        !             4:  *  Part of the jsMath package for mathematics on the web.
        !             5:  *
        !             6:  *  This file changes the sizes of fonts used in subscripts so that they
        !             7:  *  are larger.  This can be helpful if jsMath is used on a page with a
        !             8:  *  small font size, where the subscripts may tend to disappear.
        !             9:  *  It should be loaded BEFORE jsMath.js.
        !            10:  *
        !            11:  *  ---------------------------------------------------------------------
        !            12:  *
        !            13:  *  Copyright 2006 by Davide P. Cervone
        !            14:  * 
        !            15:  *  Licensed under the Apache License, Version 2.0 (the "License");
        !            16:  *  you may not use this file except in compliance with the License.
        !            17:  *  You may obtain a copy of the License at
        !            18:  * 
        !            19:  *      http://www.apache.org/licenses/LICENSE-2.0
        !            20:  * 
        !            21:  *  Unless required by applicable law or agreed to in writing, software
        !            22:  *  distributed under the License is distributed on an "AS IS" BASIS,
        !            23:  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        !            24:  *  See the License for the specific language governing permissions and
        !            25:  *  limitations under the License.
        !            26:  */
        !            27: 
        !            28: if (!window.jsMath) {window.jsMath = {}}
        !            29: if (!jsMath.styles) {jsMath.styles = {}}
        !            30: if (!jsMath.Img) {jsMath.Img = {}}
        !            31: if (!jsMath.Box) {jsMath.Box = {}}
        !            32: if (!jsMath.Typeset) {jsMath.Typeset = {}}
        !            33: 
        !            34: /*
        !            35:  *  Replace the smaller font sizes
        !            36:  */
        !            37: jsMath.sizes = [70, 77, 85, 92, 100, 120, 144, 173, 207, 249];
        !            38: jsMath.Img.fonts = [70, 70, 85, 85, 100, 120, 144, 173, 207, 249, 298, 358, 430];
        !            39: 
        !            40: jsMath.styles['.typeset .size0'] = 'font-size: 70%';
        !            41: jsMath.styles['.typeset .size1'] = 'font-size: 77%';
        !            42: jsMath.styles['.typeset .size2'] = 'font-size: 85%';
        !            43: jsMath.styles['.typeset .size3'] = 'font-size: 92%';
        !            44: 
        !            45: /*
        !            46:  *  Fix multiplication factors in these routines
        !            47:  */
        !            48: jsMath.Typeset.StyleValue = function (style,v) {
        !            49:   if (style == "S" || style == "S'")   {return .85*v}
        !            50:   if (style == "SS" || style == "SS'") {return .70*v}
        !            51:   return v;
        !            52: };
        !            53: 
        !            54: jsMath.Box.DelimBestFit = function (H,c,font,style) {
        !            55:   if (c == 0 && font == 0) return null;
        !            56:   var C; var h; font = jsMath.TeX.fam[font];
        !            57:   var isSS = (style.charAt(1) == 'S');
        !            58:   var isS  = (style.charAt(0) == 'S');
        !            59:   while (c != null) {
        !            60:     C = jsMath.TeX[font][c];
        !            61:     if (C.h == null) {C.h = jsMath.Box.defaultH}; if (C.d == null) {C.d = 0}
        !            62:     h = C.h+C.d;
        !            63:     if (C.delim) {return [c,font,'',H]}
        !            64:     if (isSS && .70*h >= H) {return [c,font,'SS',.7*h]}
        !            65:     if (isS  && .85*h >= H) {return [c,font,'S',.85*h]}
        !            66:     if (h >= H || C.n == null) {return [c,font,'T',h]}
        !            67:     c = C.n;
        !            68:   }
        !            69:   return null;
        !            70: };

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>