Work around stupid Fedora stix font package that incorrectly aliases all STIXGeneral fonts to STIX-Word fonts. Resolves issue #501.

This commit is contained in:
Davide P. Cervone 2014-03-03 18:34:50 -05:00
parent 4d4db67ad0
commit 81d9cce510

View File

@ -40,6 +40,12 @@
timeout: (isMobile? 15:8)*1000, // timeout for loading web fonts timeout: (isMobile? 15:8)*1000, // timeout for loading web fonts
comparisonFont: ["sans-serif","monospace","script","Times","Courier","Arial","Helvetica"], comparisonFont: ["sans-serif","monospace","script","Times","Courier","Arial","Helvetica"],
testSize: ["40px","50px","60px","30px","20px"], testSize: ["40px","50px","60px","30px","20px"],
//
// Fedora aliases STIXSizeOneSym to STIX Word, so MathJax thinks STIX is
// available, but the fonts aren't actually correct. This is to test if
// STIXSizeOneSym has letters in it (so is actually STIX Word).
//
FedoraSTIXcheck: {family:"STIXSizeOneSym", testString:"abcABC", noStyleChar:true},
Init: function () { Init: function () {
// //
@ -62,12 +68,17 @@
}, },
findFont: function (fonts,pref) { findFont: function (fonts,pref) {
if (pref && this.testCollection(pref)) {return pref} var found = null;
for (var i = 0, m = fonts.length; i < m; i++) { if (pref && this.testCollection(pref)) {
if (fonts[i] === pref) continue; found = pref;
if (this.testCollection(fonts[i])) {return fonts[i]} } else {
for (var i = 0, m = fonts.length; i < m; i++) {
if (fonts[i] === pref) continue;
if (this.testCollection(fonts[i])) {found = fonts[i]; break}
}
} }
return null; if (found === "STIX" && this.testFont(this.FedoraSTIXcheck)) {found = null}
return found;
}, },
testCollection: function (name) { testCollection: function (name) {