Skip to content

Commit 32c079c

Browse files
committed
Merge branch 'master' into alpha
2 parents fd4243c + a74cc03 commit 32c079c

File tree

7 files changed

+31
-7
lines changed

7 files changed

+31
-7
lines changed

mathjax3-ts/output/chtml/Wrappers/TextNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class CHTMLTextNode extends CHTMLWrapper {
8585
/*
8686
* @param{string} variant The variant in which to look for the character
8787
* @param{number} n The number of the character to look up
88-
* @param{CharData} The full CharData object, with CharOptions guaranteed to be defined
88+
* @return{CharData} The full CharData object, with CharOptions guaranteed to be defined
8989
*/
9090
protected getChar(variant: string, n: number) {
9191
const char = this.font.getChar(variant, n) || [0, 0, 0, null];

mathjax3-ts/output/chtml/Wrappers/mrow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class CHTMLmrow extends CHTMLWrapper {
7272
}
7373

7474
/*
75-
* Handle the case where a child as a percentage width by
75+
* Handle the case where a child has a percentage width by
7676
* marking the parent as 100% width.
7777
*/
7878
protected makeFullWidth() {

mathjax3-ts/output/chtml/Wrappers/msqrt.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ export class CHTMLmsqrt extends CHTMLWrapper {
158158
surd.toCHTML(SURD);
159159
base.toCHTML(BASE);
160160
if (surd.size < 0) {
161+
//
162+
// size < 0 means surd is multi-character. The angle glyph at the
163+
// top is hard to align with the horizontal line, so overlap them
164+
// using CSS.
165+
//
161166
SQRT.classList.add('mjx-tall');
162167
}
163168
}

mathjax3-ts/output/chtml/Wrappers/msubsup.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,19 @@ export class CHTMLmsubsup extends CHTMLscriptbase {
173173
const t = 3 * tex.rule_thickness;
174174
const subscriptshift = this.length2em(this.node.attributes.get('subscriptshift'), tex.sub2);
175175
const drop = (this.isCharBase() ? 0 : basebox.d + tex.sub_drop * subbox.rscale);
176+
//
177+
// u and v are the veritcal shifts of the scripts, initially set to minimum values and then adjusted
178+
//
176179
let [u, v] = [this.getU(basebox, supbox), Math.max(drop, subscriptshift)];
180+
//
181+
// q is the space currently between the super- and subscripts.
182+
// If it is less than 3 rule thicknesses,
183+
// increase the subscript offset to make the space 3 rule thicknesses
184+
// If the bottom of the superscript is below 4/5 of the x-height
185+
// raise both the super- and subscripts by the difference
186+
// (make the bottom of the superscript be at 4/5 the x-height, and the
187+
// subscript 3 rule thickness below that).
188+
//
177189
let q = (u - supbox.d * supbox.rscale) - (subbox.h * subbox.rscale - v);
178190
if (q < t) {
179191
v += t - q;
@@ -183,6 +195,10 @@ export class CHTMLmsubsup extends CHTMLscriptbase {
183195
v -= p;
184196
}
185197
}
198+
//
199+
// Make sure the shifts are at least the minimum amounts and
200+
// return the shifts and the space between the scripts
201+
//
186202
u = Math.max(this.length2em(this.node.attributes.get('superscriptshift'), u), u);
187203
v = Math.max(this.length2em(this.node.attributes.get('subscriptshift'), v), v);
188204
q = (u - supbox.d * supbox.rscale) - (subbox.h * subbox.rscale - v);

mathjax3-ts/output/chtml/Wrappers/munderover.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ export class CHTMLmunder extends CHTMLmsub {
9090
const basebox = this.baseChild.getBBox();
9191
const underbox = this.script.getBBox();
9292
const [k, v] = this.getUnderKV(basebox, underbox);
93-
const delta = DELTA * this.baseCore.bbox.ic / 2;
93+
const del = DELTA * this.baseCore.bbox.ic / 2;
9494
under.style.paddingTop = this.em(k);
95-
this.setDeltaW([base, under], this.getDeltaW([basebox, underbox], [0, -delta]));
95+
this.setDeltaW([base, under], this.getDeltaW([basebox, underbox], [0, -del]));
9696
}
9797

9898
/*

mathjax3-ts/output/chtml/Wrappers/scriptbase.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ export class CHTMLscriptbase extends CHTMLWrapper {
243243
let m = 0;
244244
for (const i of widths.keys()) {
245245
dw[i] = (w - widths[i]) / 2 + delta[i];
246-
if (dw[i] < m) m = -dw[i];
246+
if (dw[i] < m) {
247+
m = -dw[i];
248+
}
247249
}
248250
if (m) {
249251
for (const i of dw.keys()) {

mathjax3-ts/output/chtml/fonts/tex.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,9 @@ export class TeXFont extends FontData {
554554
const char = vclass + ' mjx-c[c="' + this.char(n) + '"]';
555555
styles['.MJX-TEX' + char + '::before'] = css;
556556
if (options.ic) {
557-
styles['.MJX-TEX mjx-mi:not([noIC="true"])' + char.substr(1) + ':last-child::before'] =
558-
styles['.MJX-TEX mjx-mo:not([noIC="true"])' + char.substr(1) + ':last-child::before'] = {
557+
const [MJX, noIC] = ['.MJX-TEX mjx-', ':not([noIC="true"])' + char.substr(1) + ':last-child::before'];
558+
styles[MJX + 'mi' + noIC] =
559+
styles[MJX + 'mo' + noIC] = {
559560
width: this.em(w + options.ic)
560561
};
561562
}

0 commit comments

Comments
 (0)