@@ -896,7 +896,6 @@ def __init__(self, *args, **kwargs):
896
896
self .fontmap = {}
897
897
# Include Stix sized alternatives for glyphs
898
898
self ._fontmap .update ({
899
- 0 : 'STIXGeneral' ,
900
899
1 : 'STIXSizeOneSym' ,
901
900
2 : 'STIXSizeTwoSym' ,
902
901
3 : 'STIXSizeThreeSym' ,
@@ -938,6 +937,7 @@ class DejaVuSerifFonts(DejaVuFonts):
938
937
'sf' : 'DejaVu Sans' ,
939
938
'tt' : 'DejaVu Sans Mono' ,
940
939
'ex' : 'DejaVu Serif Display' ,
940
+ 0 : 'DejaVu Serif' ,
941
941
}
942
942
943
943
class DejaVuSansFonts (DejaVuFonts ):
@@ -952,6 +952,7 @@ class DejaVuSansFonts(DejaVuFonts):
952
952
'sf' : 'DejaVu Sans' ,
953
953
'tt' : 'DejaVu Sans Mono' ,
954
954
'ex' : 'DejaVu Sans Display' ,
955
+ 0 : 'DejaVu Sans' ,
955
956
}
956
957
957
958
class StixFonts (UnicodeFonts ):
@@ -2003,20 +2004,28 @@ def __init__(self, c, height, depth, state, always=False, factor=None):
2003
2004
alternatives = state .font_output .get_sized_alternatives_for_symbol (
2004
2005
state .font , c )
2005
2006
2007
+ xHeight = state .font_output .get_xheight (
2008
+ state .font , state .fontsize , state .dpi )
2009
+
2006
2010
state = state .copy ()
2007
2011
target_total = height + depth
2008
2012
for fontname , sym in alternatives :
2009
2013
state .font = fontname
2010
2014
char = Char (sym , state )
2011
- if char .height + char .depth >= target_total :
2015
+ # Ensure that size 0 is chosen when the text is regular sized but
2016
+ # with descender glyphs by subtracting 0.2 * xHeight
2017
+ if char .height + char .depth >= target_total - 0.2 * xHeight :
2012
2018
break
2013
2019
2014
- if factor is None :
2015
- factor = target_total / (char .height + char .depth )
2016
- state .fontsize *= factor
2017
- char = Char (sym , state )
2020
+ shift = 0
2021
+ if state .font != 0 :
2022
+ if factor is None :
2023
+ factor = (target_total ) / (char .height + char .depth )
2024
+ state .fontsize *= factor
2025
+ char = Char (sym , state )
2026
+
2027
+ shift = (depth - char .depth )
2018
2028
2019
- shift = (depth - char .depth )
2020
2029
Hlist .__init__ (self , [char ])
2021
2030
self .shift_amount = shift
2022
2031
0 commit comments