Adjust CHTMLhandleScale() so that \large, etc. affect fractions and other such constructs. (Do the scaling on the mstyle element rather than the individual token elements.)

This commit is contained in:
Davide P. Cervone 2015-03-17 06:29:50 -04:00
parent b7868268f9
commit 0020f2a822

View File

@ -1171,21 +1171,16 @@
CHTMLhandleScale: function (node) {
var scale = 1, parent = this.parent, pscale = (parent ? parent.CHTML.scale : 1);
var values = this.getValues("scriptlevel","fontsize","mathsize");
if (this.type === "mstyle" || this.type === "math")
values.scriptlevel = this.Get("scriptlevel",null,true);
if (this.removedStyles && this.removedStyles.fontSize && !values.fontsize)
values.fontsize = this.removedStyles.fontSize;
if (values.fontsize && !this.mathsize) values.mathsize = values.fontsize;
if (values.scriptlevel !== 0) {
if (values.scriptlevel > 2) values.scriptlevel = 2;
scale = Math.pow(this.Get("scriptsizemultiplier"),values.scriptlevel);
values.scriptminsize = CHTML.length2em(this.Get("scriptminsize"));
if (scale < values.scriptminsize) scale = values.scriptminsize;
}
if (this.isToken) {
this.CHTML.mscale = CHTML.length2em(values.mathsize,pscale);
scale *= this.CHTML.mscale;
}
if (this.removedStyles && this.removedStyles.fontSize && !values.fontsize)
values.fontsize = this.removedStyles.fontSize;
if (values.fontsize && !this.mathsize) values.mathsize = values.fontsize;
scale *= CHTML.length2em(values.mathsize);
this.CHTML.scale = scale; pscale = this.CHTML.rscale = scale/pscale;
if (Math.abs(pscale-1) < .001) pscale = 1;
if (node && pscale !== 1) node.style.fontSize = CHTML.Percent(pscale);