Annotation of loncom/html/adm/jsMath/jsMath-BaKoMa-fonts.js, revision 1.3
1.1 albertel 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: *
1.3 ! albertel 11: * Copyright 2004-2007 by Davide P. Cervone
1.1 albertel 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:
1.3 ! albertel 34: if (jsMath.browser == "Mozilla" && jsMath.platform != "mac") {
1.1 albertel 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: '/', tclass: 'cmr10'}
200: },
201: cmsy10: {
202: '3': {c: '*', tclass: 'normal'},
203: '16': {c: '≍'},
204: '17': {c: '≡', tclass: 'normal'},
205: '25': {c: '≈', tclass: 'normal'},
206: '39': {c: '≃'},
207: '20': {c: '≤', tclass: 'normal'}
208: },
209: cmex10: {'20': {c: '<span style="font-size: 80%"></span>'}},
210: cmti10: {'10': {c: '<i>Ω</i>', tclass: 'normal'}},
211: cmbx10: {'10': {c: '<b>Ω</b>', tclass: 'normal'}}
212: });
213:
214: } else {
215:
216: jsMath.Font.BaKoMa = [
217: '¡', '¢', '£', '¤', '¥', '¦', '§', '¨',
218: '©', 'ª', '­', '®', '¯', '°', '±', '²',
219:
220: '³', '´', 'µ', '¶', '∙', '¸', '¹', 'º',
221: '»', '¼', '½', '¾', '¿', 'À', 'Á', 'Â',
222:
223: 'Ã', '!', '"', '#', '$', '%', '&', '\'',
224: '(', ')', '*', '+', ',', '-', '.', '/',
225:
226: '0', '1', '2', '3', '4', '5', '6', '7',
227: '8', '9', ':', ';', '<', '=', '>', '?',
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: '`', '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', '{', '|', '}', '~', 'Ä'
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":
1.3 ! albertel 257: if (jsMath.platform == "pc") {
1.1 albertel 258: /*
259: * MSIE/PC
260: */
261: jsMath.Browser.msieFontBug = 1;
262: jsMath.Update.TeXfonts({
263: cmr10: {'10': {c: 'Ω', tclass: 'normal'}},
264: cmmi10: {
265: '10': {c: '<i>Ω</i>', tclass: 'normal'},
266: '126': {c: '~<span style="margin-left:.1em"></span>'}
267: },
268: cmsy10: {
269: '10': {c: '⊗', 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>Ω</i>', tclass: 'normal'}},
274: cmbx10: {'10': {c: '<b>Ω</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: 'ı', tclass: 'normal'},
288: '20': {c: 'ˇ', tclass: 'normal'},
289: '22': {c: '¯', tclass: 'normal', w: .3},
290: '25': {c: 'ß', tclass: 'normal'},
291: '26': {c: 'æ', tclass: 'normal'},
292: '27': {c: 'œ', 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: 'Ή', tclass: 'normal'},
311: '10': {c: '⊗', tclass: 'normal'},
312: '15': {c: '•', tclass: 'normal'},
313: '16': {c: '≍', tclass: 'normal'},
314: '20': {c: '≤', tclass: 'normal'},
315: '22': {c: '≤', tclass: 'normal'},
316: '25': {c: '≈', tclass: 'normal'},
317: '26': {c: '<font face="Symbol">Ì</font>', tclass: 'normal'},
318: '27': {c: '<font face="Symbol">É</font>', tclass: 'normal'}
319: },
320:
321: cmex10: {
322: '3': {c: '<span style="font-size: 67%">i</span>'},
323: '5': {c: '<span style="font-size: 67%">k</span>'},
324: '10': {c: '<span style="font-size: 67%">D</span>'},
325: '15': {c: '<span style="font-size: 55%">Â</span>'},
326: '16': {c: '<span style="font-size: 83%">µ</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: 'ı', tclass: 'italic'},
339: '20': {c: '­', tclass: 'italic'},
340: '22': {c: '¯', tclass: 'italic', w: .3},
341: '25': {c: 'ß', tclass: 'italic'},
342: '26': {c: 'æ', tclass: 'italic'},
343: '27': {c: 'œ', 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: 'ı', tclass: 'bold'},
351: '20': {c: '­', tclass: 'bold'},
352: '22': {c: '¯', tclass: 'bold', w: .3},
353: '25': {c: 'ß', tclass: 'bold'},
354: '26': {c: 'æ', tclass: 'bold'},
355: '27': {c: 'œ', tclass: 'bold'}
356: }
357: });
358: }
359: break;
360:
361: case "Mozilla":
1.3 ! albertel 362: if (jsMath.platform == "mac") {
1.1 albertel 363: /*
364: * Mozilla/Mac
365: */
366: jsMath.Update.TeXfonts({
367: cmr10: {'10': {c: 'Ω', tclass: 'normal'}},
368: cmmi10: {'10': {c: '<i>Ω</i>', tclass: 'normal'}},
369: cmsy10: {'10': {c: '⊗', tclass: 'normal'}},
370: cmex10: {'10': {c: '<span style="font-size: 67%">D</span>'}},
371: cmti10: {'10': {c: '<i>Ω</i>', tclass: 'normal'}},
372: cmbx10: {'10': {c: '<b>Ω</b>', tclass: 'normal'}}
373: });
374: }
375: break;
376:
377: case "Opera":
378: jsMath.Update.TeXfonts({
379: cmr10: {
380: '10': {c: 'Ω', tclass: 'normal'},
381: '20': {c: 'ˇ', tclass: 'normal'}
382: },
383: cmmi10: {
384: '10': {c: '<i>Ω</i>', tclass: 'normal'},
385: '20': {c: 'κ', tclass: 'normal'}
386: },
387: cmsy10: {
388: '10': {c: '⊗', tclass: 'normal'},
389: '20': {c: '≤', 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>Ω</i>', tclass: 'normal'},
397: '20': {c: '<i>ˇ</i>', tclass: 'normal'}
398: },
399: cmbx10: {
400: '10': {c: '<b>Ω</b>', tclass: 'normal'},
401: '20': {c: '<b>ˇ</b>', tclass: 'normal'}
402: }
403: });
404: break;
405:
406: case "Konqueror":
407: jsMath.Update.TeXfonts({
408: cmr10: {'20': {c: 'ˇ', tclass: 'normal'}},
409: cmmi10: {'20': {c: 'κ', tclass: 'normal'}},
410: cmsy10: {'20': {c: '≤', tclass: 'normal'}},
411: cmex10: {'20': {c: '<span style="font-size: 84%">"</span>'}},
412: cmti10: {'20': {c: '<i>ˇ</i>', tclass: 'normal'}},
413: cmbx10: {'20': {c: '<b>ˇ</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>