Merge branch 'variable-centers' into chtml
This commit is contained in:
commit
9b09bd9b2d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -24,6 +24,7 @@ var font = 'MathJax_AMS';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 270, ascent: 1003, descent: 463,
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x41: [701,1,722,17,703], // LATIN CAPITAL LETTER A
|
||||
0x42: [683,1,667,11,620], // LATIN CAPITAL LETTER B
|
||||
|
|
|
@ -24,6 +24,7 @@ var font = 'MathJax_Caligraphic-Bold';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 315, ascent: 840, descent: 211,
|
||||
weight: 'bold',
|
||||
skew: {
|
||||
0x41: 0.224,
|
||||
|
|
|
@ -24,6 +24,7 @@ var font = 'MathJax_Fraktur-Bold';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 259, ascent: 740, descent: 223,
|
||||
weight: 'bold',
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x21: [689,12,349,107,241], // EXCLAMATION MARK
|
||||
|
|
|
@ -24,6 +24,7 @@ var font = 'MathJax_Fraktur';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 258, ascent: 740, descent: 224,
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x21: [689,12,296,91,204], // EXCLAMATION MARK
|
||||
0x22: [695,-432,215,8,196], // QUOTATION MARK
|
||||
|
|
|
@ -24,6 +24,7 @@ var font = 'MathJax_Math-BoldItalic';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 255, ascent: 725, descent: 216,
|
||||
weight: 'bold',
|
||||
style: 'italic',
|
||||
skew: {
|
||||
|
|
|
@ -24,6 +24,7 @@ var font = 'MathJax_SansSerif-Bold';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 250, ascent: 750, descent: 250,
|
||||
weight: 'bold',
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x21: [694,0,367,110,256], // EXCLAMATION MARK
|
||||
|
|
|
@ -24,6 +24,7 @@ var font = 'MathJax_SansSerif-Italic';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 250, ascent: 750, descent: 250,
|
||||
style: 'italic',
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x21: [694,0,319,110,355], // EXCLAMATION MARK
|
||||
|
|
|
@ -24,6 +24,8 @@ var font = 'MathJax_SansSerif';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 250, ascent: 750, descent: 250,
|
||||
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x21: [694,0,319,110,208], // EXCLAMATION MARK
|
||||
0x22: [694,-471,500,32,325], // QUOTATION MARK
|
||||
|
|
|
@ -24,6 +24,7 @@ var font = 'MathJax_Script';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 211, ascent: 735, descent: 314,
|
||||
skew: {
|
||||
0x41: 0.389,
|
||||
0x42: 0.194,
|
||||
|
|
|
@ -24,6 +24,8 @@ var font = 'MathJax_Typewriter';
|
|||
|
||||
CHTML.FONTDATA.FONTS[font] = {
|
||||
className: CHTML.FONTDATA.familyName(font),
|
||||
centerline: 233, ascent: 694, descent: 229,
|
||||
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x21: [622,0,525,206,320], // EXCLAMATION MARK
|
||||
0x22: [623,-333,525,122,402], // QUOTATION MARK
|
||||
|
|
|
@ -607,6 +607,7 @@
|
|||
CHTML.FONTDATA = CHTML.FONTDEF["TeX"];
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Caligraphic'] = {
|
||||
centerline: 287, ascent: 789, descent: 216,
|
||||
skew: {
|
||||
0x41: 0.194,
|
||||
0x42: 0.139,
|
||||
|
@ -676,6 +677,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Main-Bold'] = {
|
||||
centerline: 342, ascent: 951, descent: 267,
|
||||
weight: 'bold',
|
||||
file: "TeX/Main-Bold.js",
|
||||
Extra: [
|
||||
|
@ -817,6 +819,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Main-Italic'] = {
|
||||
centerline: 250, ascent: 750, descent: 250,
|
||||
style: 'italic',
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x21: [716,0,307,107,380], // EXCLAMATION MARK
|
||||
|
@ -941,6 +944,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Main'] = {
|
||||
centerline: 314, ascent: 900, descent: 272,
|
||||
skew: {
|
||||
0x131: 0.0278,
|
||||
0x237: 0.0833,
|
||||
|
@ -1238,6 +1242,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Math-Italic'] = {
|
||||
centerline: 250, ascent: 717, descent: 218,
|
||||
style: 'italic',
|
||||
skew: {
|
||||
0x41: 0.139,
|
||||
|
@ -1416,6 +1421,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Size1'] = {
|
||||
centerline: 250, ascent: 850, descent: 350,
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x28: [850,349,458,152,422], // LEFT PARENTHESIS
|
||||
0x29: [850,349,458,35,305], // RIGHT PARENTHESIS
|
||||
|
@ -1464,6 +1470,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Size2'] = {
|
||||
centerline: 249, ascent: 1360, descent: 862,
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x28: [1150,649,597,180,561], // LEFT PARENTHESIS
|
||||
0x29: [1150,649,597,35,416], // RIGHT PARENTHESIS
|
||||
|
@ -1504,6 +1511,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Size3'] = {
|
||||
centerline: 250, ascent: 1450, descent: 950,
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x28: [1450,949,736,209,701], // LEFT PARENTHESIS
|
||||
0x29: [1450,949,736,34,526], // RIGHT PARENTHESIS
|
||||
|
@ -1528,6 +1536,7 @@
|
|||
};
|
||||
|
||||
CHTML.FONTDATA.FONTS['MathJax_Size4'] = {
|
||||
centerline: 250, ascent: 1750, descent: 1250,
|
||||
0x20: [0,0,250,0,0], // SPACE
|
||||
0x28: [1750,1249,792,237,758], // LEFT PARENTHESIS
|
||||
0x29: [1750,1249,792,33,554], // RIGHT PARENTHESIS
|
||||
|
|
|
@ -33,9 +33,8 @@
|
|||
|
||||
var EVENT, TOUCH, HOVER; // filled in later
|
||||
|
||||
var CENTERLINE = .25,
|
||||
STRUTHEIGHT = 1,
|
||||
AFUZZ = .08, HFUZZ = .025, DFUZZ = .025; // adjustments to bounding box of character boxes
|
||||
var STRUTHEIGHT = 1,
|
||||
HFUZZ = .025, DFUZZ = .025; // adjustments to bounding box of character boxes
|
||||
|
||||
var STYLES = {
|
||||
"mjx-chtml": {
|
||||
|
@ -135,7 +134,7 @@
|
|||
"font-size":"500%"
|
||||
},
|
||||
"mjx-chartest mjx-char": {display:"inline"},
|
||||
"mjx-chartest mjx-box": {"padding-top": "500px"},
|
||||
"mjx-chartest mjx-box": {"padding-top": "1000px"},
|
||||
|
||||
".MJXc-processing": {
|
||||
visibility: "hidden", position:"fixed",
|
||||
|
@ -801,9 +800,8 @@
|
|||
getUnknownChar: function (unknown,n) {
|
||||
var c = this.unicodeChar(n);
|
||||
var HDW = this.getHDW(c,unknown.className);
|
||||
var a = (HDW.h-HDW.d)/2+AFUZZ; // ### FIXME: is this really the axis of the surrounding text?
|
||||
// ### FIXME: provide a means of setting the height and depth for individual characters
|
||||
unknown[n] = [.8,.2,HDW.w,0,HDW.w,{a:a, A:HDW.h-a, d:HDW.d}];
|
||||
unknown[n] = [.8,.2,HDW.w,0,HDW.w,{a:(HDW.h-HDW.d)/2, h:HDW.h, d:HDW.d}];
|
||||
unknown[n].c = c;
|
||||
},
|
||||
styledText: function (variant,text) {
|
||||
|
@ -817,8 +815,7 @@
|
|||
var unknown = this.STYLEDTEXT[id];
|
||||
if (!unknown["_"+text]) {
|
||||
var HDW = this.getHDW(text,variant.className||"",style);
|
||||
var a = (HDW.h-HDW.d)/2+AFUZZ; // ### FIXME: is this really the axis of the surrounding text?
|
||||
unknown["_"+text] = [.8,.2,HDW.w,0,HDW.w,{a:a, A:HDW.h-a, d:HDW.d}];
|
||||
unknown["_"+text] = [.8,.2,HDW.w,0,HDW.w,{a:(HDW.h-HDW.d)/2, h:HDW.h, d:HDW.d}];
|
||||
unknown["_"+text].c = text;
|
||||
}
|
||||
return {type:"unknown", n:"_"+text, font:unknown, style:style, rscale:variant.rscale};
|
||||
|
@ -832,8 +829,8 @@
|
|||
getHDW: function (c,name,styles) {
|
||||
var test1 = HTML.addElement(CHTML.CHTMLnode,"mjx-chartest",{className:name,style:styles},[["mjx-char",{},[c]]]);
|
||||
var test2 = HTML.addElement(CHTML.CHTMLnode,"mjx-chartest",{className:name,style:styles},[["mjx-char",{},[c,["mjx-box"]]]]);
|
||||
var em = CHTML.outerEm;
|
||||
var d = (test2.offsetHeight-500)/em;
|
||||
var em = 5*CHTML.em;
|
||||
var d = (test2.offsetHeight-1000)/em;
|
||||
var w = test1.offsetWidth/em, h = test1.offsetHeight/em - d;
|
||||
CHTML.CHTMLnode.removeChild(test1);
|
||||
CHTML.CHTMLnode.removeChild(test2);
|
||||
|
@ -848,7 +845,7 @@
|
|||
// the updated bounding box.
|
||||
//
|
||||
addCharList: function (node,list,bbox) {
|
||||
var state = {text:"", className:null};
|
||||
var state = {text:"", className:null, a:0};
|
||||
for (var i = 0, m = list.length; i < m; i++) {
|
||||
var item = list[i];
|
||||
if (this.charList[item.type]) (this.charList[item.type])(item,node,bbox,state,m);
|
||||
|
@ -861,6 +858,7 @@
|
|||
node.className = state.className;
|
||||
}
|
||||
}
|
||||
bbox.b = (state.flushed ? 0 : bbox.a);
|
||||
},
|
||||
//
|
||||
// The various item types are processed by these
|
||||
|
@ -873,6 +871,8 @@
|
|||
char: function (item,node,bbox,state,m) {
|
||||
var font = item.font;
|
||||
if (state.className && font.className !== state.className) this.flushText(node,state);
|
||||
if (!state.a) state.a = font.centerline/1000;
|
||||
if (state.a > (bbox.a||0)) bbox.a = state.a;
|
||||
var C = font[item.n];
|
||||
state.text += C.c; state.className = font.className;
|
||||
if (bbox.h < C[0]+HFUZZ) bbox.t = bbox.h = C[0]+HFUZZ;
|
||||
|
@ -898,13 +898,10 @@
|
|||
//
|
||||
unknown: function (item,node,bbox,state) {
|
||||
this.char(item,node,bbox,state,0);
|
||||
node = this.flushText(node,state,item.style);
|
||||
node.style.lineHeight = "normal";
|
||||
var C = item.font[item.n];
|
||||
node.style.marginTop = CHTML.Em(-C[5].A-HFUZZ);
|
||||
node.style.marginBottom = CHTML.Em(-C[5].d-DFUZZ);
|
||||
if (C[5].a) {state.a = C[5].a; if (state.a > bbox.a) bbox.a = state.a}
|
||||
node = this.flushText(node,state,item.style);
|
||||
node.style.width = CHTML.Em(C[2]);
|
||||
if (!bbox.a || C[5].a > bbox.a) bbox.a = C[5].a;
|
||||
},
|
||||
//
|
||||
// Put the pending text into a box of the class, and
|
||||
|
@ -913,7 +910,8 @@
|
|||
flushText: function (node,state,style) {
|
||||
node = HTML.addElement(node,"mjx-charbox",
|
||||
{className:state.className,style:style},[state.text]);
|
||||
state.text = ""; state.className = null;
|
||||
if (state.a) node.style.paddingBottom = CHTML.Em(state.a);
|
||||
state.text = ""; state.className = null; state.a = 0; state.flushed = true;
|
||||
return node;
|
||||
}
|
||||
},
|
||||
|
@ -941,10 +939,9 @@
|
|||
}
|
||||
if (list.length) this.addCharList(node.firstChild,list,bbox);
|
||||
bbox.clean();
|
||||
if (bbox.a == null) bbox.a = CENTERLINE;
|
||||
if (bbox.d < 0) {bbox.D = bbox.d; bbox.d = 0}
|
||||
if (bbox.h - bbox.a) node.firstChild.style[bbox.h - bbox.a < 0 ? "marginTop" : "paddingTop"] = this.Em(bbox.h-bbox.a);
|
||||
if (bbox.d + bbox.a) node.firstChild.style[bbox.d + bbox.a < 0 ? "marginBottom": "paddingBottom"] = this.Em(bbox.d+bbox.a);
|
||||
if (bbox.d > -bbox.b) node.firstChild.style.paddingBottom = this.Em(bbox.d+bbox.b);
|
||||
return bbox;
|
||||
},
|
||||
|
||||
|
@ -999,7 +996,7 @@
|
|||
var s = 1.1*(H - h)/k + .3; // space to cover by extender
|
||||
s /= (ebox.h+ebox.d); // scale factor;
|
||||
this.Transform(ext,
|
||||
"translateY("+CHTML.Em(-ebox.d+.25-s*CENTERLINE)+") scaleY("+s.toFixed(3).replace(/0+$/,"")+")",
|
||||
"translateY("+CHTML.Em(-ebox.d+.25-s*ebox.a)+") scaleY("+s.toFixed(3).replace(/0+$/,"")+")",
|
||||
"left "+CHTML.Em(ebox.d)
|
||||
);
|
||||
ext.style.paddingTop=ext.style.paddingBottom = 0;
|
||||
|
@ -1076,7 +1073,7 @@
|
|||
this.adjustHeights([left,ext,mid,ext2,right],hbox);
|
||||
if (ebox.D) ebox.d = ebox.D;
|
||||
hbox.t = hbox.h; hbox.b = hbox.d;
|
||||
var mt = ebox.h - hbox.h - CENTERLINE, mb = ebox.d - hbox.d + CENTERLINE;
|
||||
var mt = ebox.h - hbox.h - ebox.a, mb = ebox.d - hbox.d + ebox.a;
|
||||
if (mt) node.style.marginTop = CHTML.Em(mt);
|
||||
if (mb) node.style.marginBottom = CHTML.Em(mb);
|
||||
hbox.h = ebox.h; hbox.d = ebox.d;
|
||||
|
|
Loading…
Reference in New Issue
Block a user