Add new otf fonts (more formats needed), and add support for web fonts in addition to local ones
This commit is contained in:
parent
15ab276598
commit
3443bb6016
BIN
fonts/CommonHTML/TeX/otf/MathJax_AMS-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_AMS-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Caligraphic-Bold.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Caligraphic-Bold.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Caligraphic-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Caligraphic-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Fraktur-Bold.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Fraktur-Bold.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Fraktur-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Fraktur-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Main-Bold.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Main-Bold.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Main-Italic.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Main-Italic.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Main-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Main-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Math-BoldItalic.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Math-BoldItalic.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Math-Italic.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Math-Italic.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Math-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Math-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_SansSerif-Bold.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_SansSerif-Bold.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_SansSerif-Italic.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_SansSerif-Italic.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_SansSerif-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_SansSerif-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Script-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Script-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size1-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size1-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size2-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size2-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size3-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size3-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size4-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Size4-Regular.otf
Normal file
Binary file not shown.
BIN
fonts/CommonHTML/TeX/otf/MathJax_Typewriter-Regular.otf
Normal file
BIN
fonts/CommonHTML/TeX/otf/MathJax_Typewriter-Regular.otf
Normal file
Binary file not shown.
|
@ -31,8 +31,8 @@ MathJax.OutputJax.CommonHTML = MathJax.OutputJax({
|
|||
directory: MathJax.OutputJax.directory + "/CommonHTML",
|
||||
extensionDir: MathJax.OutputJax.extensionDir + "/CommonHTML",
|
||||
autoloadDir: MathJax.OutputJax.directory + "/CommonHTML/autoload",
|
||||
fontDir: MathJax.OutputJax.directory + "/CommonHTML/fonts",
|
||||
webfontDir: MathJax.OutputJax.fontDir + "/HTML-CSS",
|
||||
fontDir: MathJax.OutputJax.directory + "/CommonHTML/fonts", // fontname added later
|
||||
webfontDir: MathJax.OutputJax.fontDir + "/CommonHTML", // fontname added later
|
||||
|
||||
config: {
|
||||
scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor
|
||||
|
|
|
@ -1589,23 +1589,55 @@
|
|||
//
|
||||
(function () {
|
||||
var STYLES = CHTML.config.styles, FONTS = CHTML.FONTDATA.FONTS;
|
||||
var DIR = AJAX.fileURL(CHTML.webfontDir);
|
||||
var faces = [];
|
||||
for (var name in FONTS) {if (FONTS.hasOwnProperty(name)) {
|
||||
var font = FONTS[name]; if (typeof(font) !== "string") font = font.directory;
|
||||
var names = font.split(/\//);
|
||||
var suffix = names[0].toLowerCase().replace(/(?:igraphic|serif|writer|tur)$/,"")
|
||||
+ "-" + names[1].replace(/[^A-Z]/g,"");
|
||||
var family = "MJX_TeX_"+suffix; FONTS[name].className = "MJXc-TeX-"+suffix;
|
||||
STYLES[".MJXc-TeX-"+suffix] = {"font-family":family};
|
||||
font = {"font-family":family}; name = name.replace(/-.*/,"");
|
||||
if (names[1] === "Regular") {font.src = "local('"+name+"'), local('"+name+"-Regular')"}
|
||||
else {font.src = "local('"+name+" "+names[1]+"'), local('"+name+"-"+names[1]+"')"}
|
||||
var family = "MJXc_TeX_"+suffix, FAMILY = family;
|
||||
FONTS[name].className = "MJXc-TeX-"+suffix;
|
||||
//
|
||||
// The local font, if found
|
||||
//
|
||||
font = {"font-family":family};
|
||||
name = name.replace(/-.*/,"");
|
||||
if (names[1] === "Regular") {
|
||||
font.src = "local('"+name+"'), local('"+name+"-Regular')";
|
||||
} else {
|
||||
font.src = "local('"+name+" "+names[1]+"'), local('"+name+"-"+names[1]+"')";
|
||||
}
|
||||
faces.push(font);
|
||||
//
|
||||
// For Chrome, need to have separate font-weight and font-style versions
|
||||
//
|
||||
if (names[1] !== "Regular") {
|
||||
font = {"font-family":family+"x", src:"local('"+name+"')"};
|
||||
if (names[1].match(/Bold/)) font["font-weight"] = "bold";
|
||||
if (names[1].match(/Italic/)) font["font-style"] = "italic";
|
||||
FAMILY += ","+family+"x";
|
||||
faces.push(font);
|
||||
}
|
||||
//
|
||||
// The web font, if no local font found
|
||||
// ### FIXME: add more formats to src
|
||||
//
|
||||
font = {
|
||||
"font-family":family+"w",
|
||||
src:"url('"+DIR+"/MathJax_"+names[0]+"-"+names[1]+".otf')"
|
||||
};
|
||||
faces.push(font);
|
||||
//
|
||||
// A class that looks for the local and web fonts
|
||||
//
|
||||
FAMILY += ","+family+"w";
|
||||
STYLES[".MJXc-TeX-"+suffix] = {"font-family":FAMILY};
|
||||
}}
|
||||
if (faces.length) STYLES["@font-face"] = faces;
|
||||
})();
|
||||
|
||||
AJAX.loadComplete(CHTML.fontDir + "/TeX/fontdata.js");
|
||||
AJAX.loadComplete(CHTML.fontDir + "/fontdata.js");
|
||||
|
||||
})(MathJax.OutputJax.CommonHTML,MathJax.ElementJax.mml,MathJax.Ajax);
|
||||
|
||||
|
|
|
@ -140,7 +140,8 @@
|
|||
if (!this.require) {this.require = []}
|
||||
this.SUPER(arguments).Config.call(this); var settings = this.settings;
|
||||
if (settings.scale) {this.config.scale = settings.scale}
|
||||
this.require.push(this.fontDir+"/TeX/fontdata.js");
|
||||
this.fontDir += "/TeX"; this.webfontDir += "/TeX/otf";
|
||||
this.require.push(this.fontDir+"/fontdata.js");
|
||||
this.require.push(MathJax.OutputJax.extensionDir+"/MathEvents.js");
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user