4 * Part of the jsMath package for mathematics on the web.
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.
11 * ---------------------------------------------------------------------
13 * Copyright 2006 by Davide P. Cervone
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
19 * http://www.apache.org/licenses/LICENSE-2.0
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.
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 = {}}
35 * Replace the smaller font sizes
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];
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%'};
46 * Fix multiplication factors in these routines
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}
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');
60 C = jsMath.TeX[font][c];
61 if (C.h == null) {C.h = jsMath.Box.defaultH}; if (C.d == null) {C.d = 0}
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]}