File:  [LON-CAPA] / loncom / html / adm / jsMath / plugins / smallFonts.js
Revision 1.1: download - view: text, annotated - select for diffs
Tue Oct 9 21:29:28 2007 UTC (16 years, 9 months ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_99_1, version_2_5_99_0, version_2_12_X, version_2_11_X, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, bz6209-base, bz6209, bz5969, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox, BZ4492-merge, BZ4492-feature_horizontal_radioresponse
- jsMath 3.4e

    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>