@@ -2718,44 +2718,12 @@ def subsuper(self, s, loc, toks):
2718
2718
"Subscript/superscript sequence is too long. "
2719
2719
"Use braces { } to remove ambiguity." )
2720
2720
2721
- # We remove kerning for consistency (otherwise it will compute kerning
2722
- # based on non-shrinked characters and may put them very close together
2723
- # when superscripted)
2724
- # We change the width of the last character to match the advance to
2725
- # consider some fonts with weird metrics: e.g. stix's f has a width of
2726
- # 7.75 and a kerning of -4.0 for an advance of 3.72, and we want to put
2727
- # the superscript at the advance
2728
- last_char = nucleus
2729
- if isinstance (nucleus ,Hlist ):
2730
- new_children = nucleus .children
2731
- if len (new_children ):
2732
- # remove last kern
2733
- if isinstance (new_children [- 1 ],Kern ):
2734
- new_children = new_children [:- 1 ]
2735
- last_char = new_children [- 1 ]
2736
- last_char .width = last_char ._metrics .advance
2737
- # create new Hlist without kerning
2738
- nucleus = Hlist (new_children , do_kern = False )
2739
- else :
2740
- last_char .width = last_char ._metrics .advance
2741
- nucleus = Hlist ([nucleus ])
2742
-
2743
2721
state = self .get_state ()
2744
2722
rule_thickness = state .font_output .get_underline_thickness (
2745
2723
state .font , state .fontsize , state .dpi )
2746
2724
xHeight = state .font_output .get_xheight (
2747
2725
state .font , state .fontsize , state .dpi )
2748
2726
2749
- fs = rcParams ['mathtext.fontset' ]
2750
- # If a custom fontset is used, check if it is Arev Sans, otherwise use
2751
- # CM parameters.
2752
- if fs == 'custom' :
2753
- if (rcParams ['mathtext.rm' ] == 'sans' and
2754
- rcParams ['font.sans-serif' ][0 ].lower () == 'Arev Sans' .lower ()):
2755
- fs = 'arevsans'
2756
- else :
2757
- fs = 'cm'
2758
-
2759
2727
if napostrophes :
2760
2728
if super is None :
2761
2729
super = Hlist ([])
@@ -2791,6 +2759,38 @@ def subsuper(self, s, loc, toks):
2791
2759
result = Hlist ([vlist ])
2792
2760
return [result ]
2793
2761
2762
+ # We remove kerning for consistency (otherwise it will compute kerning
2763
+ # based on non-shrinked characters and may put them very close together
2764
+ # when superscripted)
2765
+ # We change the width of the last character to match the advance to
2766
+ # consider some fonts with weird metrics: e.g. stix's f has a width of
2767
+ # 7.75 and a kerning of -4.0 for an advance of 3.72, and we want to put
2768
+ # the superscript at the advance
2769
+ last_char = nucleus
2770
+ if isinstance (nucleus ,Hlist ):
2771
+ new_children = nucleus .children
2772
+ if len (new_children ):
2773
+ # remove last kern
2774
+ if isinstance (new_children [- 1 ],Kern ):
2775
+ new_children = new_children [:- 1 ]
2776
+ last_char = new_children [- 1 ]
2777
+ last_char .width = last_char ._metrics .advance
2778
+ # create new Hlist without kerning
2779
+ nucleus = Hlist (new_children , do_kern = False )
2780
+ else :
2781
+ last_char .width = last_char ._metrics .advance
2782
+ nucleus = Hlist ([nucleus ])
2783
+
2784
+ fs = rcParams ['mathtext.fontset' ]
2785
+ # If a custom fontset is used, check if it is Arev Sans, otherwise use
2786
+ # CM parameters.
2787
+ if fs == 'custom' :
2788
+ if (rcParams ['mathtext.rm' ] == 'sans' and
2789
+ rcParams ['font.sans-serif' ][0 ].lower () == 'Arev Sans' .lower ()):
2790
+ fs = 'arevsans'
2791
+ else :
2792
+ fs = 'cm'
2793
+
2794
2794
# Handle regular sub/superscripts
2795
2795
lc_height = last_char .height
2796
2796
lc_baseline = 0
0 commit comments