1 jsMath.Package(jsMath.Parser,{
3 macros: {font: 'Font'},
7 * Get a CS name or give an error
9 GetCSname: function (cmd) {
10 var c = this.GetNext();
11 if (c != this.cmd) {this.Error(cmd+" must be followed by a control sequence"); return null}
12 var cs = this.trimSpaces(this.GetArgument(cmd)); if (this.error) {return null};
17 * Handle the \font command
19 Font: function (name) {
20 var cs = this.GetCSname(this.cmd+name); if (this.error) return;
21 while (this.nextIsSpace()) {this.i++}
22 if (this.string.charAt(this.i++) == '=') {
23 while (this.nextIsSpace()) {this.i++}
24 var font = this.string.slice(this.i).match(/^[a-z]+[0-9]+/i);
26 this.i += (new String(font)).length;
27 if (jsMath.TeX.famName[font] != null) {
28 this.macros[cs] = ['HandleFont',jsMath.TeX.famName[font]];
30 this.macros[cs] = ['Extension',jsMath.Font.URL(font),"fontCS"];
31 this.fontCS[cs] = 1; // so Extension has something to delete
33 } else {this.Error("Missing font name")}
34 } else {this.Error("Missing font definition")}