Add scaling factor to length2em computations (since containers set font-size, the absolute dimensions need to be adjusted to compensate). Make an mbase version to make that easier.

This commit is contained in:
Davide P. Cervone 2015-08-24 18:00:28 -04:00
parent d139834179
commit b80e69967b
6 changed files with 70 additions and 64 deletions

View File

@ -46,8 +46,8 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
// //
// Get the padding and rule thickness // Get the padding and rule thickness
// //
var p = CHTML.length2em(values.padding,1/CHTML.em); // padding for enclosure var p = this.CHTMLlength2em(values.padding,1/CHTML.em); // padding for enclosure
var t = CHTML.length2em(values.thickness,1/CHTML.em); // thickness of lines var t = this.CHTMLlength2em(values.thickness,1/CHTML.em); // thickness of lines
t = Math.max(1,Math.round(t*CHTML.em))/CHTML.em; t = Math.max(1,Math.round(t*CHTML.em))/CHTML.em;
var SOLID = CHTML.Px(t)+" solid"; var SOLID = CHTML.Px(t)+" solid";
var bb = {L:p, R:p, T:p, B:p, H:cbox.h+p, D:cbox.d+p, W:cbox.w+2*p}; var bb = {L:p, R:p, T:p, B:p, H:cbox.h+p, D:cbox.d+p, W:cbox.w+2*p};

View File

@ -61,14 +61,14 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
isMathJax:true, src:values.src, alt:values.alt, title:values.alt isMathJax:true, src:values.src, alt:values.alt, title:values.alt
}); });
var w = bbox.img.img.width/CHTML.em, h = bbox.img.img.height/CHTML.em; var w = bbox.img.img.width/CHTML.em, h = bbox.img.img.height/CHTML.em;
if (values.width !== "") img.style.width = CHTML.Em(CHTML.length2em(values.width,w)); if (values.width !== "") img.style.width = CHTML.Em(this.CHTMLlength2em(values.width,w));
if (values.height !== "") img.style.height = CHTML.Em(CHTML.length2em(values.height,h)); if (values.height !== "") img.style.height = CHTML.Em(this.CHTMLlength2em(values.height,h));
// //
// Warning: causes page reflows // Warning: causes page reflows
// //
bbox.w = bbox.r = img.offsetWidth/CHTML.em; bbox.h = bbox.t = img.offsetHeight/CHTML.em; bbox.w = bbox.r = img.offsetWidth/CHTML.em; bbox.h = bbox.t = img.offsetHeight/CHTML.em;
if (values.valign) { if (values.valign) {
bbox.d = bbox.b = -CHTML.length2em(values.valign,h); bbox.d = bbox.b = -this.CHTMLlength2em(values.valign,h);
img.style.verticalAlign = CHTML.Em(-bbox.d); img.style.verticalAlign = CHTML.Em(-bbox.d);
bbox.h -= bbox.d; bbox.t = bbox.h; bbox.h -= bbox.d; bbox.t = bbox.h;
} }

View File

@ -80,8 +80,8 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
!bmml.Get("largeop")) {u = v = 0} !bmml.Get("largeop")) {u = v = 0}
} }
values = this.getValues("displaystyle","subscriptshift","superscriptshift","texprimestyle"); values = this.getValues("displaystyle","subscriptshift","superscriptshift","texprimestyle");
values.subscriptshift = (values.subscriptshift === "" ? 0 : CHTML.length2em(values.subscriptshift)); values.subscriptshift = (values.subscriptshift === "" ? 0 : this.CHTMLlength2em(values.subscriptshift));
values.superscriptshift = (values.superscriptshift === "" ? 0 : CHTML.length2em(values.superscriptshift)); values.superscriptshift = (values.superscriptshift === "" ? 0 : this.CHTMLlength2em(values.superscriptshift));
var dx = (presub ? s+pbox.w : presup ? s+Pbox.w-delta : 0); var dx = (presub ? s+pbox.w : presup ? s+Pbox.w-delta : 0);
this.CHTML.combine(bbox,dx,0); var x = this.CHTML.w; this.CHTML.combine(bbox,dx,0); var x = this.CHTML.w;

View File

