@@ -98,8 +98,9 @@ def __init__(self, box):
9898 self .rects = [] # (x1, y1, x2, y2)
9999
100100 def to_vector (self ):
101- w , h , d = map (
102- np .ceil , [self .box .width , self .box .height , self .box .depth ])
101+ w = self .box .width
102+ h = self .box .height
103+ d = self .box .depth
103104 gs = [(info .font , info .fontsize , info .num , ox , h - oy + info .offset )
104105 for ox , oy , info in self .glyphs ]
105106 rs = [(x1 , h - y2 , x2 - x1 , y2 - y1 )
@@ -116,10 +117,12 @@ def to_raster(self, antialiased=None):
116117 xmax = max ([* [ox + info .metrics .xmax for ox , oy , info in self .glyphs ],
117118 * [x2 for x1 , y1 , x2 , y2 in self .rects ], 0 ]) + 1
118119 ymax = max ([* [oy - info .metrics .ymin for ox , oy , info in self .glyphs ],
119- * [y2 for x1 , y1 , x2 , y2 in self .rects ], 0 ]) + 1
120- w , h , d = map (
121- np .ceil , [self .box .width , self .box .height , self .box .depth ])
122- image = FT2Image (np .ceil (w ), np .ceil (h + max (d , 0 )))
120+ * [y2 for x1 , y1 , x2 , y2 in self .rects ], 0 ]) + 1.5
121+
122+ w = self .box .width
123+ h = ymax - ymin - self .box .depth
124+ d = ymax - ymin - self .box .height
125+ image = FT2Image (w , h + max (d , 0 ))
123126
124127 # Ideally, we could just use self.glyphs and self.rects here, shifting
125128 # their coordinates by (-xmin, -ymin), but this yields slightly
@@ -2448,7 +2451,6 @@ def _genfrac(self, ldelim, rdelim, rule, style, num, den):
24482451 cnum .hpack (width , 'exactly' )
24492452 cden .hpack (width , 'exactly' )
24502453 vlist = Vlist ([cnum , # numerator
2451- Vbox (0 , thickness * 2.0 ), # space
24522454 Hrule (state , rule ), # rule
24532455 Vbox (0 , thickness * 2.0 ), # space
24542456 cden # denominator
@@ -2461,7 +2463,7 @@ def _genfrac(self, ldelim, rdelim, rule, style, num, den):
24612463 '=' , state .fontsize , state .dpi )
24622464 shift = (cden .height -
24632465 ((metrics .ymax + metrics .ymin ) / 2 -
2464- thickness * 3.0 ))
2466+ thickness * 1.5 ))
24652467 vlist .shift_amount = shift
24662468
24672469 result = [Hlist ([vlist , Hbox (thickness * 2. )])]
0 commit comments