@@ -851,7 +851,7 @@ def __init__(self):
851
851
self .size = 0
852
852
853
853
def __repr__ (self ):
854
- return self . __class__ .__name__
854
+ return type ( self ) .__name__
855
855
856
856
def get_kerning (self , next ):
857
857
return 0.0
@@ -864,7 +864,7 @@ def shrink(self):
864
864
self .size += 1
865
865
866
866
def render (self , x , y ):
867
- pass
867
+ """Render this node."""
868
868
869
869
870
870
class Box (Node ):
@@ -961,12 +961,8 @@ def get_kerning(self, next):
961
961
return advance + kern
962
962
963
963
def render (self , x , y ):
964
- """
965
- Render the character to the canvas
966
- """
967
964
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 )
970
966
971
967
def shrink (self ):
972
968
super ().shrink ()
@@ -995,9 +991,6 @@ def shrink(self):
995
991
self ._update_metrics ()
996
992
997
993
def render (self , x , y ):
998
- """
999
- Render the character to the canvas.
1000
- """
1001
994
self .font_output .render_glyph (
1002
995
x - self ._metrics .xmin , y + self ._metrics .ymin ,
1003
996
self .font , self .font_class , self .c , self .fontsize , self .dpi )
@@ -1022,21 +1015,10 @@ def __repr__(self):
1022
1015
self .depth , self .shift_amount ,
1023
1016
', ' .join ([repr (x ) for x in self .children ]))
1024
1017
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
-
1037
1018
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 )
1040
1022
self .glue_sign = sign
1041
1023
if totals [o ] != 0. :
1042
1024
self .glue_set = x / totals [o ]
@@ -1046,7 +1028,7 @@ def _set_glue(self, x, sign, totals, error_type):
1046
1028
if o == 0 :
1047
1029
if len (self .children ):
1048
1030
_log .warning ("%s %s: %r" ,
1049
- error_type , self . __class__ .__name__ , self )
1031
+ error_type , type ( self ) .__name__ , self )
1050
1032
1051
1033
def shrink (self ):
1052
1034
for child in self .children :
@@ -1372,21 +1354,6 @@ def shrink(self):
1372
1354
self .width *= SHRINK_FACTOR
1373
1355
1374
1356
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
-
1390
1357
class AutoHeightChar (Hlist ):
1391
1358
"""
1392
1359
A character as close to the given height and depth as possible.
0 commit comments