Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Merge requests
  • !1503
Something went wrong while fetching comments. Please try again.

Handle adjusting cell heights properly. #1500

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Davide P. Cervone requested to merge github/fork/dpvc/issue1500 into develop 9 years ago
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 1

The actual height and depth of the row is in state.H[i] and state.D[i], but we were using LH and LD, the usual line height and depth. This PR fixes that. This works if there is actual text in the cell, but if the cell is empty, the margin-bottom doesn't fall below the baseline, it sits on top of the baseline, which spoils the alignment. Also, if the height of the cell is less than the midpoint of the font, the browser adds extra height making it the midpoint of the font, and we didn't compensate for that.

Both issues are resolved by adding a 1em strut to the cell (so it has content and is not too short), and compensating for that in the height adjustments. (Since the font in question was the surrounding font, it was not easy to tell where its midpoint was; this solution is independent of the surrounding font.)

Resolves issue #1500 (closed).

Compare
  • develop (base)

and
  • latest version
    fef42543
    1 commit, 2 years ago

1 file
+ 6
- 6

    Preferences

    File browser
    Compare changes
unpacked/jax/output/CommonHTML/autoload/mtable.js
+ 6
- 6
  • View file @ fef42543

  • Edit in single-file editor

  • Open in Web IDE


@@ -187,8 +187,6 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
@@ -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 () {
@@ -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 () {
@@ -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 () {
@@ -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
//
//
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference:
Source branch: github/fork/dpvc/issue1500

Menu

Explore Projects Groups Snippets