Merge branch 'issue210' into develop

This commit is contained in:
Davide P. Cervone 2012-09-04 06:08:15 -04:00
commit 0772d97a6a
15 changed files with 79 additions and 39 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@
*/
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var VERSION = "2.0.1";
var VERSION = "2.0.2";
var MML = MathJax.ElementJax.mml,
HTMLCSS = MathJax.OutputJax["HTML-CSS"];
@ -38,8 +38,8 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
var stack = HTMLCSS.createStack(span);
var scale = this.HTMLgetScale(), mu = this.HTMLgetMu(span), LABEL = -1;
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row, entries = [];
var LHD = HTMLCSS.FONTDATA.baselineskip * scale * values.useHeight,
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row, cell, mo, entries = [];
var LHD = HTMLCSS.FONTDATA.baselineskip * scale * values.useHeight, HD,
LH = HTMLCSS.FONTDATA.lineH * scale, LD = HTMLCSS.FONTDATA.lineD * scale;
//
@ -62,7 +62,26 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
for (i = 0, m = this.data.length; i < m; i++) {
row = this.data[i]; s = (row.type === "mlabeledtr" ? LABEL : 0);
for (j = s, M = row.data.length + s; j < M; j++) {
if (row.data[j-s].isMultiline) {A[i][j].style.width = "100%"}
cell = row.data[j-s];
if (cell.isMultiline) {A[i][j].style.width = "100%"}
if (cell.isEmbellished()) {
mo = cell.CoreMO();
var min = mo.Get("minsize",true);
if (min) {
var bbox = mo.HTMLspanElement().bbox;
if (mo.HTMLcanStretch("Vertical")) {
HD = bbox.h + bbox.d;
if (HD) {
min = HTMLCSS.length2em(min,mu,HD);
if (min*bbox.h/HD > H[j]) {H[j] = min*bbox.h/HD}
if (min*bbox.d/HD > D[j]) {D[j] = min*bbox.d/HD}
}
} else if (mo.HTMLcanStretch("Horizontal")) {
min = HTMLCSS.length2em(min,mu,bbox.w);
if (min > W[j]) {W[j] = min}
}
}
}
if (A[i][j].bbox.h > H[i]) {H[i] = A[i][j].bbox.h}
if (A[i][j].bbox.d > D[i]) {D[i] = A[i][j].bbox.d}
if (A[i][j].bbox.w > W[j]) {W[j] = A[i][j].bbox.w}
@ -122,7 +141,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
//
// Determine array total height
//
var HD = H[0] + D[A.length-1];
HD = H[0] + D[A.length-1];
for (i = 0, m = A.length-1; i < m; i++) {HD += Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i])}
//
// Determine frame and line sizes
@ -245,13 +264,13 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
for (i = 0, m = A.length; i < m; i++) {
if (A[i][j]) {
s = (this.data[i].type === "mlabeledtr" ? LABEL : 0);
var cell = this.data[i].data[j-s];
cell = this.data[i].data[j-s];
if (cell.HTMLcanStretch("Horizontal")) {
A[i][j].bbox = cell.HTMLstretchH(C[j],W[j]).bbox
A[i][j].bbox = cell.HTMLstretchH(C[j],W[j]).bbox;
} else if (cell.HTMLcanStretch("Vertical")) {
var mo = cell.CoreMO();
mo = cell.CoreMO();
var symmetric = mo.symmetric; mo.symmetric = false;
A[i][j].bbox = cell.HTMLstretchV(C[j],H[i],D[i]).bbox;
A[i][j].bbox = cell.HTMLstretchV(C[j],H[i],D[i]).bbox; A[i][j].HH = null;
mo.symmetric = symmetric;
}
align = cell.rowalign||this.data[i].rowalign||RALIGN[i];
@ -259,7 +278,7 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
bottom: A[i][j].bbox.d - D[i],
center: ((H[i]-D[i]) - (A[i][j].bbox.h-A[i][j].bbox.d))/2,
baseline: 0, axis: 0})[align]; // FIXME: handle axis better?
align = (cell.columnalign||RCALIGN[i][j]||CALIGN[j])
align = (cell.columnalign||RCALIGN[i][j]||CALIGN[j]);
HTMLCSS.alignBox(A[i][j],align,y+dy);
}
if (i < A.length-1) {y -= Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i])}

View File

@ -1133,6 +1133,7 @@
while (n-- > 0) {
if (!this.msieCloneNodeBug) {EXT = ext.cloneNode(true)}
else {EXT = this.Element("span"); this.createChar(EXT,delim.ext,scale,font)}
EXT.bbox = ext.bbox;
y -= eh; this.placeBox(this.addBox(stack,EXT),0,y,true);
}
y += dy - ext.bbox.d;
@ -1182,6 +1183,7 @@
while (n-- > 0) {
if (!this.cloneNodeBug) {REP = rep.cloneNode(true)}
else {REP = this.Element("span"); this.createChar(REP,delim.rep,scale,font)}
REP.bbox = rep.bbox;
this.placeBox(this.addBox(stack,REP),x,0,true); x += rw;
}
if (delim.mid && k) {this.placeBox(mid,x,0,true); x += mid.bbox.w - dx; n = N}
@ -1623,7 +1625,7 @@
if (SPAN && (SPAN.parentNode === span || (SPAN.parentNode||{}).parentNode === span)) {
while (SPAN.firstChild) {SPAN.removeChild(SPAN.firstChild)}
SPAN.bbox = {w:0, h:0, d:0, lw:0, rw:0};
SPAN.scale = 1; SPAN.isMultChar = null;
SPAN.scale = 1; SPAN.isMultChar = SPAN.HH = null;
SPAN.style.cssText = "";
return SPAN;
}