@ -122,8 +122,8 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
RLINES = SPLIT(values.rowlines), RLINES = SPLIT(values.rowlines),
CWIDTH = SPLIT(values.columnwidth), CWIDTH = SPLIT(values.columnwidth),
RCALIGN = [], i, m, J = state.J, M = state.rows.length-1; RCALIGN = [], i, m, J = state.J, M = state.rows.length-1;
for (i = 0, m = CSPACE.length; i < m; i++) CSPACE[i] = CHTML.length2em(CSPACE[i]); for (i = 0, m = CSPACE.length; i < m; i++) CSPACE[i] = this.CHTMLlength2em(CSPACE[i]);
for (i = 0, m = RSPACE.length; i < m; i++) RSPACE[i] = CHTML.length2em(RSPACE[i]); for (i = 0, m = RSPACE.length; i < m; i++) RSPACE[i] = this.CHTMLlength2em(RSPACE[i]);
while (CSPACE.length < J) CSPACE.push(CSPACE[CSPACE.length-1]); while (CSPACE.length < J) CSPACE.push(CSPACE[CSPACE.length-1]);
while (CALIGN.length <= J) CALIGN.push(CALIGN[CALIGN.length-1]); while (CALIGN.length <= J) CALIGN.push(CALIGN[CALIGN.length-1]);
while (CLINES.length < J) CLINES.push(CLINES[CLINES.length-1]); while (CLINES.length < J) CLINES.push(CLINES[CLINES.length-1]);
@ -148,8 +148,8 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
// //
var FSPACE = SPLIT(values.framespacing); var FSPACE = SPLIT(values.framespacing);
if (FSPACE.length != 2) FSPACE = SPLIT(this.defaults.framespacing); if (FSPACE.length != 2) FSPACE = SPLIT(this.defaults.framespacing);
FSPACE[0] = Math.max(0,CHTML.length2em(FSPACE[0])); FSPACE[0] = Math.max(0,this.CHTMLlength2em(FSPACE[0]));
FSPACE[1] = Math.max(0,CHTML.length2em(FSPACE[1])); FSPACE[1] = Math.max(0,this.CHTMLlength2em(FSPACE[1]));
if (values.columnlines.replace(/none/g,"").replace(/ /g,"") !== "" || if (values.columnlines.replace(/none/g,"").replace(/ /g,"") !== "" ||
values.rowlines.replace(/none/g,"").replace(/ /g,"") !== "") values.fspace = true; values.rowlines.replace(/none/g,"").replace(/ /g,"") !== "") values.fspace = true;
// //
@ -306,7 +306,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
// Handle equal columns by adjusting the CWIDTH array // Handle equal columns by adjusting the CWIDTH array
// //
if (values.width !== "auto" && !relWidth) { if (values.width !== "auto" && !relWidth) {
WW = Math.max(0,CHTML.length2em(values.width,state.R)); WW = Math.max(0,this.CHTMLlength2em(values.width,state.R));
setWidths = true; setWidths = true;
} }
if (values.equalcolumns) { if (values.equalcolumns) {
@ -344,7 +344,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
if (CWIDTH[j] === "auto") auto.push(j) if (CWIDTH[j] === "auto") auto.push(j)
else if (CWIDTH[j] === "fit") fit.push(j) else if (CWIDTH[j] === "fit") fit.push(j)
else if (CWIDTH[j].match(/%$/)) percent.push(j) else if (CWIDTH[j].match(/%$/)) percent.push(j)
else W[j] = CHTML.length2em(CWIDTH[j],W[j]); else W[j] = this.CHTMLlength2em(CWIDTH[j],W[j]);
TW += W[j] + CSPACE[j]; TW += W[j] + CSPACE[j];
if (row[j]) row[j].style.width = CHTML.Em(W[j]); if (row[j]) row[j].style.width = CHTML.Em(W[j]);
} }
@ -373,7 +373,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
var extra = 0; var extra = 0;
for (i = 0, m = percent.length; i < m; i++) { for (i = 0, m = percent.length; i < m; i++) {
j = percent[i]; j = percent[i];
w = Math.max(W[j],CHTML.length2em(CWIDTH[j],WW)); w = Math.max(W[j],this.CHTMLlength2em(CWIDTH[j],WW));
extra += w-W[j]; W[j] = w; extra += w-W[j]; W[j] = w;
row[j].style.width = CHTML.Em(w); row[j].style.width = CHTML.Em(w);
} }
@ -434,10 +434,10 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
if (indent.indentalign === MML.INDENTALIGN.AUTO) indent.indentalign = CONFIG.displayAlign; if (indent.indentalign === MML.INDENTALIGN.AUTO) indent.indentalign = CONFIG.displayAlign;
if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) indent.indentshift = indent.indentshiftfirst; if (indent.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) indent.indentshift = indent.indentshiftfirst;
if (indent.indentshift === "auto") indent.indentshift = "0"; if (indent.indentshift === "auto") indent.indentshift = "0";
var shift = CHTML.length2em(indent.indentshift,CHTML.cwidth); var shift = this.CHTMLlength2em(indent.indentshift,CHTML.cwidth);
var labelspace = CHTML.length2em(values.minlabelspacing,this.defaults.minlabelspacing); var labelspace = this.CHTMLlength2em(values.minlabelspacing,this.defaults.minlabelspacing);
var labelW = labelspace + state.W[LABEL], labelshift = 0, tw = state.R; var labelW = labelspace + state.W[LABEL], labelshift = 0, tw = state.R;
var dIndent = CHTML.length2em(CONFIG.displayIndent,CHTML.cwidth); var dIndent = this.CHTMLlength2em(CONFIG.displayIndent,CHTML.cwidth);
var s = (state.CALIGN[LABEL] === MML.INDENTALIGN.RIGHT ? -1 : 1); var s = (state.CALIGN[LABEL] === MML.INDENTALIGN.RIGHT ? -1 : 1);
if (indent.indentalign === MML.INDENTALIGN.CENTER) { if (indent.indentalign === MML.INDENTALIGN.CENTER) {
tw += 2 * (labelW - s*(shift + dIndent)); tw += 2 * (labelW - s*(shift + dIndent));
@ -574,11 +574,11 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
if (BBOX.stretch === "V") { if (BBOX.stretch === "V") {
var HD = BBOX.h + BBOX.d; var HD = BBOX.h + BBOX.d;
if (HD) { if (HD) {
var r = CHTML.length2em(min,HD)/HD; var r = this.CHTMLlength2em(min,HD)/HD;
if (r > 1) {BBOX.h *= r; BBOX.d *= r} if (r > 1) {BBOX.h *= r; BBOX.d *= r}
} }
} else { } else {
BBOX.w = Math.max(BBOX.w,CHTML.length2em(min,BBOX.w)); BBOX.w = Math.max(BBOX.w,this.CHTMLlength2em(min,BBOX.w));
} }
} }
} }

