diff --git a/unpacked/jax/output/HTML-CSS/config.js b/unpacked/jax/output/HTML-CSS/config.js
index 8e5d6dac6..a1822c2a5 100644
--- a/unpacked/jax/output/HTML-CSS/config.js
+++ b/unpacked/jax/output/HTML-CSS/config.js
@@ -35,6 +35,7 @@ MathJax.OutputJax["HTML-CSS"] = MathJax.OutputJax({
webfontDir: MathJax.OutputJax.fontDir + "/HTML-CSS", // font name added later
config: {
+ matchFontHeight: true, // try to match math font height to surrounding font?
scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor
availableFonts: ["STIX","TeX"], // list of local fonts to check for
preferredFont: "TeX", // preferred local font (TeX or STIX)
diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js
index c0769ea16..63ce62f24 100644
--- a/unpacked/jax/output/HTML-CSS/jax.js
+++ b/unpacked/jax/output/HTML-CSS/jax.js
@@ -534,7 +534,8 @@
ex = this.defaultEx; em = this.defaultEm;
if (relwidth) {maxwidth = this.defaultWidth}
}
- scale = Math.floor(Math.max(this.config.minScaleAdjust/100,(ex/this.TeX.x_height)/em) * this.config.scale);
+ scale = (this.config.matchFontHeight ? ex/this.TeX.x_height/em : 1);
+ scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale)*this.config.scale);
jax.HTMLCSS.scale = scale/100; jax.HTMLCSS.fontSize = scale+"%";
jax.HTMLCSS.em = jax.HTMLCSS.outerEm = em; this.em = em * scale/100; jax.HTMLCSS.ex = ex;
jax.HTMLCSS.lineWidth = (linebreak ? this.length2em(width,1,maxwidth/this.em) : 1000000);
@@ -584,7 +585,7 @@
this.em = MML.mbase.prototype.em = jax.HTMLCSS.em * jax.HTMLCSS.scale;
this.outerEm = jax.HTMLCSS.em; this.scale = jax.HTMLCSS.scale;
this.linebreakWidth = jax.HTMLCSS.lineWidth;
- span.style.fontSize = jax.HTMLCSS.fontSize;
+ if (this.scale !== 1) {span.style.fontSize = jax.HTMLCSS.fontSize}
//
// Typeset the math
//
diff --git a/unpacked/jax/output/NativeMML/config.js b/unpacked/jax/output/NativeMML/config.js
index 6160f35c4..49b2df19e 100644
--- a/unpacked/jax/output/NativeMML/config.js
+++ b/unpacked/jax/output/NativeMML/config.js
@@ -32,6 +32,7 @@ MathJax.OutputJax.NativeMML = MathJax.OutputJax({
extensionDir: MathJax.OutputJax.extensionDir + "/NativeMML",
config: {
+ matchFontHeight: true, // try to match math font height to surrounding font?
scale: 100, // scaling factor for all math
minScaleAdjust: 50, // minimum scaling to adjust to surrounding text
// (since the code for that is a bit delicate)
diff --git a/unpacked/jax/output/NativeMML/jax.js b/unpacked/jax/output/NativeMML/jax.js
index dbc5ac7fa..50e95838e 100644
--- a/unpacked/jax/output/NativeMML/jax.js
+++ b/unpacked/jax/output/NativeMML/jax.js
@@ -257,11 +257,12 @@
ex = test.firstChild.offsetWidth/60;
mex = test.lastChild.offsetWidth/60;
if (ex === 0 || ex === "NaN") {ex = this.defaultEx; mex = this.defaultMEx}
- scale = (mex > 1 ? ex/mex : 1) * this.config.scale;
- scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale));
- jax.NativeMML.ex = ex; jax.NativeMML.scale = scale/100;
+ scale = (this.config.matchFontHeight && mex > 1 ? ex/mex : 1);
+ scale = Math.floor(Math.max(this.config.minScaleAdjust/100,scale) * this.config.scale);
+ jax.NativeMML.ex = ex;
} else {scale = 100}
jax.NativeMML.fontSize = scale+"%";
+ jax.NativeMML.scale = scale/100;
}
//
// Remove the test spans used for determining scales
@@ -286,9 +287,9 @@
var jax = script.MathJax.elementJax, math = jax.root;
var span = document.getElementById(jax.inputID+"-Frame"),
container = span.firstChild, mspan = container.firstChild;
- span.style.fontSize = jax.NativeMML.fontSize;
this.ex = jax.NativeMML.ex || this.defaultEx;
this.scale = jax.NativeMML.scale || 1;
+ if (this.scale !== 1) {span.style.fontSize = jax.NativeMML.fontSize}
//
// Convert to MathML (if restarted, remove any partial math)
//