Annotation of loncom/html/adm/jsMath/extensions/font.js, revision 1.1
1.1 ! albertel 1: jsMath.Package(jsMath.Parser,{
! 2:
! 3: macros: {font: 'Font'},
! 4:
! 5: /*
! 6: * Get a CS name or give an error
! 7: */
! 8: GetCSname: function (cmd) {
! 9: var c = this.GetNext();
! 10: if (c != this.cmd) {this.Error(cmd+" must be followed by a control sequence"); return null}
! 11: var cs = this.trimSpaces(this.GetArgument(cmd)); if (this.error) {return null};
! 12: return cs.substr(1);
! 13: },
! 14:
! 15: /*
! 16: * Handle the \font command
! 17: */
! 18: Font: function (name) {
! 19: var cs = this.GetCSname(this.cmd+name); if (this.error) return;
! 20: while (this.nextIsSpace()) {this.i++}
! 21: if (this.string.charAt(this.i++) == '=') {
! 22: while (this.nextIsSpace()) {this.i++}
! 23: var font = this.string.slice(this.i).match(/^[a-z]+[0-9]+/i);
! 24: if (font) {
! 25: this.i += (new String(font)).length;
! 26: if (jsMath.TeX.famName[font]) {
! 27: this.macros[cs] = ['HandleFont',jsMath.TeX.famName[font]];
! 28: } else {
! 29: this.macros[cs] = ['Extension',jsMath.Font.URL(font)];
! 30: }
! 31: } else {this.Error("Missing font name")}
! 32: } else {this.Error("Missing font definition")}
! 33: }
! 34:
! 35: });
! 36:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>