View File

@ -84,7 +84,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
); );
if (VALUES.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE) if (VALUES.linebreakstyle === MML.LINEBREAKSTYLE.INFIXLINEBREAKSTYLE)
VALUES.linebreakstyle = this.Get("infixlinebreakstyle"); VALUES.linebreakstyle = this.Get("infixlinebreakstyle");
VALUES.lineleading = CHTML.length2em(VALUES.lineleading,0.5); VALUES.lineleading = this.CHTMLlength2em(VALUES.lineleading,0.5);
// //
// Break the math at its best line breaks // Break the math at its best line breaks
@ -242,9 +242,9 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
else shift = prev.indentshift || def.indentshift; else shift = prev.indentshift || def.indentshift;
if (shift === MML.INDENTSHIFT.INDENTSHIFT) shift = prev.indentshift || def.indentshift; if (shift === MML.INDENTSHIFT.INDENTSHIFT) shift = prev.indentshift || def.indentshift;
if (shift === "auto" || shift === "") shift = "0"; if (shift === "auto" || shift === "") shift = "0";
shift = CHTML.length2em(shift,CHTML.cwidth); shift = this.CHTMLlength2em(shift,CHTML.cwidth);
if (state.isTop && CONFIG.displayIndent !== "0") { if (state.isTop && CONFIG.displayIndent !== "0") {
var indent = CHTML.length2em(CONFIG.displayIndent,CHTML.cwidth); var indent = this.CHTMLlength2em(CONFIG.displayIndent,CHTML.cwidth);
shift += (align === MML.INDENTALIGN.RIGHT ? -indent : indent); shift += (align === MML.INDENTALIGN.RIGHT ? -indent : indent);
} }
return (align === MML.INDENTALIGN.RIGHT && !noadjust ? -shift : shift); return (align === MML.INDENTALIGN.RIGHT && !noadjust ? -shift : shift);
@ -674,7 +674,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
// //
if (penalty >= info.penalty) return false; if (penalty >= info.penalty) return false;
info.penalty = penalty; info.values = values; info.W = W; info.w = w; info.penalty = penalty; info.values = values; info.W = W; info.w = w;
values.lineleading = CHTML.length2em(values.lineleading,state.VALUES.lineleading); values.lineleading = this.CHTMLlength2em(values.lineleading,state.VALUES.lineleading);
values.id = this.CHTMLnodeID; values.id = this.CHTMLnodeID;
return true; return true;
} }

