@@ -253,9 +253,7 @@ def render_glyph(self, ox, oy, info):
253253
254254 def render_rect_filled (self , x1 , y1 , x2 , y2 ):
255255 font = self .fonts_object .get_fonts ()[0 ]
256- font .draw_rect_filled (
257- int (x1 + 0.5 ), int (y1 + 0.5 ) - 1 ,
258- int (x2 - 0.5 ), int (y2 - 0.5 ) - 1 )
256+ font .draw_rect_filled (x1 , y1 , x2 , y2 - 1 )
259257
260258 def get_results (self ):
261259 return (self .width ,
@@ -329,7 +327,7 @@ def render_glyph(self, ox, oy, info):
329327
330328 def render_rect_filled (self , x1 , y1 , x2 , y2 ):
331329 self .svg_rects .append (
332- (x1 , self .height - y2 , x2 - x1 , y2 - y1 ))
330+ (x1 , self .height - y1 + 1 , x2 - x1 , y2 - y1 ))
333331
334332 def get_results (self ):
335333 svg_elements = Bunch (svg_glyphs = self .svg_glyphs ,
@@ -559,8 +557,7 @@ def get_xheight(self, font, fontsize, dpi):
559557
560558 def get_underline_thickness (self , font , fontsize , dpi ):
561559 cached_font = self ._get_font (font )
562- cached_font .font .set_size (fontsize , dpi )
563- return max (1.0 , cached_font .font .underline_thickness / 64.0 )
560+ return max (1.0 , cached_font .font .underline_thickness / 64.0 / fontsize * 10.0 )
564561
565562 def get_kern (self , font1 , sym1 , fontsize1 ,
566563 font2 , sym2 , fontsize2 , dpi ):
@@ -1102,10 +1099,18 @@ def _update_metrics(self):
11021099 self .height = metrics .ymax - metrics .ymin
11031100 self .depth = 0
11041101
1102+ def shrink (self ):
1103+ Char .shrink (self )
1104+ self ._update_metrics ()
1105+
1106+ def grow (self ):
1107+ Char .grow (self )
1108+ self ._update_metrics ()
1109+
11051110 def render (self , x , y ):
11061111 """Render the character to the canvas"""
11071112 self .font_output .render_glyph (
1108- x , y + ( self ._metrics .ymax - self .height ) ,
1113+ x - self ._metrics .xmin , y + self ._metrics . ymin ,
11091114 self .font , self .c , self .fontsize , self .dpi )
11101115
11111116class List (Box ):
@@ -2264,8 +2269,8 @@ def frac(self, s, loc, toks):
22642269 metrics = state .font_output .get_metrics (
22652270 state .font , '=' , state .fontsize , state .dpi )
22662271 shift = (cden .height -
2267- (metrics .ymax + metrics .ymin ) / 2 +
2268- thickness * 2.5 )
2272+ (( metrics .ymax + metrics .ymin ) / 2 -
2273+ thickness * 3.0 ) )
22692274 vlist .shift_amount = shift
22702275
22712276 hlist = Hlist ([vlist , Hbox (thickness * 2. )])
@@ -2316,7 +2321,6 @@ def sqrt(self, s, loc, toks):
23162321 # Negative kerning to put root over tick
23172322 Kern (- check .width * 0.5 ),
23182323 check , # Check
2319- Kern (- thickness * 0.3 ), # Push check into rule slightly
23202324 rightside ]) # Body
23212325 return [hlist ]
23222326
0 commit comments