@@ -1187,15 +1187,16 @@ def get_underline_thickness(self, font, fontsize, dpi):
1187
1187
# get any smaller
1188
1188
NUM_SIZE_LEVELS = 6
1189
1189
# Percentage of x-height of additional horiz. space after sub/superscripts
1190
- SCRIPT_SPACE = 0.2
1190
+ SCRIPT_SPACE = - 0.10
1191
1191
# Percentage of x-height that sub/superscripts drop below the baseline
1192
1192
SUBDROP = 0.3
1193
1193
# Percentage of x-height that superscripts drop below the baseline
1194
- SUP1 = 0.5
1194
+ SUP1 = 0.4
1195
1195
# Percentage of x-height that subscripts drop below the baseline
1196
1196
SUB1 = 0.0
1197
- # Percentage of x-height that superscripts are offset relative to the subscript
1198
- DELTA = 0.18
1197
+ # Percentage of x-height that supercripts are offset relative to the subscript
1198
+ # for slanted nuclei
1199
+ DELTA = 0.15
1199
1200
1200
1201
class MathTextWarning (Warning ):
1201
1202
pass
@@ -2736,33 +2737,30 @@ def subsuper(self, s, loc, toks):
2736
2737
# node757
2737
2738
sub .shrink ()
2738
2739
x = Hlist ([sub ])
2739
- # x.width += SCRIPT_SPACE * xHeight
2740
+ x .width += SCRIPT_SPACE * xHeight
2740
2741
shift_down = max (shift_down , SUB1 )
2741
2742
clr = x .height - (abs (xHeight * 4.0 ) / 5.0 )
2742
2743
shift_down = max (shift_down , clr )
2743
- x .shift_amount = shift_down
2744
+ x .shift_amount = shift_down / 2.
2744
2745
else :
2745
2746
super .shrink ()
2746
2747
x = Hlist ([super ])
2747
- # x.width += SCRIPT_SPACE * xHeight
2748
- clr = SUP1 * xHeight
2749
- shift_up = max (shift_up , clr )
2750
- clr = x .depth + (abs (xHeight ) / 4.0 )
2751
- shift_up = max (shift_up , clr )
2748
+ x .width += SCRIPT_SPACE * xHeight
2749
+ shift_up = SUP1 * xHeight
2750
+ if self .is_slanted (nucleus ):
2751
+ x = Hlist ([Kern (DELTA * x .height ),x ])
2752
2752
if sub is None :
2753
2753
x .shift_amount = - shift_up
2754
2754
else : # Both sub and superscript
2755
2755
sub .shrink ()
2756
2756
y = Hlist ([sub ])
2757
- # y.width += SCRIPT_SPACE * xHeight
2757
+ y .width += SCRIPT_SPACE * xHeight
2758
2758
shift_down = max (shift_down , SUB1 * xHeight )
2759
+ # If sub and superscript collide, move sup up
2759
2760
clr = (2.0 * rule_thickness -
2760
2761
((shift_up - x .depth ) - (y .height - shift_down )))
2761
2762
if clr > 0. :
2762
2763
shift_up += clr
2763
- shift_down += clr
2764
- if self .is_slanted (nucleus ):
2765
- x .shift_amount = DELTA * (shift_up + shift_down )
2766
2764
x = Vlist ([x ,
2767
2765
Kern ((shift_up - x .depth ) - (y .height - shift_down )),
2768
2766
y ])
0 commit comments