@@ -851,7 +851,7 @@ def __init__(self):
851851 self .size = 0
852852
853853 def __repr__ (self ):
854- return self . __class__ .__name__
854+ return type ( self ) .__name__
855855
856856 def get_kerning (self , next ):
857857 return 0.0
@@ -864,7 +864,7 @@ def shrink(self):
864864 self .size += 1
865865
866866 def render (self , x , y ):
867- pass
867+ """Render this node."""
868868
869869
870870class Box (Node ):
@@ -961,12 +961,8 @@ def get_kerning(self, next):
961961 return advance + kern
962962
963963 def render (self , x , y ):
964- """
965- Render the character to the canvas
966- """
967964 self .font_output .render_glyph (
968- x , y ,
969- self .font , self .font_class , self .c , self .fontsize , self .dpi )
965+ x , y , self .font , self .font_class , self .c , self .fontsize , self .dpi )
970966
971967 def shrink (self ):
972968 super ().shrink ()
@@ -995,9 +991,6 @@ def shrink(self):
995991 self ._update_metrics ()
996992
997993 def render (self , x , y ):
998- """
999- Render the character to the canvas.
1000- """
1001994 self .font_output .render_glyph (
1002995 x - self ._metrics .xmin , y + self ._metrics .ymin ,
1003996 self .font , self .font_class , self .c , self .fontsize , self .dpi )
@@ -1022,21 +1015,10 @@ def __repr__(self):
10221015 self .depth , self .shift_amount ,
10231016 ', ' .join ([repr (x ) for x in self .children ]))
10241017
1025- @staticmethod
1026- def _determine_order (totals ):
1027- """
1028- Determine the highest order of glue used by the members of this list.
1029-
1030- Helper function used by vpack and hpack.
1031- """
1032- for i in range (len (totals ))[::- 1 ]:
1033- if totals [i ] != 0 :
1034- return i
1035- return 0
1036-
10371018 def _set_glue (self , x , sign , totals , error_type ):
1038- o = self ._determine_order (totals )
1039- self .glue_order = o
1019+ self .glue_order = o = next (
1020+ # Highest order of glue used by the members of this list.
1021+ (i for i in range (len (totals ))[::- 1 ] if totals [i ] != 0 ), 0 )
10401022 self .glue_sign = sign
10411023 if totals [o ] != 0. :
10421024 self .glue_set = x / totals [o ]
@@ -1046,7 +1028,7 @@ def _set_glue(self, x, sign, totals, error_type):
10461028 if o == 0 :
10471029 if len (self .children ):
10481030 _log .warning ("%s %s: %r" ,
1049- error_type , self . __class__ .__name__ , self )
1031+ error_type , type ( self ) .__name__ , self )
10501032
10511033 def shrink (self ):
10521034 for child in self .children :
@@ -1372,21 +1354,6 @@ def shrink(self):
13721354 self .width *= SHRINK_FACTOR
13731355
13741356
1375- class SubSuperCluster (Hlist ):
1376- """
1377- A hack to get around that fact that this code does a two-pass parse like
1378- TeX. This lets us store enough information in the hlist itself, namely the
1379- nucleus, sub- and super-script, such that if another script follows that
1380- needs to be attached, it can be reconfigured on the fly.
1381- """
1382-
1383- def __init__ (self ):
1384- self .nucleus = None
1385- self .sub = None
1386- self .super = None
1387- super ().__init__ ([])
1388-
1389-
13901357class AutoHeightChar (Hlist ):
13911358 """
13921359 A character as close to the given height and depth as possible.
0 commit comments