@@ -412,6 +412,13 @@ export function CommonMsubsupMixin<
412
412
return this . childNodes [ ( this . node as MmlMsubsup ) . sup ] ;
413
413
}
414
414
415
+ /**
416
+ * @override
417
+ */
418
+ public get scriptChild ( ) : WW {
419
+ return this . supChild ;
420
+ }
421
+
415
422
/**
416
423
* @override
417
424
*/
@@ -426,23 +433,26 @@ export function CommonMsubsupMixin<
426
433
const t = 3 * tex . rule_thickness ;
427
434
const subscriptshift = this . length2em ( this . node . attributes . get ( 'subscriptshift' ) , tex . sub2 ) ;
428
435
const drop = this . baseCharZero ( bbox . d * this . baseScale + tex . sub_drop * subbox . rscale ) ;
436
+ const supd = supbox . d * supbox . rscale ;
437
+ const subh = subbox . h * subbox . rscale ;
429
438
//
430
439
// u and v are the veritcal shifts of the scripts, initially set to minimum values and then adjusted
431
440
//
432
441
let [ u , v ] = [ this . getU ( ) , Math . max ( drop , subscriptshift ) ] ;
433
442
//
434
443
// q is the space currently between the super- and subscripts.
435
444
// If it is less than 3 rule thicknesses,
436
- // increase the subscript offset to make the space 3 rule thicknesses
445
+ // Increase the subscript offset to make the space 3 rule thicknesses
437
446
// If the bottom of the superscript is below 4/5 of the x-height
438
447
// raise both the super- and subscripts by the difference
439
448
// (make the bottom of the superscript be at 4/5 the x-height, and the
440
- // subscript 3 rule thickness below that).
449
+ // subscript 3 rule thickness below that),
450
+ // provided we don't move up past the original subscript position.
441
451
//
442
- let q = ( u - supbox . d * supbox . rscale ) - ( subbox . h * subbox . rscale - v ) ;
452
+ let q = ( u - supd ) - ( subh - v ) ;
443
453
if ( q < t ) {
444
454
v += t - q ;
445
- const p = ( 4 / 5 ) * tex . x_height - ( u - supbox . d * supbox . rscale ) ;
455
+ const p = ( 4 / 5 ) * tex . x_height - ( u - supd ) ;
446
456
if ( p > 0 ) {
447
457
u += p ;
448
458
v -= p ;
@@ -454,7 +464,7 @@ export function CommonMsubsupMixin<
454
464
//
455
465
u = Math . max ( this . length2em ( this . node . attributes . get ( 'superscriptshift' ) , u ) , u ) ;
456
466
v = Math . max ( this . length2em ( this . node . attributes . get ( 'subscriptshift' ) , v ) , v ) ;
457
- q = ( u - supbox . d * supbox . rscale ) - ( subbox . h * subbox . rscale - v ) ;
467
+ q = ( u - supd ) - ( subh - v ) ;
458
468
this . UVQ = [ u , - v , q ] ;
459
469
return this . UVQ ;
460
470
}
0 commit comments