View File

@ -393,7 +393,7 @@
jax.CHTML.scale = scale/100; jax.CHTML.fontSize = scale+"%"; jax.CHTML.scale = scale/100; jax.CHTML.fontSize = scale+"%";
jax.CHTML.outerEm = em; jax.CHTML.em = this.em = em * scale/100; jax.CHTML.outerEm = em; jax.CHTML.em = this.em = em * scale/100;
jax.CHTML.ex = ex; jax.CHTML.cwidth = cwidth/this.em; jax.CHTML.ex = ex; jax.CHTML.cwidth = cwidth/this.em;
jax.CHTML.lineWidth = (linebreak ? this.length2em(width,maxwidth/this.em) : maxwidth); jax.CHTML.lineWidth = (linebreak ? this.length2em(width,maxwidth/this.em,1) : maxwidth);
} }
// //
// Remove the test spans used for determining scales and linebreak widths // Remove the test spans used for determining scales and linebreak widths
@ -1133,34 +1133,36 @@
// //
// ### FIXME: Handle mu's // ### FIXME: Handle mu's
// //
length2em: function (length,size) { length2em: function (length,size,scale) {
if (typeof(length) !== "string") {length = length.toString()} if (typeof(length) !== "string") length = length.toString();
if (length === "") {return ""} if (length === "") return "";
if (length === MML.SIZE.NORMAL) {return 1} if (length === MML.SIZE.NORMAL) return 1;
if (length === MML.SIZE.BIG) {return 2} if (length === MML.SIZE.BIG) return 2;
if (length === MML.SIZE.SMALL) {return .71} if (length === MML.SIZE.SMALL) return .71;
if (this.MATHSPACE[length]) {return this.MATHSPACE[length]} if (this.MATHSPACE[length]) return this.MATHSPACE[length];
var match = length.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/); var match = length.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);
var m = parseFloat(match[1]||"1"), unit = match[2]; var m = parseFloat(match[1]||"1"), unit = match[2];
if (size == null) {size = 1} if (size == null) size = 1; if (!scale) scale = 1;
if (unit === "em") {return m} scale = 1 /this.em / scale;
if (unit === "ex") {return m * this.TEX.x_height} if (unit === "em") return m;
if (unit === "%") {return m / 100 * size} if (unit === "ex") return m * this.TEX.x_height;
if (unit === "px") {return m / this.em} if (unit === "%") return m / 100 * size;
if (unit === "pt") {return m / 10} // 10 pt to an em if (unit === "px") return m * scale;
if (unit === "pc") {return m * 1.2} // 12 pt to a pc if (unit === "pt") return m / 10; // 10 pt to an em
if (unit === "in") {return m * this.pxPerInch / this.em} if (unit === "pc") return m * 1.2; // 12 pt to a pc
if (unit === "cm") {return m * this.pxPerInch / this.em / 2.54} // 2.54 cm to an inch scale *= this.pxPerInch;
if (unit === "mm") {return m * this.pxPerInch / this.em / 25.4} // 10 mm to a cm if (unit === "in") return m * scale;
if (unit === "mu") {return m / 18} // 18mu to an em for the scriptlevel if (unit === "cm") return m * scale / 2.54; // 2.54 cm to an inch
if (unit === "mm") return m * scale / 25.4; // 10 mm to a cm
if (unit === "mu") return m / 18; // 18mu to an em for the scriptlevel
return m*size; // relative to given size (or 1em as default) return m*size; // relative to given size (or 1em as default)
}, },
thickness2em: function (length) { thickness2em: function (length,scale) {
var thick = CHTML.TEX.rule_thickness; var thick = CHTML.TEX.rule_thickness/(scale||1);
if (length === MML.LINETHICKNESS.MEDIUM) return thick; if (length === MML.LINETHICKNESS.MEDIUM) return thick;
if (length === MML.LINETHICKNESS.THIN) return .67*thick; if (length === MML.LINETHICKNESS.THIN) return .67*thick;
if (length === MML.LINETHICKNESS.THICK) return 1.67*thick; if (length === MML.LINETHICKNESS.THICK) return 1.67*thick;
return this.length2em(length,thick); return this.length2em(length,thick,scale);
}, },
Em: function (m) { Em: function (m) {
@ -1255,7 +1257,7 @@
if (cbox.D) this.D = cbox.D; else delete this.D; if (cbox.D) this.D = cbox.D; else delete this.D;
}, },
adjust: function (m,x,X,M) { adjust: function (m,x,X,M) {
this[x] += CHTML.length2em(m); this[x] += CHTML.length2em(m,1,this.scale);
if (M == null) { if (M == null) {
if (this[x] > this[X]) this[X] = this[x]; if (this[x] > this[X]) this[X] = this[x];
} else { } else {
@ -1415,6 +1417,10 @@
return document.getElementById((this.id||"MJXc-Node-"+this.CHTMLnodeID)+CHTML.idPostfix); return document.getElementById((this.id||"MJXc-Node-"+this.CHTMLnodeID)+CHTML.idPostfix);
}, },
CHTMLlength2em: function (length,size) {
return CHTML.length2em(length,size,this.CHTML.scale);
},
CHTMLhandleAttributes: function (node) { CHTMLhandleAttributes: function (node) {
if (this["class"]) node.className = this["class"]; if (this["class"]) node.className = this["class"];
// //
@ -1445,13 +1451,13 @@
if (values.scriptlevel !== 0) { if (values.scriptlevel !== 0) {
if (values.scriptlevel > 2) values.scriptlevel = 2; if (values.scriptlevel > 2) values.scriptlevel = 2;
scale = Math.pow(this.Get("scriptsizemultiplier"),values.scriptlevel); scale = Math.pow(this.Get("scriptsizemultiplier"),values.scriptlevel);
values.scriptminsize = CHTML.length2em(this.Get("scriptminsize")); values.scriptminsize = CHTML.length2em(this.Get("scriptminsize"),.8,1);
if (scale < values.scriptminsize) scale = values.scriptminsize; if (scale < values.scriptminsize) scale = values.scriptminsize;
} }
if (this.removedStyles && this.removedStyles.fontSize && !values.fontsize) if (this.removedStyles && this.removedStyles.fontSize && !values.fontsize)
values.fontsize = this.removedStyles.fontSize; values.fontsize = this.removedStyles.fontSize;
if (values.fontsize && !this.mathsize) values.mathsize = values.fontsize; if (values.fontsize && !this.mathsize) values.mathsize = values.fontsize;
if (values.mathsize !== 1) scale *= CHTML.length2em(values.mathsize); if (values.mathsize !== 1) scale *= CHTML.length2em(values.mathsize,1,1);
this.CHTML.scale = scale; pscale = this.CHTML.rscale = scale/pscale; this.CHTML.scale = scale; pscale = this.CHTML.rscale = scale/pscale;
if (Math.abs(pscale-1) < .001) pscale = 1; if (Math.abs(pscale-1) < .001) pscale = 1;
if (node && pscale !== 1) node.style.fontSize = CHTML.Percent(pscale); if (node && pscale !== 1) node.style.fontSize = CHTML.Percent(pscale);
@ -1500,7 +1506,7 @@
if (!this.useMMLspacing) { if (!this.useMMLspacing) {
var space = this.texSpacing(); var space = this.texSpacing();
if (space !== "") { if (space !== "") {
this.CHTML.L = CHTML.length2em(space); this.CHTML.L = this.CHTMLlength2em(space);
node.className += " "+CHTML.SPACECLASS[space]; node.className += " "+CHTML.SPACECLASS[space];
} }
} }
@ -1659,9 +1665,9 @@
if (values.indentalign === MML.INDENTALIGN.AUTO) values.indentalign = CONFIG.displayAlign; if (values.indentalign === MML.INDENTALIGN.AUTO) values.indentalign = CONFIG.displayAlign;
if (values.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) values.indentshift = values.indentshiftfirst; if (values.indentshiftfirst !== MML.INDENTSHIFT.INDENTSHIFT) values.indentshift = values.indentshiftfirst;
if (values.indentshift === "auto") values.indentshift = "0"; if (values.indentshift === "auto") values.indentshift = "0";
var shift = CHTML.length2em(values.indentshift,CHTML.cwidth); var shift = this.CHTMLlength2em(values.indentshift,CHTML.cwidth);
if (CONFIG.displayIndent !== "0") { if (CONFIG.displayIndent !== "0") {
var indent = CHTML.length2em(CONFIG.displayIndent,CHTML.cwidth); var indent = this.CHTMLlength2em(CONFIG.displayIndent,CHTML.cwidth);
shift += (values.indentalign === MML.INDENTALIGN.RIGHT ? -indent : indent); shift += (values.indentalign === MML.INDENTALIGN.RIGHT ? -indent : indent);
} }
var styles = node.parentNode.parentNode.style; var styles = node.parentNode.parentNode.style;
@ -1751,8 +1757,8 @@
CHTMLhandleSpace: function (node) { CHTMLhandleSpace: function (node) {
if (this.useMMLspacing) { if (this.useMMLspacing) {
var values = this.getValues("scriptlevel","lspace","rspace"); var values = this.getValues("scriptlevel","lspace","rspace");
values.lspace = Math.max(0,CHTML.length2em(values.lspace)); values.lspace = Math.max(0,this.CHTMLlength2em(values.lspace));
values.rspace = Math.max(0,CHTML.length2em(values.rspace)); values.rspace = Math.max(0,this.CHTMLlength2em(values.rspace));
if (values.scriptlevel > 0) { if (values.scriptlevel > 0) {
if (!this.hasValue("lspace")) values.lspace = .15; if (!this.hasValue("lspace")) values.lspace = .15;
if (!this.hasValue("rspace")) values.rspace = .15; if (!this.hasValue("rspace")) values.rspace = .15;
@ -1832,8 +1838,8 @@
// //
var H, a = CHTML.TEX.axis_height; var H, a = CHTML.TEX.axis_height;
if (values.symmetric) {H = 2*Math.max(h-a,d+a)} else {H = h + d} if (values.symmetric) {H = 2*Math.max(h-a,d+a)} else {H = h + d}
values.maxsize = CHTML.length2em(values.maxsize,bbox.h+bbox.d); values.maxsize = this.CHTMLlength2em(values.maxsize,bbox.h+bbox.d);
values.minsize = CHTML.length2em(values.minsize,bbox.h+bbox.d); values.minsize = this.CHTMLlength2em(values.minsize,bbox.h+bbox.d);
H = Math.max(values.minsize,Math.min(values.maxsize,H)); H = Math.max(values.minsize,Math.min(values.maxsize,H));
// //
// If we are not already stretched to this height // If we are not already stretched to this height
@ -1866,8 +1872,8 @@
if ((values.fontweight === "bold" || (this.removedStyles||{}).fontWeight === "bold" || if ((values.fontweight === "bold" || (this.removedStyles||{}).fontWeight === "bold" ||
parseInt(values.fontweight) >= 600) && !this.Get("mathvariant",true)) parseInt(values.fontweight) >= 600) && !this.Get("mathvariant",true))
values.mathvariant = MML.VARIANT.BOLD; values.mathvariant = MML.VARIANT.BOLD;
values.maxsize = CHTML.length2em(values.maxsize,bbox.w); values.maxsize = this.CHTMLlength2em(values.maxsize,bbox.w);
values.minsize = CHTML.length2em(values.minsize,bbox.w); values.minsize = this.CHTMLlength2em(values.minsize,bbox.w);
W = Math.max(values.minsize,Math.min(values.maxsize,W)); W = Math.max(values.minsize,Math.min(values.maxsize,W));
if (W !== bbox.sW) { if (W !== bbox.sW) {
while (node.firstChild) node.removeChild(node.firstChild); while (node.firstChild) node.removeChild(node.firstChild);
@ -1930,9 +1936,9 @@
this.CHTMLhandleStyle(node); this.CHTMLhandleStyle(node);
this.CHTMLhandleScale(node); this.CHTMLhandleScale(node);
var values = this.getValues("height","depth","width"); var values = this.getValues("height","depth","width");
var w = CHTML.length2em(values.width), var w = this.CHTMLlength2em(values.width),
h = CHTML.length2em(values.height), h = this.CHTMLlength2em(values.height),
d = CHTML.length2em(values.depth); d = this.CHTMLlength2em(values.depth);
var bbox = this.CHTML; var bbox = this.CHTML;
bbox.w = bbox.r = w; bbox.h = bbox.t = h; bbox.d = bbox.b = d; bbox.l = 0; bbox.w = bbox.r = w; bbox.h = bbox.t = h; bbox.d = bbox.b = d; bbox.l = 0;
if (w < 0) {node.style.marginRight = CHTML.Em(w); w = 0} if (w < 0) {node.style.marginRight = CHTML.Em(w); w = 0}
@ -1995,7 +2001,7 @@
length = String(length); length = String(length);
var match = length.match(/width|height|depth/); var match = length.match(/width|height|depth/);
var size = (match ? this.CHTML[match[0].charAt(0)] : (d ? this.CHTML[d] : 0)); var size = (match ? this.CHTML[match[0].charAt(0)] : (d ? this.CHTML[d] : 0));
var dimen = (CHTML.length2em(length,size)||0); var dimen = (this.CHTMLlength2em(length,size)||0);
if (length.match(/^[-+]/) && D != null) dimen += D; if (length.match(/^[-+]/) && D != null) dimen += D;
if (m != null) dimen = Math.max(m,dimen); if (m != null) dimen = Math.max(m,dimen);
return dimen; return dimen;
@ -2259,8 +2265,8 @@
if (bmml.data.join("").length === 1 && bbox.rscale === 1 && !bbox.sH && if (bmml.data.join("").length === 1 && bbox.rscale === 1 && !bbox.sH &&
!bmml.Get("largeop")) {u = v = 0} !bmml.Get("largeop")) {u = v = 0}
} }
values.subscriptshift = (values.subscriptshift === "" ? 0 : CHTML.length2em(values.subscriptshift)); values.subscriptshift = (values.subscriptshift === "" ? 0 : this.CHTMLlength2em(values.subscriptshift));
values.superscriptshift = (values.superscriptshift === "" ? 0 : CHTML.length2em(values.superscriptshift)); values.superscriptshift = (values.superscriptshift === "" ? 0 : this.CHTMLlength2em(values.superscriptshift));
// //
// Add the super- and subscripts // Add the super- and subscripts
// //
@ -2331,7 +2337,7 @@
// //
var nbox = this.CHTMLbboxFor(0), dbox = this.CHTMLbboxFor(1), var nbox = this.CHTMLbboxFor(0), dbox = this.CHTMLbboxFor(1),
BBOX = CHTML.BBOX.empty(this.CHTML), nscale = nbox.rscale, dscale = dbox.rscale; BBOX = CHTML.BBOX.empty(this.CHTML), nscale = nbox.rscale, dscale = dbox.rscale;
values.linethickness = Math.max(0,CHTML.thickness2em(values.linethickness||"0")); values.linethickness = Math.max(0,CHTML.thickness2em(values.linethickness||"0",BBOX.scale));
var mt = CHTML.TEX.min_rule_thickness/CHTML.em/BBOX.scale, a = CHTML.TEX.axis_height; var mt = CHTML.TEX.min_rule_thickness/CHTML.em/BBOX.scale, a = CHTML.TEX.axis_height;
var t = values.linethickness, p,q, u,v; var t = values.linethickness, p,q, u,v;
if (values.bevelled) { if (values.bevelled) {