File:  [LON-CAPA] / loncom / html / adm / jsMath / jsMath-BaKoMa-fonts.js
Revision 1.3: download - view: text, annotated - select for diffs
Tue Oct 9 21:29:16 2007 UTC (17 years, 1 month 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_msu, 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:  *  jsMath-BaKoMa-fonts.js
    3:  *  
    4:  *  Part of the jsMath package for mathematics on the web.
    5:  *
    6:  *  This file makes changes needed to use the BaKoMa fonts and
    7:  *  their encoding.
    8:  *
    9:  *  ---------------------------------------------------------------------
   10:  *
   11:  *  Copyright 2004-2007 by Davide P. Cervone
   12:  * 
   13:  *  Licensed under the Apache License, Version 2.0 (the "License");
   14:  *  you may not use this file except in compliance with the License.
   15:  *  You may obtain a copy of the License at
   16:  * 
   17:  *      http://www.apache.org/licenses/LICENSE-2.0
   18:  * 
   19:  *  Unless required by applicable law or agreed to in writing, software
   20:  *  distributed under the License is distributed on an "AS IS" BASIS,
   21:  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   22:  *  See the License for the specific language governing permissions and
   23:  *  limitations under the License.
   24:  */
   25: 
   26: 
   27: 
   28: /********************************************************************
   29:  *
   30:  *  The BaKoMa fonts have a different encoding, so change the characters
   31:  *  to correspond to the their encoding.
   32:  */
   33: 
   34: if (jsMath.browser == "Mozilla" && jsMath.platform != "mac") {
   35: 
   36:   /*
   37:    *  Mozilla/PC
   38:    */
   39:   jsMath.Update.TeXfontCodes({
   40:     cmr10: [
   41:       'Γ', 'Δ', 'Θ', 'Λ',
   42:       'Ξ', 'Π', 'Σ', 'Υ',
   43:       'Φ', 'Ψ', 'Ω', 'ff',
   44:       'fi', 'fl', 'ffi', 'ffl',
   45:       
   46:       'ı', '', '̀', '́',
   47:       '̌', '̆', '̅', '̊',
   48:       '̧', 'ß', 'æ', 'œ',
   49:       'ø', 'Æ', 'Œ', 'Ø',
   50:         
   51:       '̷', '!', '”', '#',
   52:       '$', '%', '&', ''',
   53:       '(', ')', '*', '+',
   54:       ',', '-', '.', '/', 
   55:         
   56:       '0', '1', '2', '3', '4', '5', '6', '7',
   57:       '8', '9', ':', ';', '¡', '=', '¿', '?',
   58:         
   59:       '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
   60:       'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
   61:       
   62:       'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
   63:       'X', 'Y', 'Z', '[', '“', ']', '̂', '̇',
   64:       
   65:       '‘', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
   66:       'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
   67:       
   68:       'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
   69:       'x', 'y', 'z', '–', '—', '̋', '̃', '̈'
   70:     ],
   71:       
   72:     cmmi10: [
   73:       'Γ', 'Δ', 'Θ', 'Λ',
   74:       'Ξ', 'Π', 'Σ', 'Υ',
   75:       'Φ', 'Ψ', 'Ω', 'α',
   76:       'β', 'γ', 'δ', 'ε',
   77:       
   78:       'ζ', 'η', 'θ', 'ι',
   79:       'κ', 'λ', 'μ', 'ν',
   80:       'ξ', 'π', 'ρ', 'σ',
   81:       'τ', 'υ', 'φ', 'χ',
   82:       
   83:       'ψ', 'ω', 'ɛ', 'ϑ',
   84:       'ϖ', 'ϱ', 'ς', 'ϕ',
   85:       '↼', '↽', '⇀', '⇁',
   86:       '', '', '▹', '◃',
   87:       
   88:       '0', '1', '2', '3', '4', '5', '6', '7',
   89:       '8', '9', '.', ',', '<', '/', '>', '⋆',
   90:       
   91:       '∂', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
   92:       'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
   93:         
   94:       'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
   95:       'X', 'Y', 'Z', '♭', '♮', '♯', '⌣', '⌢',
   96:       
   97:       'ℓ', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
   98:       'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
   99:       
  100:       'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
  101:       'x', 'y', 'z', 'ı', '', '℘', '⃗', '̑'
  102:     ],
  103:       
  104:     cmsy10: [
  105:       '−', '·',   '×',   '⋆',
  106:       '÷',   '⋄', '±',   '∓',
  107:       '⊕', '⊖', '⊗', '⊘',
  108:       '⊙', '○', '∘', '∙',
  109:       
  110:       '≃', '≍', '⊆', '⊇',
  111:       '≤', '≥', '≼', '≽',
  112:       '∼', '≅', '⊂', '⊃',
  113:       '≪', '≫', '≺', '≻',
  114:       
  115:       '←', '→', '↑', '↓',
  116:       '↔', '↗', '↘', '≂',
  117:       '⇐', '⇒', '⇑', '⇓', 
  118:       '⇔', '↖', '↙', '∝',
  119:       
  120:       '′', '∞', '∈', '∋',
  121:       '△', '▽', '̸',  '', 
  122:       '∀', '∃', '¬',   '∅',
  123:       'ℜ', 'ℑ', '⊤', '⊥',
  124:       
  125:       'ℵ', '', 'ℬ', '',
  126:       '', 'ℰ', 'ℱ', '',
  127:       'ℋ', 'ℐ', '', '',
  128:       'ℒ', 'ℳ', '', '',
  129:       
  130:       '', '', 'ℛ', '',
  131:       '', '', '', '',
  132:       '', '', '', '∪',
  133:       '∩', '⊎', '∧', '∨',
  134:       
  135:       '⊢', '⊣', '⌊', '⌋',
  136:       '⌈', '⌉', '{',   '}',
  137:       '〈', '〉', '∣', '∥',
  138:       '↕', '⇕', '∖', '≀',
  139:       
  140:       '√', '∐', '∇', '∫', 
  141:       '⊔', '⊓', '⊑', '⊒',
  142:       '§',   '†', '‡', '¶',
  143:       '♣', '♢', '♡', '♠'
  144:     ],
  145:       
  146:     cmex10: [
  147:       '', '', '', '',
  148:       '', '', '', '',
  149:       '', '', '', '',
  150:       '', '', '', '',
  151: 
  152:       '', '', '', '',
  153:       '', '', '', '',
  154:       '', '', '', '',
  155:       '', '', '', '',
  156:       
  157:       '', '', '', '',
  158:       '', '', '', '',
  159:       '', '', '', '', 
  160:       '', '', '', '',
  161:         
  162:       '', '', '', '',
  163:       '', '', '', '',
  164:       '', '', '', '',
  165:       '', '', '', '',
  166:       
  167:       '', '', '', '',
  168:       '', '', '', '',
  169:       '', '', '', '',
  170:       '', '', '', '',
  171:       
  172:       '', '', '', '',
  173:       '', '', '', '',
  174:       '', '', '', '',
  175:       '', '', '', '',
  176:       
  177:       '', '', '', '',
  178:       '', '', '', '',
  179:       '', '', '', '',
  180:       '', '', '', '',
  181:       
  182:       '', '', '', '',
  183:       '', '', '', '',
  184:       '', '', '', '',
  185:       '', '', '', ''
  186:     ]
  187:   });
  188:     
  189:   /*
  190:    *  Adjust a few other characters as well
  191:    */
  192:     
  193:   jsMath.Update.TeXfonts({
  194:     cmr10:  {'20': {c: 'ˇ', tclass: 'normal', w: .3}},
  195:     cmmi10: {
  196:       '20': {c: '<i>&kappa</i>', tclass: 'normal'},
  197:       '58': {c: '.', tclass: 'normal'},
  198:       '59': {c: ',', tclass: 'normal'},
  199:       '61': {c: '&#x2F;', tclass: 'cmr10'}
  200:     },
  201:     cmsy10: {
  202:       '3':  {c: '*', tclass: 'normal'},
  203:       '16': {c: '&#x224D;'},
  204:       '17': {c: '&equiv;', tclass: 'normal'},
  205:       '25': {c: '&#x2248;', tclass: 'normal'},
  206:       '39': {c: '&#x2243;'},
  207:       '20': {c: '&le;', tclass: 'normal'}
  208:     },
  209:     cmex10: {'20': {c: '<span style="font-size: 80%">&#xEFBD;</span>'}},
  210:     cmti10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
  211:     cmbx10: {'10': {c: '<b>&Omega;</b>', tclass: 'normal'}}
  212:   });
  213:     
  214: } else {
  215:   
  216:   jsMath.Font.BaKoMa = [
  217:     '&#xA1;', '&#xA2;', '&#xA3;', '&#xA4;', '&#xA5;', '&#xA6;', '&#xA7;', '&#xA8;',
  218:     '&#xA9;', '&#xAA;', '&#xAD;', '&#xAE;', '&#xAF;', '&#xB0;', '&#xB1;', '&#xB2;',
  219: 
  220:     '&#xB3;', '&#xB4;', '&#xB5;', '&#xB6;', '&#x2219;', '&#xB8;', '&#xB9;', '&#xBA;',
  221:     '&#xBB;', '&#xBC;', '&#xBD;', '&#xBE;', '&#xBF;', '&#xC0;', '&#xC1;', '&#xC2;',
  222: 
  223:     '&#xC3;', '!', '"', '#', '$', '%', '&#x26;', '\'', 
  224:     '(', ')', '*', '+', ',', '-', '.', '/', 
  225: 
  226:     '0', '1', '2', '3', '4', '5', '6', '7',
  227:     '8', '9', ':', ';', '&#x3C;', '=', '&#x3E;', '?',
  228: 
  229:     '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  230:     'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
  231: 
  232:     'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
  233:     'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
  234: 
  235:     '&#x60;', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
  236:     'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
  237: 
  238:     'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
  239:     'x', 'y', 'z', '&#x7B;', '&#x7C;', '&#x7D;', '&#x7E;', '&#xC4;'
  240:   ];
  241: 
  242:   jsMath.Update.TeXfontCodes({
  243:     cmr10:  jsMath.Font.BaKoMa,
  244:     cmmi10: jsMath.Font.BaKoMa,
  245:     cmsy10: jsMath.Font.BaKoMa,
  246:     cmex10: jsMath.Font.BaKoMa,
  247:     cmti10: jsMath.Font.BaKoMa,
  248:     cmbx10: jsMath.Font.BaKoMa
  249:   });
  250:   
  251:   /*
  252:    *  MSIE corrections
  253:    */
  254:   switch (jsMath.browser) {
  255:     
  256:     case "MSIE":
  257:       if (jsMath.platform == "pc") {
  258:         /*
  259:          *  MSIE/PC
  260:          */
  261:         jsMath.Browser.msieFontBug = 1;
  262:         jsMath.Update.TeXfonts({
  263:           cmr10:  {'10': {c: '&Omega;', tclass: 'normal'}},
  264:           cmmi10: {
  265:             '10':  {c: '<i>&Omega;</i>', tclass: 'normal'},
  266:             '126': {c: '&#x7E;<span style="margin-left:.1em"></span>'}
  267:           },
  268:           cmsy10: {
  269:             '10': {c: '&#x2297;', tclass: 'arial'},
  270:             '55': {c: '<span style="margin-right:-.54em">7</span>'}
  271:           },
  272:           cmex10: {'10': {c: '<span style="font-size: 67%">D</span>'}},
  273:           cmti10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
  274:           cmbx10: {'10': {c: '<b>&Omega;</b>', tclass: 'normal'}}
  275:         });
  276:       } else {
  277:         /*
  278:          *  MSIE/Mac
  279:          */
  280:         jsMath.Update.TeXfonts({
  281:           
  282:           cmr10: {
  283:             '3':  {c: '<font face="Symbol">L</font>', tclass: 'normal'},
  284:             '5':  {c: '<font face="Symbol">P</font>', tclass: 'normal'},
  285:             '10': {c: '<font face="Symbol">W</font>', tclass: 'normal'},
  286:             '15': {c: 'ffl', tclass: 'normal'},
  287:             '16': {c: '&#x0131;', tclass: 'normal'},
  288:             '20': {c: '&#x02C7;', tclass: 'normal'},
  289:             '22': {c: '&#xAF;', tclass: 'normal', w: .3},
  290:             '25': {c: '&#xDF;', tclass: 'normal'},
  291:             '26': {c: '&#xE6;', tclass: 'normal'},
  292:             '27': {c: '&#x153;', tclass: 'normal'}
  293:           },
  294:           
  295:           cmmi10: {
  296:             '3':  {c: '<font face="Symbol">L</font>', tclass: 'italic'},
  297:             '5':  {c: '<font face="Symbol">P</font>', tclass: 'italic'},
  298:             '10': {c: '<font face="Symbol">W</font>', tclass: 'italic'},
  299:             '15': {c: '<font face="Symbol">e</font>', tclass: 'italic'},
  300:             '16': {c: '<font face="Symbol">z</font>', tclass: 'italic'},
  301:             '20': {c: '<font face="Symbol">k</font>', tclass: 'italic'},
  302:             '22': {c: '<font face="Symbol">m</font>', tclass: 'italic'},
  303:             '25': {c: '<font face="Symbol">p</font>', tclass: 'italic'},
  304:             '26': {c: '<font face="Symbol">r</font>', tclass: 'italic'},
  305:             '27': {c: '<font face="Symbol">s</font>', tclass: 'italic'}
  306:           },
  307:           
  308:           cmsy10: {
  309:             '3':  {c: '<span style="vertical-align:-.3em">*</span>', tclass: 'normal'},
  310:             '5':  {c: '&#x389;', tclass: 'normal'},
  311:             '10': {c: '&otimes;', tclass: 'normal'},
  312:             '15': {c: '&#x2022;', tclass: 'normal'},
  313:             '16': {c: '&#x224D;', tclass: 'normal'},
  314:             '20': {c: '&le;', tclass: 'normal'},
  315:             '22': {c: '&le;', tclass: 'normal'},
  316:             '25': {c: '&#x2248;', tclass: 'normal'},
  317:             '26': {c: '<font face="Symbol">&#xCC;</font>', tclass: 'normal'},
  318:             '27': {c: '<font face="Symbol">&#xC9;</font>', tclass: 'normal'}
  319:           },
  320:           
  321:           cmex10: {
  322:             '3':  {c: '<span style="font-size: 67%">&#x69;</span>'},
  323:             '5':  {c: '<span style="font-size: 67%">&#x6B;</span>'},
  324:             '10': {c: '<span style="font-size: 67%">&#x44;</span>'},
  325:             '15': {c: '<span style="font-size: 55%">&#xC2;</span>'},
  326:             '16': {c: '<span style="font-size: 83%">&#xB5;</span>'},
  327:             '20': {c: '<span style="font-size: 83%">"</span>'},
  328:             '22': {c: '<span style="font-size: 83%">$</span>'},
  329:             '25': {c: '<span style="font-size: 83%">\'</span>'},
  330:             '26': {c: '<span style="font-size: 83%">(</span>'},
  331:             '27': {c: '<span style="font-size: 83%">)</span>'}
  332:           },
  333:           
  334:           cmti10: {
  335:             '3':  {c: '<font face="Symbol">L</font>', tclass: 'italic'},
  336:             '5':  {c: '<font face="Symbol">P</font>', tclass: 'italic'},
  337:             '10': {c: '<font face="Symbol">W</font>', tclass: 'italic'},
  338:             '16': {c: '&#x0131;', tclass: 'italic'},
  339:             '20': {c: '&#xAD;', tclass: 'italic'},
  340:             '22': {c: '&#xAF;', tclass: 'italic', w: .3},
  341:             '25': {c: '&#xDF;', tclass: 'italic'},
  342:             '26': {c: '&#xE6;', tclass: 'italic'},
  343:             '27': {c: '&#x153;', tclass: 'italic'}
  344:           },
  345:           
  346:           cmbx10: {
  347:             '3':  {c: '<font face="Symbol">L</font>', tclass: 'bold'},
  348:             '5':  {c: '<font face="Symbol">P</font>', tclass: 'bold'},
  349:             '10': {c: '<font face="Symbol">W</font>', tclass: 'bold'},
  350:             '16': {c: '&#x0131;', tclass: 'bold'},
  351:             '20': {c: '&#xAD;', tclass: 'bold'},
  352:             '22': {c: '&#xAF;', tclass: 'bold', w: .3},
  353:             '25': {c: '&#xDF;', tclass: 'bold'},
  354:             '26': {c: '&#xE6;', tclass: 'bold'},
  355:             '27': {c: '&#x153;', tclass: 'bold'}
  356:           }
  357:         });
  358:       }
  359:       break;
  360:       
  361:     case "Mozilla":
  362:       if (jsMath.platform == "mac") {
  363:         /*
  364:          *  Mozilla/Mac
  365:          */
  366:         jsMath.Update.TeXfonts({
  367:           cmr10:  {'10': {c: '&Omega;', tclass: 'normal'}},
  368:           cmmi10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
  369:           cmsy10: {'10': {c: '&otimes;', tclass: 'normal'}},
  370:           cmex10: {'10': {c: '<span style="font-size: 67%">D</span>'}},
  371:           cmti10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
  372:           cmbx10: {'10': {c: '<b>&Omega;</b>', tclass: 'normal'}}
  373:         });
  374:       }
  375:       break;
  376: 
  377:     case "Opera":
  378:       jsMath.Update.TeXfonts({
  379:         cmr10:  {
  380:           '10': {c: '&Omega;', tclass: 'normal'},
  381:           '20': {c: '&#x2C7;', tclass: 'normal'}
  382:         },
  383:         cmmi10: {
  384:           '10': {c: '<i>&Omega;</i>', tclass: 'normal'},
  385:           '20': {c: '&kappa;', tclass: 'normal'}
  386:         },
  387:         cmsy10: {
  388:           '10': {c: '&otimes;', tclass: 'normal'},
  389:           '20': {c: '&#x2264;', tclass: 'normal'}
  390:         },
  391:         cmex10: {
  392:           '10': {c: '<span style="font-size: 67%">D</span>'},
  393:           '20': {c: '<span style="font-size: 82%">"</span>'}
  394:         },
  395:         cmti10: {
  396:           '10': {c: '<i>&Omega;</i>', tclass: 'normal'},
  397:           '20': {c: '<i>&#x2C7;</i>', tclass: 'normal'}
  398:         },
  399:         cmbx10: {
  400:           '10': {c: '<b>&Omega;</b>', tclass: 'normal'},
  401:           '20': {c: '<b>&#x2C7;</b>', tclass: 'normal'}
  402:         }
  403:       });
  404:       break;
  405:       
  406:     case "Konqueror":
  407:       jsMath.Update.TeXfonts({
  408:         cmr10:  {'20': {c: '&#x2C7;', tclass: 'normal'}},
  409:         cmmi10: {'20': {c: '&kappa;', tclass: 'normal'}},
  410:         cmsy10: {'20': {c: '&#x2264;', tclass: 'normal'}},
  411:         cmex10: {'20': {c: '<span style="font-size: 84%">"</span>'}},
  412:         cmti10: {'20': {c: '<i>&#x2C7;</i>', tclass: 'normal'}},
  413:         cmbx10: {'20': {c: '<b>&#x2C7;</b>', tclass: 'normal'}}
  414:       });
  415:       break;
  416:   }
  417: 
  418: }
  419: 
  420: jsMath.Setup.Styles({
  421:   '.typeset .cmr10':  'font-family: cmr10, serif',
  422:   '.typeset .cmbx10': 'font-family: cmbx10, cmr10',
  423:   '.typeset .cmti10': 'font-family: cmti10, cmr10',
  424:   '.typeset .cmmi10': 'font-family: cmmi10',
  425:   '.typeset .cmsy10': 'font-family: cmsy10',
  426:   '.typeset .cmex10': 'font-family: cmex10',
  427:   '.typeset .arial':  "font-family: 'Arial unicode MS'"
  428: });

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