Skip to content

Commit a92d7a2

Browse files
committed
Fixes requested by Volker's review
1 parent bc316ad commit a92d7a2

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

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

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

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
@@ -80,9 +80,9 @@ export class CHTMLmunder extends CHTMLmsub {
8080
const basebox = this.base.getBBox();
8181
const underbox = this.script.getBBox();
8282
const [k, v] = this.getUnderKV(basebox, underbox);
83-
const delta = DELTA * this.baseCore.bbox.ic / 2;
83+
const del = DELTA * this.baseCore.bbox.ic / 2;
8484
under.style.paddingTop = this.em(k);
85-
this.setDeltaW([base, under], this.getDeltaW([basebox, underbox], [0, -delta]));
85+
this.setDeltaW([base, under], this.getDeltaW([basebox, underbox], [0, -del]));
8686
}
8787

8888
/*

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ export class CHTMLscriptbase extends CHTMLWrapper {
242242
let m = 0;
243243
for (const i of widths.keys()) {
244244
dw[i] = (w - widths[i]) / 2 + delta[i];
245-
if (dw[i] < m) m = -dw[i];
245+
if (dw[i] < m) {
246+
m = -dw[i];
247+
}
246248
}
247249
if (m) {
248250
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
@@ -444,8 +444,9 @@ export class TeXFont extends FontData {
444444
const char = vclass + ' mjx-c[c="' + this.char(n) + '"]';
445445
styles['.MJX-TEX' + char + '::before'] = css;
446446
if (options.ic) {
447-
styles['.MJX-TEX mjx-mi:not([noIC="true"])' + char.substr(1) + ':last-child::before'] =
448-
styles['.MJX-TEX mjx-mo:not([noIC="true"])' + char.substr(1) + ':last-child::before'] = {
447+
const [MJX, noIC] = ['.MJX-TEX mjx-', ':not([noIC="true"])' + char.substr(1) + ':last-child::before'];
448+
styles[MJX + 'mi' + noIC] =
449+
styles[MJX + 'mo' + noIC] = {
449450
width: this.em(w + options.ic)
450451
};
451452
}

0 commit comments

Comments
 (0)