Handle adjusting cell heights properly. Add a 1em strut to work around issues with cells containing no text and cells that are shorter than the midpoint of the font. Resolves issue #1500.
This commit is contained in:
parent
c0c63b1e12
commit
fef425431b
|
@ -187,8 +187,6 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
|
||||||
CALIGN = state.CALIGN, RALIGN = state.RALIGN,
|
CALIGN = state.CALIGN, RALIGN = state.RALIGN,
|
||||||
RCALIGN = state.RCALIGN;
|
RCALIGN = state.RCALIGN;
|
||||||
CSPACE[state.J] *= 2; RSPACE[ROWS.length-1] *= 2; // since halved below
|
CSPACE[state.J] *= 2; RSPACE[ROWS.length-1] *= 2; // since halved below
|
||||||
var LH = CHTML.FONTDATA.lineH * values.useHeight,
|
|
||||||
LD = CHTML.FONTDATA.lineD * values.useHeight;
|
|
||||||
var T = "0", B, R, L, border, cbox, align;
|
var T = "0", B, R, L, border, cbox, align;
|
||||||
if (values.fspace) T = CHTML.Em(state.FSPACE[1]);
|
if (values.fspace) T = CHTML.Em(state.FSPACE[1]);
|
||||||
for (var i = 0, m = ROWS.length; i < m; i++) {
|
for (var i = 0, m = ROWS.length; i < m; i++) {
|
||||||
|
@ -245,11 +243,12 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Pad cells that are too short
|
// Adjust height and depth of cells
|
||||||
//
|
//
|
||||||
cell = row[j].firstChild.style;
|
cell = row[j].firstChild.style;
|
||||||
if (cbox.h < LH) cell.marginTop = CHTML.Em(LH-cbox.h);
|
var H = Math.max(1,cbox.h);
|
||||||
if (cbox.d < LD) cell.marginBottom = CHTML.Em(LD-cbox.d);
|
if (H !== state.H[i]) cell.marginTop = CHTML.Em(state.H[i]-H);
|
||||||
|
if (cbox.d < state.D[i]) cell.marginBottom = CHTML.Em(state.D[i]-cbox.d);
|
||||||
}
|
}
|
||||||
T = B;
|
T = B;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +493,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
|
||||||
if (LABELS[i] && this.data[i].data[0]) {
|
if (LABELS[i] && this.data[i].data[0]) {
|
||||||
labels.appendChild(LABELS[i]);
|
labels.appendChild(LABELS[i]);
|
||||||
var lbox = this.data[i].data[0].CHTML;
|
var lbox = this.data[i].data[0].CHTML;
|
||||||
T += h - lbox.h;
|
T += h - Math.max(1,lbox.h);
|
||||||
if (T) LABELS[i].style.marginTop = CHTML.Em(T);
|
if (T) LABELS[i].style.marginTop = CHTML.Em(T);
|
||||||
T = d - lbox.d;
|
T = d - lbox.d;
|
||||||
} else {
|
} else {
|
||||||
|
@ -563,6 +562,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
|
||||||
MML.mtd.Augment({
|
MML.mtd.Augment({
|
||||||
toCommonHTML: function (node,options) {
|
toCommonHTML: function (node,options) {
|
||||||
node = this.CHTMLdefaultNode(node,options);
|
node = this.CHTMLdefaultNode(node,options);
|
||||||
|
CHTML.addElement(node.firstChild,"mjx-strut"); // forces height to 1em (we adjust later)
|
||||||
//
|
//
|
||||||
// Determine if this is stretchy or not
|
// Determine if this is stretchy or not
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue
Block a user