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:
parent
b7868268f9
commit
0020f2a822
|
@ -1169,27 +1169,22 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
CHTMLhandleScale: function (node) {
|
CHTMLhandleScale: function (node) {
|
||||||
var scale = 1, parent = this.parent, pscale = (parent ? parent.CHTML.scale : 1);
|
var scale = 1, parent = this.parent, pscale = (parent ? parent.CHTML.scale : 1);
|
||||||
var values = this.getValues("scriptlevel","fontsize","mathsize");
|
var values = this.getValues("scriptlevel","fontsize","mathsize");
|
||||||
if (this.type === "mstyle" || this.type === "math")
|
if (values.scriptlevel !== 0) {
|
||||||
values.scriptlevel = this.Get("scriptlevel",null,true);
|
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.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.scriptlevel !== 0) {
|
scale *= CHTML.length2em(values.mathsize);
|
||||||
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;
|
|
||||||
}
|
|
||||||
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);
|
||||||
return scale;
|
return scale;
|
||||||
},
|
},
|
||||||
|
|
||||||
CHTMLhandleStyle: function (node) {
|
CHTMLhandleStyle: function (node) {
|
||||||
|
@ -1238,7 +1233,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
CHTMLgetVariant: function () {
|
CHTMLgetVariant: function () {
|
||||||
var values = this.getValues("mathvariant","fontfamily","fontweight","fontstyle");
|
var values = this.getValues("mathvariant","fontfamily","fontweight","fontstyle");
|
||||||
values.hasVariant = this.Get("mathvariant",true); // null if not explicitly specified
|
values.hasVariant = this.Get("mathvariant",true); // null if not explicitly specified
|
||||||
if (this.style) {
|
if (this.style) {
|
||||||
var span = HTML.Element("span"); span.style.cssText = this.style;
|
var span = HTML.Element("span"); span.style.cssText = this.style;
|
||||||
|
@ -1253,15 +1248,15 @@
|
||||||
}
|
}
|
||||||
if (values.weight && values.weight.match(/^\d+$/))
|
if (values.weight && values.weight.match(/^\d+$/))
|
||||||
values.weight = (parseInt(values.weight) > 600 ? "bold" : "normal");
|
values.weight = (parseInt(values.weight) > 600 ? "bold" : "normal");
|
||||||
var variant = values.mathvariant; if (this.variantForm) variant = "-TeX-variant";
|
var variant = values.mathvariant; if (this.variantForm) variant = "-TeX-variant";
|
||||||
if (values.family && !values.hasVariant) {
|
if (values.family && !values.hasVariant) {
|
||||||
if (!values.weight && values.mathvariant.match(/bold/)) values.weight = "bold";
|
if (!values.weight && values.mathvariant.match(/bold/)) values.weight = "bold";
|
||||||
if (!values.style && values.mathvariant.match(/italic/)) values.style = "italic";
|
if (!values.style && values.mathvariant.match(/italic/)) values.style = "italic";
|
||||||
this.CHTMLvariant = {fonts:[], noRemap:true, cache:{}, style: {
|
this.CHTMLvariant = {fonts:[], noRemap:true, cache:{}, style: {
|
||||||
"font-family":values.family, "font-weight":values.weight, "font-style":values.style
|
"font-family":values.family, "font-weight":values.weight, "font-style":values.style
|
||||||
}};
|
}};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (values.weight === "bold") {
|
if (values.weight === "bold") {
|
||||||
variant = {
|
variant = {
|
||||||
normal:MML.VARIANT.BOLD, italic:MML.VARIANT.BOLDITALIC,
|
normal:MML.VARIANT.BOLD, italic:MML.VARIANT.BOLDITALIC,
|
||||||
|
@ -1923,9 +1918,9 @@
|
||||||
var t = values.linethickness, p,q, u,v;
|
var t = values.linethickness, p,q, u,v;
|
||||||
if (values.bevelled) {
|
if (values.bevelled) {
|
||||||
frac.className = "MJXc-bevelled";
|
frac.className = "MJXc-bevelled";
|
||||||
var delta = (isDisplay ? .4 : .15);
|
var delta = (isDisplay ? .4 : .15);
|
||||||
var H = Math.max(nscale*(nbox.h+nbox.d),dscale*(dbox.h+dbox.d)) + 2*delta;
|
var H = Math.max(nscale*(nbox.h+nbox.d),dscale*(dbox.h+dbox.d)) + 2*delta;
|
||||||
var bevel = HTML.Element("mjx-bevel"); frac.insertBefore(bevel,denom);
|
var bevel = HTML.Element("mjx-bevel"); frac.insertBefore(bevel,denom);
|
||||||
var bbox = CHTML.createDelimiter(bevel,0x2F,H);
|
var bbox = CHTML.createDelimiter(bevel,0x2F,H);
|
||||||
u = nscale*(nbox.d-nbox.h)/2+a+delta;
|
u = nscale*(nbox.d-nbox.h)/2+a+delta;
|
||||||
v = dscale*(dbox.d-dbox.h)/2+a-delta;
|
v = dscale*(dbox.d-dbox.h)/2+a-delta;
|
||||||
|
@ -2082,7 +2077,7 @@
|
||||||
MML.mstyle.Augment({
|
MML.mstyle.Augment({
|
||||||
toCommonHTML: function (node) {
|
toCommonHTML: function (node) {
|
||||||
node = this.CHTMLdefaultNode(node);
|
node = this.CHTMLdefaultNode(node);
|
||||||
if (this.scriptlevel) this.CHTML.rescale(this.data[0].CHTML.rscale);
|
if (this.scriptlevel) this.CHTML.rescale(this.data[0].CHTML.rscale);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user