1616
1717
1818def text (
19- string : str , font : HersheyFont = FUTURAL , spacing : float = 0 , extra : float = 0
19+ string : str , font : HersheyFont = FUTURAL , spacing : float = 0 , extra : float = 0
2020) -> shapely .MultiLineString :
2121 results : list [shapely .LineString ] = []
2222 x = 0
@@ -29,11 +29,11 @@ def text(
2929 for path in coords :
3030 path = [(x + i - lt , j ) for i , j in path ]
3131 if path :
32- results += shapely .linestrings (path )
32+ results . append ( shapely .LineString (path ) )
3333 x += rt - lt + spacing
3434 if index == 0 :
3535 x += extra
36- return shapely .union_all (results )
36+ return shapely .MultiLineString (results )
3737
3838
3939def word_wrap (string : str , width : float , measure_func ) -> list [str ]:
@@ -87,11 +87,11 @@ def measure(self, string: str) -> tuple[float, float]:
8787 return size (t )
8888
8989 def wrap (
90- self ,
91- string : str ,
92- width : float ,
93- line_spacing : float = 1 ,
94- align : float = 0 ,
90+ self ,
91+ string : str ,
92+ width : float ,
93+ line_spacing : float = 1 ,
94+ align : float = 0 ,
9595 ) -> shapely .MultiLineString :
9696 """
9797 Render a given string such that the text is confined to a column of a given width by inserting line breaks.
@@ -117,9 +117,9 @@ def wrap(
117117 if align == 0 :
118118 x = 0
119119 elif align == 1 :
120- x = ( max_width - w )
120+ x = max_width - w
121121 else :
122- x = ( max_width / 2 - w / 2 )
122+ x = max_width / 2 - w / 2
123123 line_shape = affinity .translate (line_shape , x , y )
124124 result .append (line_shape )
125125 y += spacing
0 commit comments