@@ -205,7 +205,6 @@ def _create_background_box(self, lines: int, y_offset: int) -> None:
205205 y = movy ,
206206 )
207207
208-
209208 return tile_grid
210209
211210 def _update_background_color (self , new_color : int ) -> None :
@@ -258,11 +257,12 @@ def _update_background_color(self, new_color: int) -> None:
258257 self ._bounding_box [3 ] + self ._padding_top + self ._padding_bottom > 0
259258 )
260259 ):
261- self .local_group [0 ] = self ._create_background_box (lines , y_offset )
260+ self .local_group [0 ] = self ._create_background_box (lines , self . _y_offset )
262261 else : # delete the existing bitmap
263262 self .local_group .pop (0 )
264263 self ._added_background_tilegrid = False
265264
265+ # pylint: disable = too-many-branches, too-many-statements
266266 def _update_text (
267267 self , new_text : str
268268 ) -> None : # pylint: disable=too-many-locals ,too-many-branches, too-many-statements
@@ -298,10 +298,10 @@ def _update_text(
298298 continue
299299
300300 if self .label_type == "LTR" or self .label_type == "RTL" :
301- bottom = max (bottom , y - glyph .dy + y_offset )
301+ bottom = max (bottom , y - glyph .dy + self . _y_offset )
302302 if y == 0 : # first line, find the Ascender height
303- top = min (top , - glyph .height - glyph .dy + y_offset )
304- position_y = y - glyph .height - glyph .dy + y_offset
303+ top = min (top , - glyph .height - glyph .dy + self . _y_offset )
304+ position_y = y - glyph .height - glyph .dy + self . _y_offset
305305
306306 if self .label_type == "LTR" :
307307 right = max (right , x + glyph .shift_x , x + glyph .width + glyph .dx )
@@ -336,7 +336,7 @@ def _update_text(
336336 right , x + glyph .width + glyph .dx , x + glyph .shift_x + glyph .dx
337337 )
338338 position_y = y + glyph .dy
339- position_x = x - glyph .width // 2 + y_offset
339+ position_x = x - glyph .width // 2 + self . _y_offset
340340
341341 if self .label_type == "UPR" :
342342 if x == 0 :
@@ -345,11 +345,11 @@ def _update_text(
345345
346346 if y == 0 : # first line, find the Ascender height
347347 bottom = min (bottom , - glyph .dy )
348- left = min (left , x - glyph .height + y_offset )
348+ left = min (left , x - glyph .height + self . _y_offset )
349349 top = min (top , y - glyph .width - glyph .dx , y - glyph .shift_x )
350350 right = max (right , x + glyph .height , x + glyph .height - glyph .dy )
351351 position_y = y - glyph .width - glyph .dx
352- position_x = x - glyph .height - glyph .dy + y_offset
352+ position_x = x - glyph .height - glyph .dy + self . _y_offset
353353
354354 if self .label_type == "DWR" :
355355 if y == 0 :
@@ -358,11 +358,11 @@ def _update_text(
358358 top = min (top , - glyph .dx )
359359 if x == 0 :
360360 left = min (left , - glyph .dy )
361- left = min (left , x , x - glyph .dy - y_offset )
361+ left = min (left , x , x - glyph .dy - self . _y_offset )
362362 bottom = max (bottom , y + glyph .width + glyph .dx , y + glyph .shift_x )
363363 right = max (right , x + glyph .height )
364364 position_y = y + glyph .dx
365- position_x = x + glyph .dy - y_offset
365+ position_x = x + glyph .dy - self . _y_offset
366366
367367 if glyph .width > 0 and glyph .height > 0 :
368368 try :
@@ -424,7 +424,7 @@ def _update_text(
424424
425425 while len (self .local_group ) > tilegrid_count : # i:
426426 self .local_group .pop ()
427-
427+ # pylint: disable=invalid-unary-operand-type
428428 if self .label_type == "RTL" :
429429 self ._bounding_box = (- left , top , left - right , bottom - top )
430430 if self .label_type == "TTB" :
0 commit comments