View File

@ -22,7 +22,7 @@
*/
MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var VERSION = "2.0.1";
var VERSION = "2.0.2";
var MML = MathJax.ElementJax.mml,
SVG = MathJax.OutputJax.SVG,
BBOX = SVG.BBOX;
@ -42,8 +42,8 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
var scale = this.SVGgetScale(), mu = this.SVGgetMu(svg);
var LABEL = -1;
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row;
var LHD = SVG.FONTDATA.baselineskip * scale * values.useHeight,
var H = [], D = [], W = [], A = [], C = [], i, j, J = -1, m, M, s, row, cell, mo;
var LHD = SVG.FONTDATA.baselineskip * scale * values.useHeight, HD,
LH = SVG.FONTDATA.lineH * scale, LD = SVG.FONTDATA.lineD * scale;
//
@ -58,8 +58,26 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
C[j] = BBOX.G();
W[j] = -SVG.BIGDIMEN;
}
A[i][j] = row.data[j-s].toSVG();
cell = row.data[j-s];
A[i][j] = cell.toSVG();
// if (row.data[j-s].isMultiline) {A[i][j].style.width = "100%"}
if (cell.isEmbellished()) {
mo = cell.CoreMO();
var min = mo.Get("minsize",true);
if (min) {
if (mo.SVGcanStretch("Vertical")) {
HD = mo.SVGdata.h + mo.SVGdata.d;
if (HD) {
min = SVG.length2em(min,mu,HD);
if (min*mo.SVGdata.h/HD > H[j]) {H[j] = min*mo.SVGdata.h/HD}
if (min*mo.SVGdata.d/HD > D[j]) {D[j] = min*mo.SVGdata.d/HD}
}
} else if (mo.SVGcanStretch("Horizontal")) {
min = SVG.length2em(min,mu,mo.SVGdata.w);
if (min > W[j]) {W[j] = min}
}
}
}
if (A[i][j].h > H[i]) {H[i] = A[i][j].h}
if (A[i][j].d > D[i]) {D[i] = A[i][j].d}
if (A[i][j].w > W[j]) {W[j] = A[i][j].w}
@ -119,7 +137,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
//
// Determine array total height
//
var HD = H[0] + D[A.length-1];
HD = H[0] + D[A.length-1];
for (i = 0, m = A.length-1; i < m; i++)
{HD += Math.max((H[i]+D[i] ? LHD : 0),D[i]+H[i+1]+RSPACE[i])}
//
@ -230,11 +248,11 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
for (i = 0, m = A.length; i < m; i++) {
if (A[i][j]) {
s = (this.data[i].type === "mlabeledtr" ? LABEL : 0);
var cell = this.data[i].data[j-s];
cell = this.data[i].data[j-s];
if (cell.SVGcanStretch("Horizontal")) {
A[i][j] = cell.SVGstretchH(W[j]);
} else if (cell.SVGcanStretch("Vertical")) {
var mo = cell.CoreMO();
mo = cell.CoreMO();
var symmetric = mo.symmetric; mo.symmetric = false;
A[i][j] = cell.SVGstretchV(H[i],D[i]);
mo.symmetric = symmetric;

View File

@ -990,6 +990,7 @@
SVGsaveData: function (svg) {
if (!this.SVGdata) {this.SVGdata = {}}
this.SVGdata.w = svg.w, this.SVGdata.x = svg.x;
this.SVGdata.h = svg.h, this.SVGdata.d = svg.d;
if (svg.X != null) {this.SVGdata.X = svg.X}
if (this["class"]) {svg.removeable = false; SVG.Element(svg.element,{"class":this["class"]})}
// FIXME: if an element is split by linebreaking, the ID will be the same on both parts
@ -1019,7 +1020,7 @@
svg.element.setAttribute("className","mjx-svg-"+this.type);
}
var style = this.style;
if (style) {
if (style && svg.element) {
svg.element.style.cssText = style;
if (svg.element.style.fontSize) {svg.element.style.fontSize = ""} // handled by scale
svg.element.style.border = svg.element.style.padding = "";
@ -1366,7 +1367,7 @@
svg.y = H - svg.h;
this.SVGhandleSpace(svg);
this.SVGhandleColor(svg);
delete this.svg;
delete this.svg.element;
this.SVGsaveData(svg);
return svg;
},
@ -1382,7 +1383,7 @@
svg = SVG.createDelimiter(this.data.join("").charCodeAt(0),w,svg.scale,values.mathvariant);
this.SVGhandleSpace(svg);
this.SVGhandleColor(svg);
delete this.svg;
delete this.svg.element;
this.SVGsaveData(svg);
return svg;
}