@@ -890,7 +890,6 @@ def __init__(self, *args, **kwargs):
890
890
self .fontmap = {}
891
891
# Include Stix sized alternatives for glyphs
892
892
self ._fontmap .update ({
893
- 0 : 'STIXGeneral' ,
894
893
1 : 'STIXSizeOneSym' ,
895
894
2 : 'STIXSizeTwoSym' ,
896
895
3 : 'STIXSizeThreeSym' ,
@@ -932,6 +931,7 @@ class DejaVuSerifFonts(DejaVuFonts):
932
931
'sf' : 'DejaVu Sans' ,
933
932
'tt' : 'DejaVu Sans Mono' ,
934
933
'ex' : 'DejaVu Serif Display' ,
934
+ 0 : 'DejaVu Serif' ,
935
935
}
936
936
937
937
class DejaVuSansFonts (DejaVuFonts ):
@@ -946,6 +946,7 @@ class DejaVuSansFonts(DejaVuFonts):
946
946
'sf' : 'DejaVu Sans' ,
947
947
'tt' : 'DejaVu Sans Mono' ,
948
948
'ex' : 'DejaVu Sans Display' ,
949
+ 0 : 'DejaVu Sans' ,
949
950
}
950
951
951
952
class StixFonts (UnicodeFonts ):
@@ -1996,20 +1997,28 @@ def __init__(self, c, height, depth, state, always=False, factor=None):
1996
1997
alternatives = state .font_output .get_sized_alternatives_for_symbol (
1997
1998
state .font , c )
1998
1999
2000
+ xHeight = state .font_output .get_xheight (
2001
+ state .font , state .fontsize , state .dpi )
2002
+
1999
2003
state = state .copy ()
2000
2004
target_total = height + depth
2001
2005
for fontname , sym in alternatives :
2002
2006
state .font = fontname
2003
2007
char = Char (sym , state )
2004
- if char .height + char .depth >= target_total :
2008
+ # Ensure that size 0 is chosen when the text is regular sized but
2009
+ # with descender glyphs by subtracting 0.2 * xHeight
2010
+ if char .height + char .depth >= target_total - 0.2 * xHeight :
2005
2011
break
2006
2012
2007
- if factor is None :
2008
- factor = target_total / (char .height + char .depth )
2009
- state .fontsize *= factor
2010
- char = Char (sym , state )
2013
+ shift = 0
2014
+ if state .font != 0 :
2015
+ if factor is None :
2016
+ factor = (target_total ) / (char .height + char .depth )
2017
+ state .fontsize *= factor
2018
+ char = Char (sym , state )
2019
+
2020
+ shift = (depth - char .depth )
2011
2021
2012
- shift = (depth - char .depth )
2013
2022
Hlist .__init__ (self , [char ])
2014
2023
self .shift_amount = shift
2015
2024
0 commit comments