Add check that font name is valid. Resolves issue #615.

This commit is contained in:
Davide P. Cervone 2014-03-19 12:05:33 -04:00
parent bb8c8991e1
commit 13d79045b5

View File

@ -101,6 +101,10 @@
hideProcessedMath: true, // use display:none until all math is processed hideProcessedMath: true, // use display:none until all math is processed
fontNames: ["TeX","STIX","STIX-Web","Asana-Math",
"Gyre-Termes","Gyre-Pagella","Latin-Modern","Neo-Euler"],
Config: function () { Config: function () {
this.SUPER(arguments).Config.apply(this,arguments); this.SUPER(arguments).Config.apply(this,arguments);
var settings = HUB.config.menuSettings, config = this.config, font = settings.font; var settings = HUB.config.menuSettings, config = this.config, font = settings.font;
@ -112,6 +116,7 @@
} else { } else {
this.fontInUse = config.font || "TeX"; this.fontInUse = config.font || "TeX";
} }
if (this.fontNames.indexOf(this.fontInUse) < 0) {this.fontInUse = "TeX"}
this.fontDir += "/" + this.fontInUse; this.fontDir += "/" + this.fontInUse;
if (!this.require) {this.require = []} if (!this.require) {this.require = []}
this.require.push(this.fontDir+"/fontdata.js"); this.require.push(this.fontDir+"/fontdata.js");