@@ -890,7 +890,6 @@ def __init__(self, *args, **kwargs):
890890 self .fontmap = {}
891891 # Include Stix sized alternatives for glyphs
892892 self ._fontmap .update ({
893- 0 : 'STIXGeneral' ,
894893 1 : 'STIXSizeOneSym' ,
895894 2 : 'STIXSizeTwoSym' ,
896895 3 : 'STIXSizeThreeSym' ,
@@ -932,6 +931,7 @@ class DejaVuSerifFonts(DejaVuFonts):
932931 'sf' : 'DejaVu Sans' ,
933932 'tt' : 'DejaVu Sans Mono' ,
934933 'ex' : 'DejaVu Serif Display' ,
934+ 0 : 'DejaVu Serif' ,
935935 }
936936
937937class DejaVuSansFonts (DejaVuFonts ):
@@ -946,6 +946,7 @@ class DejaVuSansFonts(DejaVuFonts):
946946 'sf' : 'DejaVu Sans' ,
947947 'tt' : 'DejaVu Sans Mono' ,
948948 'ex' : 'DejaVu Sans Display' ,
949+ 0 : 'DejaVu Sans' ,
949950 }
950951
951952class StixFonts (UnicodeFonts ):
@@ -1996,20 +1997,28 @@ def __init__(self, c, height, depth, state, always=False, factor=None):
19961997 alternatives = state .font_output .get_sized_alternatives_for_symbol (
19971998 state .font , c )
19981999
2000+ xHeight = state .font_output .get_xheight (
2001+ state .font , state .fontsize , state .dpi )
2002+
19992003 state = state .copy ()
20002004 target_total = height + depth
20012005 for fontname , sym in alternatives :
20022006 state .font = fontname
20032007 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 :
20052011 break
20062012
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 )
20112021
2012- shift = (depth - char .depth )
20132022 Hlist .__init__ (self , [char ])
20142023 self .shift_amount = shift
20152024
0 commit comments