From 81d9cce510adf75b65256bc2570c782c7c12ba71 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Mon, 3 Mar 2014 18:34:50 -0500 Subject: [PATCH] Work around stupid Fedora stix font package that incorrectly aliases all STIXGeneral fonts to STIX-Word fonts. Resolves issue #501. --- unpacked/jax/output/HTML-CSS/jax.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index 8238d2fc9..da00b16c8 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -40,6 +40,12 @@ timeout: (isMobile? 15:8)*1000, // timeout for loading web fonts comparisonFont: ["sans-serif","monospace","script","Times","Courier","Arial","Helvetica"], 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 () { // @@ -62,12 +68,17 @@ }, findFont: function (fonts,pref) { - if (pref && this.testCollection(pref)) {return pref} - for (var i = 0, m = fonts.length; i < m; i++) { - if (fonts[i] === pref) continue; - if (this.testCollection(fonts[i])) {return fonts[i]} + var found = null; + if (pref && this.testCollection(pref)) { + found = pref; + } 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) {