2 * extensions/autobold.js
4 * Part of the jsMath package for mathematics on the web.
6 * This file causes jsMath to use \boldsymbol{...} around mathematics
7 * that appears within <B>...</B> tags or has font-weight:bold applied
8 * via CSS rule. You can activate it by calling
10 * jsMath.Extension.Require('autobold');
12 * once jsMath.js has been loaded, or by adding "extensions/autobold.js"
13 * to the loadFiles array in jsMath/easy/load.js.
15 * Note that you will need to install the cmmib10 and cmbsy10 fonts
16 * that are available from the jsMath extra font page at
18 * http://www.math.union.edu/locate/jsMath/download/extra-fonts/
20 * to make this work in image mode. Note that there is no unicode
21 * fallback for these fonts at the moment.
23 * ---------------------------------------------------------------------
25 * Copyright 2008 by Davide P. Cervone
27 * Licensed under the Apache License, Version 2.0 (the "License");
28 * you may not use this file except in compliance with the License.
29 * You may obtain a copy of the License at
31 * http://www.apache.org/licenses/LICENSE-2.0
33 * Unless required by applicable law or agreed to in writing, software
34 * distributed under the License is distributed on an "AS IS" BASIS,
35 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36 * See the License for the specific language governing permissions and
37 * limitations under the License.
40 /********************************************************************/
42 jsMath.Extension.Require("boldsymbol");
44 jsMath.Translate.OldParse = jsMath.Translate.Parse;
45 jsMath.Translate.Parse = function (style,text,noCache) {
46 if (jsMath.BBoxFor('</SPAN></SPAN><SPAN STYLE="font-family:Times,serif">MMMMMMMMMM</SPAN><SPAN><SPAN>').w >
47 jsMath.BBoxFor('</SPAN></SPAN><SPAN STYLE="font-family:Times,serif; font-weight:normal">MMMMMMMMMM</SPAN><SPAN><SPAN>').w) {
48 text = '\\boldsymbol{' + text + '}';
50 return jsMath.Translate.OldParse(style,text,noCache);