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 (16 years, 7 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_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

/*
 *  jsMath-BaKoMa-fonts.js
 *  
 *  Part of the jsMath package for mathematics on the web.
 *
 *  This file makes changes needed to use the BaKoMa fonts and
 *  their encoding.
 *
 *  ---------------------------------------------------------------------
 *
 *  Copyright 2004-2007 by Davide P. Cervone
 * 
 *  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.
 */



/********************************************************************
 *
 *  The BaKoMa fonts have a different encoding, so change the characters
 *  to correspond to the their encoding.
 */

if (jsMath.browser == "Mozilla" && jsMath.platform != "mac") {

  /*
   *  Mozilla/PC
   */
  jsMath.Update.TeXfontCodes({
    cmr10: [
      'Γ', 'Δ', 'Θ', 'Λ',
      'Ξ', 'Π', 'Σ', 'Υ',
      'Φ', 'Ψ', 'Ω', 'ff',
      'fi', 'fl', 'ffi', 'ffl',
      
      'ı', '', '̀', '́',
      '̌', '̆', '̅', '̊',
      '̧', 'ß', 'æ', 'œ',
      'ø', 'Æ', 'Œ', 'Ø',
        
      '̷', '!', '”', '#',
      '$', '%', '&', ''',
      '(', ')', '*', '+',
      ',', '-', '.', '/', 
        
      '0', '1', '2', '3', '4', '5', '6', '7',
      '8', '9', ':', ';', '¡', '=', '¿', '?',
        
      '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
      'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
      
      'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
      'X', 'Y', 'Z', '[', '“', ']', '̂', '̇',
      
      '‘', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
      'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
      
      'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
      'x', 'y', 'z', '–', '—', '̋', '̃', '̈'
    ],
      
    cmmi10: [
      'Γ', 'Δ', 'Θ', 'Λ',
      'Ξ', 'Π', 'Σ', 'Υ',
      'Φ', 'Ψ', 'Ω', 'α',
      'β', 'γ', 'δ', 'ε',
      
      'ζ', 'η', 'θ', 'ι',
      'κ', 'λ', 'μ', 'ν',
      'ξ', 'π', 'ρ', 'σ',
      'τ', 'υ', 'φ', 'χ',
      
      'ψ', 'ω', 'ɛ', 'ϑ',
      'ϖ', 'ϱ', 'ς', 'ϕ',
      '↼', '↽', '⇀', '⇁',
      '', '', '▹', '◃',
      
      '0', '1', '2', '3', '4', '5', '6', '7',
      '8', '9', '.', ',', '<', '/', '>', '⋆',
      
      '∂', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
      'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
        
      'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
      'X', 'Y', 'Z', '♭', '♮', '♯', '⌣', '⌢',
      
      'ℓ', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
      'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
      
      'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
      'x', 'y', 'z', 'ı', '', '℘', '⃗', '̑'
    ],
      
    cmsy10: [
      '−', '·',   '×',   '⋆',
      '÷',   '⋄', '±',   '∓',
      '⊕', '⊖', '⊗', '⊘',
      '⊙', '○', '∘', '∙',
      
      '≃', '≍', '⊆', '⊇',
      '≤', '≥', '≼', '≽',
      '∼', '≅', '⊂', '⊃',
      '≪', '≫', '≺', '≻',
      
      '←', '→', '↑', '↓',
      '↔', '↗', '↘', '≂',
      '⇐', '⇒', '⇑', '⇓', 
      '⇔', '↖', '↙', '∝',
      
      '′', '∞', '∈', '∋',
      '△', '▽', '̸',  '', 
      '∀', '∃', '¬',   '∅',
      'ℜ', 'ℑ', '⊤', '⊥',
      
      'ℵ', '', 'ℬ', '',
      '', 'ℰ', 'ℱ', '',
      'ℋ', 'ℐ', '', '',
      'ℒ', 'ℳ', '', '',
      
      '', '', 'ℛ', '',
      '', '', '', '',
      '', '', '', '∪',
      '∩', '⊎', '∧', '∨',
      
      '⊢', '⊣', '⌊', '⌋',
      '⌈', '⌉', '{',   '}',
      '〈', '〉', '∣', '∥',
      '↕', '⇕', '∖', '≀',
      
      '√', '∐', '∇', '∫', 
      '⊔', '⊓', '⊑', '⊒',
      '§',   '†', '‡', '¶',
      '♣', '♢', '♡', '♠'
    ],
      
    cmex10: [
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',

      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      
      '', '', '', '',
      '', '', '', '',
      '', '', '', '', 
      '', '', '', '',
        
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      
      '', '', '', '',
      '', '', '', '',
      '', '', '', '',
      '', '', '', ''
    ]
  });
    
  /*
   *  Adjust a few other characters as well
   */
    
  jsMath.Update.TeXfonts({
    cmr10:  {'20': {c: 'ˇ', tclass: 'normal', w: .3}},
    cmmi10: {
      '20': {c: '<i>&kappa</i>', tclass: 'normal'},
      '58': {c: '.', tclass: 'normal'},
      '59': {c: ',', tclass: 'normal'},
      '61': {c: '&#x2F;', tclass: 'cmr10'}
    },
    cmsy10: {
      '3':  {c: '*', tclass: 'normal'},
      '16': {c: '&#x224D;'},
      '17': {c: '&equiv;', tclass: 'normal'},
      '25': {c: '&#x2248;', tclass: 'normal'},
      '39': {c: '&#x2243;'},
      '20': {c: '&le;', tclass: 'normal'}
    },
    cmex10: {'20': {c: '<span style="font-size: 80%">&#xEFBD;</span>'}},
    cmti10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
    cmbx10: {'10': {c: '<b>&Omega;</b>', tclass: 'normal'}}
  });
    
} else {
  
  jsMath.Font.BaKoMa = [
    '&#xA1;', '&#xA2;', '&#xA3;', '&#xA4;', '&#xA5;', '&#xA6;', '&#xA7;', '&#xA8;',
    '&#xA9;', '&#xAA;', '&#xAD;', '&#xAE;', '&#xAF;', '&#xB0;', '&#xB1;', '&#xB2;',

    '&#xB3;', '&#xB4;', '&#xB5;', '&#xB6;', '&#x2219;', '&#xB8;', '&#xB9;', '&#xBA;',
    '&#xBB;', '&#xBC;', '&#xBD;', '&#xBE;', '&#xBF;', '&#xC0;', '&#xC1;', '&#xC2;',

    '&#xC3;', '!', '"', '#', '$', '%', '&#x26;', '\'', 
    '(', ')', '*', '+', ',', '-', '.', '/', 

    '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', ':', ';', '&#x3C;', '=', '&#x3E;', '?',

    '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
    'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',

    'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
    'X', 'Y', 'Z', '[', '\\', ']', '^', '_',

    '&#x60;', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
    'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',

    'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
    'x', 'y', 'z', '&#x7B;', '&#x7C;', '&#x7D;', '&#x7E;', '&#xC4;'
  ];

  jsMath.Update.TeXfontCodes({
    cmr10:  jsMath.Font.BaKoMa,
    cmmi10: jsMath.Font.BaKoMa,
    cmsy10: jsMath.Font.BaKoMa,
    cmex10: jsMath.Font.BaKoMa,
    cmti10: jsMath.Font.BaKoMa,
    cmbx10: jsMath.Font.BaKoMa
  });
  
  /*
   *  MSIE corrections
   */
  switch (jsMath.browser) {
    
    case "MSIE":
      if (jsMath.platform == "pc") {
        /*
         *  MSIE/PC
         */
        jsMath.Browser.msieFontBug = 1;
        jsMath.Update.TeXfonts({
          cmr10:  {'10': {c: '&Omega;', tclass: 'normal'}},
          cmmi10: {
            '10':  {c: '<i>&Omega;</i>', tclass: 'normal'},
            '126': {c: '&#x7E;<span style="margin-left:.1em"></span>'}
          },
          cmsy10: {
            '10': {c: '&#x2297;', tclass: 'arial'},
            '55': {c: '<span style="margin-right:-.54em">7</span>'}
          },
          cmex10: {'10': {c: '<span style="font-size: 67%">D</span>'}},
          cmti10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
          cmbx10: {'10': {c: '<b>&Omega;</b>', tclass: 'normal'}}
        });
      } else {
        /*
         *  MSIE/Mac
         */
        jsMath.Update.TeXfonts({
          
          cmr10: {
            '3':  {c: '<font face="Symbol">L</font>', tclass: 'normal'},
            '5':  {c: '<font face="Symbol">P</font>', tclass: 'normal'},
            '10': {c: '<font face="Symbol">W</font>', tclass: 'normal'},
            '15': {c: 'ffl', tclass: 'normal'},
            '16': {c: '&#x0131;', tclass: 'normal'},
            '20': {c: '&#x02C7;', tclass: 'normal'},
            '22': {c: '&#xAF;', tclass: 'normal', w: .3},
            '25': {c: '&#xDF;', tclass: 'normal'},
            '26': {c: '&#xE6;', tclass: 'normal'},
            '27': {c: '&#x153;', tclass: 'normal'}
          },
          
          cmmi10: {
            '3':  {c: '<font face="Symbol">L</font>', tclass: 'italic'},
            '5':  {c: '<font face="Symbol">P</font>', tclass: 'italic'},
            '10': {c: '<font face="Symbol">W</font>', tclass: 'italic'},
            '15': {c: '<font face="Symbol">e</font>', tclass: 'italic'},
            '16': {c: '<font face="Symbol">z</font>', tclass: 'italic'},
            '20': {c: '<font face="Symbol">k</font>', tclass: 'italic'},
            '22': {c: '<font face="Symbol">m</font>', tclass: 'italic'},
            '25': {c: '<font face="Symbol">p</font>', tclass: 'italic'},
            '26': {c: '<font face="Symbol">r</font>', tclass: 'italic'},
            '27': {c: '<font face="Symbol">s</font>', tclass: 'italic'}
          },
          
          cmsy10: {
            '3':  {c: '<span style="vertical-align:-.3em">*</span>', tclass: 'normal'},
            '5':  {c: '&#x389;', tclass: 'normal'},
            '10': {c: '&otimes;', tclass: 'normal'},
            '15': {c: '&#x2022;', tclass: 'normal'},
            '16': {c: '&#x224D;', tclass: 'normal'},
            '20': {c: '&le;', tclass: 'normal'},
            '22': {c: '&le;', tclass: 'normal'},
            '25': {c: '&#x2248;', tclass: 'normal'},
            '26': {c: '<font face="Symbol">&#xCC;</font>', tclass: 'normal'},
            '27': {c: '<font face="Symbol">&#xC9;</font>', tclass: 'normal'}
          },
          
          cmex10: {
            '3':  {c: '<span style="font-size: 67%">&#x69;</span>'},
            '5':  {c: '<span style="font-size: 67%">&#x6B;</span>'},
            '10': {c: '<span style="font-size: 67%">&#x44;</span>'},
            '15': {c: '<span style="font-size: 55%">&#xC2;</span>'},
            '16': {c: '<span style="font-size: 83%">&#xB5;</span>'},
            '20': {c: '<span style="font-size: 83%">"</span>'},
            '22': {c: '<span style="font-size: 83%">$</span>'},
            '25': {c: '<span style="font-size: 83%">\'</span>'},
            '26': {c: '<span style="font-size: 83%">(</span>'},
            '27': {c: '<span style="font-size: 83%">)</span>'}
          },
          
          cmti10: {
            '3':  {c: '<font face="Symbol">L</font>', tclass: 'italic'},
            '5':  {c: '<font face="Symbol">P</font>', tclass: 'italic'},
            '10': {c: '<font face="Symbol">W</font>', tclass: 'italic'},
            '16': {c: '&#x0131;', tclass: 'italic'},
            '20': {c: '&#xAD;', tclass: 'italic'},
            '22': {c: '&#xAF;', tclass: 'italic', w: .3},
            '25': {c: '&#xDF;', tclass: 'italic'},
            '26': {c: '&#xE6;', tclass: 'italic'},
            '27': {c: '&#x153;', tclass: 'italic'}
          },
          
          cmbx10: {
            '3':  {c: '<font face="Symbol">L</font>', tclass: 'bold'},
            '5':  {c: '<font face="Symbol">P</font>', tclass: 'bold'},
            '10': {c: '<font face="Symbol">W</font>', tclass: 'bold'},
            '16': {c: '&#x0131;', tclass: 'bold'},
            '20': {c: '&#xAD;', tclass: 'bold'},
            '22': {c: '&#xAF;', tclass: 'bold', w: .3},
            '25': {c: '&#xDF;', tclass: 'bold'},
            '26': {c: '&#xE6;', tclass: 'bold'},
            '27': {c: '&#x153;', tclass: 'bold'}
          }
        });
      }
      break;
      
    case "Mozilla":
      if (jsMath.platform == "mac") {
        /*
         *  Mozilla/Mac
         */
        jsMath.Update.TeXfonts({
          cmr10:  {'10': {c: '&Omega;', tclass: 'normal'}},
          cmmi10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
          cmsy10: {'10': {c: '&otimes;', tclass: 'normal'}},
          cmex10: {'10': {c: '<span style="font-size: 67%">D</span>'}},
          cmti10: {'10': {c: '<i>&Omega;</i>', tclass: 'normal'}},
          cmbx10: {'10': {c: '<b>&Omega;</b>', tclass: 'normal'}}
        });
      }
      break;

    case "Opera":
      jsMath.Update.TeXfonts({
        cmr10:  {
          '10': {c: '&Omega;', tclass: 'normal'},
          '20': {c: '&#x2C7;', tclass: 'normal'}
        },
        cmmi10: {
          '10': {c: '<i>&Omega;</i>', tclass: 'normal'},
          '20': {c: '&kappa;', tclass: 'normal'}
        },
        cmsy10: {
          '10': {c: '&otimes;', tclass: 'normal'},
          '20': {c: '&#x2264;', tclass: 'normal'}
        },
        cmex10: {
          '10': {c: '<span style="font-size: 67%">D</span>'},
          '20': {c: '<span style="font-size: 82%">"</span>'}
        },
        cmti10: {
          '10': {c: '<i>&Omega;</i>', tclass: 'normal'},
          '20': {c: '<i>&#x2C7;</i>', tclass: 'normal'}
        },
        cmbx10: {
          '10': {c: '<b>&Omega;</b>', tclass: 'normal'},
          '20': {c: '<b>&#x2C7;</b>', tclass: 'normal'}
        }
      });
      break;
      
    case "Konqueror":
      jsMath.Update.TeXfonts({
        cmr10:  {'20': {c: '&#x2C7;', tclass: 'normal'}},
        cmmi10: {'20': {c: '&kappa;', tclass: 'normal'}},
        cmsy10: {'20': {c: '&#x2264;', tclass: 'normal'}},
        cmex10: {'20': {c: '<span style="font-size: 84%">"</span>'}},
        cmti10: {'20': {c: '<i>&#x2C7;</i>', tclass: 'normal'}},
        cmbx10: {'20': {c: '<b>&#x2C7;</b>', tclass: 'normal'}}
      });
      break;
  }

}

jsMath.Setup.Styles({
  '.typeset .cmr10':  'font-family: cmr10, serif',
  '.typeset .cmbx10': 'font-family: cmbx10, cmr10',
  '.typeset .cmti10': 'font-family: cmti10, cmr10',
  '.typeset .cmmi10': 'font-family: cmmi10',
  '.typeset .cmsy10': 'font-family: cmsy10',
  '.typeset .cmex10': 'font-family: cmex10',
  '.typeset .arial':  "font-family: 'Arial unicode MS'"
});

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