Handle conflicts between inherited mathvariant and fontfamily properly. (Fixes problem with ms having default mathvariant='monospace' when fontfamily is specified). Fix bold for stretched operators when weight is specified numerically.

This commit is contained in:
Davide P. Cervone 2012-02-08 09:03:00 -05:00
parent 0b1f9dc0c3
commit d21d075463
11 changed files with 21 additions and 15 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1756,7 +1756,8 @@
HTMLgetVariant: function () {
var values = this.getValues("mathvariant","fontfamily","fontweight","fontstyle");
if (!this.mathvariant) {
values.hasVariant = this.Get("mathvariant",true); // null if not explicitly specified
if (!values.hasVariant) {
values.family = values.fontfamily;
values.weight = values.fontweight;
values.style = values.fontstyle;
@ -1770,7 +1771,7 @@
if (values.weight && values.weight.match(/^\d+$/))
{values.weight = (parseInt(values.weight) > 600 ? "bold" : "normal")}
var variant = values.mathvariant; if (this.variantForm) {variant = "-"+HTMLCSS.fontInUse+"-variant"}
if (values.family && !this.mathvariant) {
if (values.family && !values.hasVariant) {
if (!values.weight && values.mathvariant.match(/bold/)) {values.weight = "bold"}
if (!values.style && values.mathvariant.match(/italic/)) {values.style = "italic"}
return {FONTS:[], fonts:[], noRemap:true,
@ -2026,7 +2027,9 @@
HTMLstretchH: function (box,W) {
this.HTMLremoveColor();
var values = this.getValues("maxsize","minsize","mathvariant","fontweight");
if (values.fontweight === "bold" && !this.mathvariant) {values.mathvariant = MML.VARIANT.BOLD}
// FIXME: should take style="font-weight:bold" into account as well
if ((values.fontweight === "bold" || parseInt(values.fontweight) >= 600) &&
!this.Get("mathvariant",true)) {values.mathvariant = MML.VARIANT.BOLD}
var span = this.HTMLspanElement(), mu = this.HTMLgetMu(span), scale = span.scale;
values.maxsize = HTMLCSS.length2em(values.maxsize,mu,span.bbox.w);
values.minsize = HTMLCSS.length2em(values.minsize,mu,span.bbox.w);

View File

@ -1120,7 +1120,8 @@
SVGgetVariant: function () {
var values = this.getValues("mathvariant","fontfamily","fontweight","fontstyle");
var variant = values.mathvariant; if (this.variantForm) {variant = "-TeX-variant"}
if (!this.mathvariant) {
values.hasVariant = this.Get("mathvariant",true); // null if not explicitly specified
if (!values.hasVariant) {
values.family = values.fontfamily;
values.weight = values.fontweight;
values.style = values.fontstyle;
@ -1130,7 +1131,7 @@
if (!values.weight && this.styles.fontWeight) {values.weight = this.styles.fontWeight}
if (!values.family && this.styles.fontFamily) {values.family = this.styles.fontFamily}
}
if (values.family && !this.mathvariant) {
if (values.family && !values.hasVariant) {
if (!values.weight && values.mathvariant.match(/bold/)) {values.weight = "bold"}
if (!values.style && values.mathvariant.match(/italic/)) {values.style = "italic"}
variant = {forceFamily: true, font: {"font-family":values.family}};
@ -1353,7 +1354,9 @@
SVGstretchH: function (w) {
var svg = this.svg || this.toSVG(), mu = this.SVGgetMu(svg);
var values = this.getValues("maxsize","minsize","mathvariant","fontweight");
if (values.fontweight === "bold" && !this.mathvariant) {values.mathvariant = MML.VARIANT.BOLD}
// FIXME: should take style="font-weight:bold" into account as well
if ((values.fontweight === "bold" || parseInt(values.fontweight) >= 600) &&
!this.Get("mathvariant",true)) {values.mathvariant = MML.VARIANT.BOLD}
values.maxsize = SVG.length2em(values.maxsize,mu,svg.w);
values.minsize = SVG.length2em(values.minsize,mu,svg.w);
w = Math.max(values.minsize,Math.min(values.maxsize,w));