From ba68b8af5dd4073588444af10a37d679696da0c6 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sat, 6 Feb 2021 22:41:23 -0500 Subject: [PATCH 01/11] New parameter and example creation for testing and future reference --- adafruit_display_text/label.py | 17 +++-- ...ay_text_label_align_baseline_comparison.py | 71 +++++++++++++++++++ 2 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 examples/display_text_label_align_baseline_comparison.py diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index 486a14f..2ff124b 100755 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -59,7 +59,9 @@ class Label(displayio.Group): (E.g. (0,0) is top left, (1.0, 0.5): is middle right.) :param (int,int) anchored_position: Position relative to the anchor_point. Tuple containing x,y pixel coordinates. - :param int scale: Integer value of the pixel scaling""" + :param int scale: Integer value of the pixel scaling + :param bool base_alignment: when True allows to align text label to the baseline. + This is helpful when two or more labels need to be aligned to the same baseline""" # pylint: disable=too-many-instance-attributes, too-many-locals # This has a lot of getters/setters, maybe it needs cleanup. @@ -83,6 +85,7 @@ def __init__( anchor_point=None, anchored_position=None, scale=1, + base_alignment=False, **kwargs ): if not max_glyphs and not text: @@ -131,6 +134,7 @@ def __init__( self._padding_right = padding_right self._scale = scale + self.base_alignment = base_alignment if text is not None: self._update_text(str(text)) @@ -161,7 +165,10 @@ def _create_background_box(self, lines, y_offset): + self._padding_top + self._padding_bottom ) - y_box_offset = -ascent + y_offset - self._padding_top + if self.base_alignment: + y_box_offset = -ascent - self._padding_top + else: + y_box_offset = -ascent + y_offset - self._padding_top box_width = max(0, box_width) # remove any negative values box_height = max(0, box_height) # remove any negative values @@ -265,8 +272,10 @@ def _update_text( else: i = 0 tilegrid_count = i - - y_offset = self._get_ascent() // 2 + if self.base_alignment: + y_offset = 0 + else: + y_offset = self._get_ascent() // 2 right = top = bottom = 0 left = None diff --git a/examples/display_text_label_align_baseline_comparison.py b/examples/display_text_label_align_baseline_comparison.py new file mode 100644 index 0000000..2b2016a --- /dev/null +++ b/examples/display_text_label_align_baseline_comparison.py @@ -0,0 +1,71 @@ +import board +from adafruit_display_text import label +from adafruit_bitmap_font import bitmap_font +import displayio +import time + +display = board.DISPLAY + +# Font definition. You can choose any two fonts available in your system +MEDIUM_FONT = bitmap_font.load_font("Helvetica-Bold-16.bdf") +BIG_FONT = bitmap_font.load_font("LeagueSpartan-Bold-16.bdf") + +# Test parameters +TEXT_BACKGROUND_COLOR = 0x990099 +TEXT_COLOR = 0x00FF00 +X_COL_POS = [10, 90] # X position of the Label boxes +TEST_TEXT = [ + "aApPqQ.", + "ppppppp", + "llllll", + "oooooo", + "ñúÇèüß", +] # Iteration text for testing +LOCALISATION_Y = [40, 80, 120, 160, 200] # Y coordinate of the text labels +NUMBER_TEXT_LABELS = len(LOCALISATION_Y) * len( + X_COL_POS +) # Calculation for Display.Group function +TIME_BETWEEN_TEXTS = 5 # Seconds +BASE_ALIGNMENT_OPTIONS = [False, True] + +# Test +for behaviour in BASE_ALIGNMENT_OPTIONS: + for text_test in TEST_TEXT: + main_group = displayio.Group(max_size=NUMBER_TEXT_LABELS + 1) + for position in LOCALISATION_Y: + text = label.Label( + font=MEDIUM_FONT, + text=text_test, + color=TEXT_COLOR, + background_tight=True, + background_color=TEXT_BACKGROUND_COLOR, + x=X_COL_POS[0], + y=position, + base_alignment=behaviour, + ) + main_group.append(text) + text = label.Label( + font=BIG_FONT, + text=text_test, + color=TEXT_COLOR, + background_tight=False, + background_color=TEXT_BACKGROUND_COLOR, + x=X_COL_POS[1], + y=position, + base_alignment=behaviour, + ) + main_group.append(text) + display.show(main_group) + display.refresh() + time.sleep(TIME_BETWEEN_TEXTS) + + +bitmap = displayio.Bitmap(280, 5, 2) +palette = displayio.Palette(2) +palette[0] = 0x004400 +palette[1] = 0x00FFFF +tile_grid2 = displayio.TileGrid(bitmap, pixel_shader=palette, x=10, y=160) +main_group.append(tile_grid2) + +while True: + pass From 3fbb43a61c85278859222e39efacc08e51adc613 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sat, 6 Feb 2021 23:00:44 -0500 Subject: [PATCH 02/11] License identification in example --- examples/display_text_label_align_baseline_comparison.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/display_text_label_align_baseline_comparison.py b/examples/display_text_label_align_baseline_comparison.py index 2b2016a..14a933f 100644 --- a/examples/display_text_label_align_baseline_comparison.py +++ b/examples/display_text_label_align_baseline_comparison.py @@ -1,3 +1,10 @@ +# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-License-Identifier: MIT + +""" +This examples shows the use of base_alignment parameter. +""" + import board from adafruit_display_text import label from adafruit_bitmap_font import bitmap_font From 10d58232065e6dfb21f6563abc2dae64d8daac2e Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sat, 6 Feb 2021 23:09:31 -0500 Subject: [PATCH 03/11] Change in import order --- examples/display_text_label_align_baseline_comparison.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/display_text_label_align_baseline_comparison.py b/examples/display_text_label_align_baseline_comparison.py index 14a933f..3e084a5 100644 --- a/examples/display_text_label_align_baseline_comparison.py +++ b/examples/display_text_label_align_baseline_comparison.py @@ -5,11 +5,12 @@ This examples shows the use of base_alignment parameter. """ +import time import board -from adafruit_display_text import label -from adafruit_bitmap_font import bitmap_font import displayio -import time +from adafruit_bitmap_font import bitmap_font +from adafruit_display_text import label + display = board.DISPLAY From 2744279eae322fd30cb5e80a09ea945ff147dbd3 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sat, 13 Feb 2021 21:35:20 -0500 Subject: [PATCH 04/11] Change example --- ...ay_text_label_align_baseline_comparison.py | 119 +++++++++--------- 1 file changed, 61 insertions(+), 58 deletions(-) diff --git a/examples/display_text_label_align_baseline_comparison.py b/examples/display_text_label_align_baseline_comparison.py index 3e084a5..58cde8c 100644 --- a/examples/display_text_label_align_baseline_comparison.py +++ b/examples/display_text_label_align_baseline_comparison.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries +# SPDX-FileCopyrightText: 2021 Jose David Montoya for Adafruit Industries # SPDX-License-Identifier: MIT """ @@ -15,65 +15,68 @@ display = board.DISPLAY # Font definition. You can choose any two fonts available in your system -MEDIUM_FONT = bitmap_font.load_font("Helvetica-Bold-16.bdf") -BIG_FONT = bitmap_font.load_font("LeagueSpartan-Bold-16.bdf") +MEDIUM_FONT = bitmap_font.load_font("LeagueSpartan-Bold-16.bdf") +BIG_FONT = bitmap_font.load_font("IBMPlexMono-Medium-24_jep.bdf") -# Test parameters -TEXT_BACKGROUND_COLOR = 0x990099 -TEXT_COLOR = 0x00FF00 -X_COL_POS = [10, 90] # X position of the Label boxes -TEST_TEXT = [ - "aApPqQ.", - "ppppppp", - "llllll", - "oooooo", - "ñúÇèüß", -] # Iteration text for testing -LOCALISATION_Y = [40, 80, 120, 160, 200] # Y coordinate of the text labels -NUMBER_TEXT_LABELS = len(LOCALISATION_Y) * len( - X_COL_POS -) # Calculation for Display.Group function -TIME_BETWEEN_TEXTS = 5 # Seconds -BASE_ALIGNMENT_OPTIONS = [False, True] +TEXT_RIGHT = "MG" +TEXT_LEFT = "32.47" -# Test -for behaviour in BASE_ALIGNMENT_OPTIONS: - for text_test in TEST_TEXT: - main_group = displayio.Group(max_size=NUMBER_TEXT_LABELS + 1) - for position in LOCALISATION_Y: - text = label.Label( - font=MEDIUM_FONT, - text=text_test, - color=TEXT_COLOR, - background_tight=True, - background_color=TEXT_BACKGROUND_COLOR, - x=X_COL_POS[0], - y=position, - base_alignment=behaviour, - ) - main_group.append(text) - text = label.Label( - font=BIG_FONT, - text=text_test, - color=TEXT_COLOR, - background_tight=False, - background_color=TEXT_BACKGROUND_COLOR, - x=X_COL_POS[1], - y=position, - base_alignment=behaviour, - ) - main_group.append(text) - display.show(main_group) - display.refresh() - time.sleep(TIME_BETWEEN_TEXTS) +while True: + main_group = displayio.Group() + print("Base Alignment parameter False") + # Create label + left_text = label.Label( + BIG_FONT, + text=TEXT_LEFT, + color=0x000000, + background_color=0x999999, + x=10, + y=50, + base_alignment=False, + ) + main_group.append(left_text) -bitmap = displayio.Bitmap(280, 5, 2) -palette = displayio.Palette(2) -palette[0] = 0x004400 -palette[1] = 0x00FFFF -tile_grid2 = displayio.TileGrid(bitmap, pixel_shader=palette, x=10, y=160) -main_group.append(tile_grid2) + right_text = label.Label( + MEDIUM_FONT, + text=TEXT_RIGHT, + color=0x000000, + background_color=0x999999, + x=80, + y=50, + base_alignment=False + ) -while True: - pass + main_group.append(right_text) + display.show(main_group) + display.refresh() + + time.sleep(1) + main_group = displayio.Group() + print("Base Alignment parameter True") + + left_text_aligned = label.Label( + BIG_FONT, + text=TEXT_LEFT, + color=0x000000, + background_color=0x999999, + x=10, + y=50, + base_alignment=True + ) + main_group.append(left_text_aligned) + + right_text_aligned = label.Label( + MEDIUM_FONT, + text=TEXT_RIGHT, + color=0x000000, + background_color=0x999999, + x=80, + y=50, + base_alignment=True + ) + + main_group.append(right_text_aligned) + display.show(main_group) + display.refresh() + time.sleep(1) From b6cf39c86cb34e9767eca850dce459883b3fde02 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sun, 14 Feb 2021 01:38:38 -0500 Subject: [PATCH 05/11] Changes including scale and Alignment --- adafruit_display_text/label.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index 2ff124b..c470f23 100755 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -133,7 +133,6 @@ def __init__( self._padding_left = padding_left self._padding_right = padding_right - self._scale = scale self.base_alignment = base_alignment if text is not None: @@ -398,12 +397,11 @@ def text(self, new_text): @property def scale(self): """Set the scaling of the label, in integer values""" - return self._scale + return self.local_group.scale @scale.setter def scale(self, new_scale): current_anchored_position = self.anchored_position - self._scale = new_scale self.local_group.scale = new_scale self.anchored_position = current_anchored_position @@ -447,13 +445,13 @@ def anchored_position(self): return ( int( self.x - + (self._boundingbox[0] * self._scale) - + round(self._anchor_point[0] * self._boundingbox[2] * self._scale) + + (self._boundingbox[0] * self.scale) + + round(self._anchor_point[0] * self._boundingbox[2] * self.scale) ), int( self.y - + (self._boundingbox[1] * self._scale) - + round(self._anchor_point[1] * self._boundingbox[3] * self._scale) + + (self._boundingbox[1] * self.scale) + + round(self._anchor_point[1] * self._boundingbox[3] * self.scale) ), ) @@ -463,11 +461,11 @@ def anchored_position(self, new_position): return # Note: anchor_point must be set before setting anchored_position self.x = int( new_position[0] - - (self._boundingbox[0] * self._scale) - - round(self._anchor_point[0] * (self._boundingbox[2] * self._scale)) + - (self._boundingbox[0] * self.scale) + - round(self._anchor_point[0] * (self._boundingbox[2] * self.scale)) ) self.y = int( new_position[1] - - (self._boundingbox[1] * self._scale) - - round(self._anchor_point[1] * self._boundingbox[3] * self._scale) + - (self._boundingbox[1] * self.scale) + - round(self._anchor_point[1] * self._boundingbox[3] * self.scale) ) From 06238ab76fd8b7a872de5dcaf706d1dc5320d612 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sun, 14 Feb 2021 02:20:09 -0500 Subject: [PATCH 06/11] Erase Space --- adafruit_display_text/label.py | 1 - 1 file changed, 1 deletion(-) diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index c470f23..5549871 100755 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -132,7 +132,6 @@ def __init__( self._padding_bottom = padding_bottom self._padding_left = padding_left self._padding_right = padding_right - self.base_alignment = base_alignment if text is not None: From ac3f4b737db8b0b7bd71de566bf44aaeac35b1f9 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sun, 14 Feb 2021 14:26:37 -0500 Subject: [PATCH 07/11] Pylint and Black --- examples/display_text_label_align_baseline_comparison.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/display_text_label_align_baseline_comparison.py b/examples/display_text_label_align_baseline_comparison.py index 58cde8c..36977f6 100644 --- a/examples/display_text_label_align_baseline_comparison.py +++ b/examples/display_text_label_align_baseline_comparison.py @@ -80,3 +80,4 @@ display.show(main_group) display.refresh() time.sleep(1) + From a7101c8040f742e308bae756e125f2ef00f156c1 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sun, 14 Feb 2021 17:52:31 -0500 Subject: [PATCH 08/11] New Example logic to show parameters cases at the same time --- ...ay_text_label_align_baseline_comparison.py | 104 ++++++++---------- 1 file changed, 48 insertions(+), 56 deletions(-) diff --git a/examples/display_text_label_align_baseline_comparison.py b/examples/display_text_label_align_baseline_comparison.py index 36977f6..1742f34 100644 --- a/examples/display_text_label_align_baseline_comparison.py +++ b/examples/display_text_label_align_baseline_comparison.py @@ -2,10 +2,9 @@ # SPDX-License-Identifier: MIT """ -This examples shows the use of base_alignment parameter. +This example shows the use of base_alignment parameter. """ -import time import board import displayio from adafruit_bitmap_font import bitmap_font @@ -21,63 +20,56 @@ TEXT_RIGHT = "MG" TEXT_LEFT = "32.47" -while True: - main_group = displayio.Group() - print("Base Alignment parameter False") - - # Create label - left_text = label.Label( - BIG_FONT, - text=TEXT_LEFT, - color=0x000000, - background_color=0x999999, - x=10, - y=50, - base_alignment=False, - ) - main_group.append(left_text) +main_group = displayio.Group() - right_text = label.Label( - MEDIUM_FONT, - text=TEXT_RIGHT, - color=0x000000, - background_color=0x999999, - x=80, - y=50, - base_alignment=False - ) +# Create labels +# Base Alignment parameter False +left_text = label.Label( + BIG_FONT, + text=TEXT_LEFT, + color=0x000000, + background_color=0x999999, + x=10, + y=50, + base_alignment=False, +) +main_group.append(left_text) - main_group.append(right_text) - display.show(main_group) - display.refresh() +right_text = label.Label( + MEDIUM_FONT, + text=TEXT_RIGHT, + color=0x000000, + background_color=0x999999, + x=80, + y=50, + base_alignment=False +) +main_group.append(right_text) - time.sleep(1) - main_group = displayio.Group() - print("Base Alignment parameter True") +# Base Alignment parameter True +left_text_aligned = label.Label( + BIG_FONT, + text=TEXT_LEFT, + color=0x000000, + background_color=0x999999, + x=10, + y=100, + base_alignment=True +) +main_group.append(left_text_aligned) - left_text_aligned = label.Label( - BIG_FONT, - text=TEXT_LEFT, - color=0x000000, - background_color=0x999999, - x=10, - y=50, - base_alignment=True - ) - main_group.append(left_text_aligned) +right_text_aligned = label.Label( + MEDIUM_FONT, + text=TEXT_RIGHT, + color=0x000000, + background_color=0x999999, + x=80, + y=100, + base_alignment=True +) - right_text_aligned = label.Label( - MEDIUM_FONT, - text=TEXT_RIGHT, - color=0x000000, - background_color=0x999999, - x=80, - y=50, - base_alignment=True - ) - - main_group.append(right_text_aligned) - display.show(main_group) - display.refresh() - time.sleep(1) +main_group.append(right_text_aligned) +display.show(main_group) +while True: + pass From 448ae3231fcae4b179cea9d582702d51643e17b1 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Sun, 14 Feb 2021 17:58:51 -0500 Subject: [PATCH 09/11] Black changes --- examples/display_text_label_align_baseline_comparison.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/display_text_label_align_baseline_comparison.py b/examples/display_text_label_align_baseline_comparison.py index 1742f34..5ea1ee4 100644 --- a/examples/display_text_label_align_baseline_comparison.py +++ b/examples/display_text_label_align_baseline_comparison.py @@ -42,7 +42,7 @@ background_color=0x999999, x=80, y=50, - base_alignment=False + base_alignment=False, ) main_group.append(right_text) @@ -54,7 +54,7 @@ background_color=0x999999, x=10, y=100, - base_alignment=True + base_alignment=True, ) main_group.append(left_text_aligned) @@ -65,7 +65,7 @@ background_color=0x999999, x=80, y=100, - base_alignment=True + base_alignment=True, ) main_group.append(right_text_aligned) From 993443079ebb5b16b6006e1a661f873d88d44ba0 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Tue, 16 Feb 2021 11:18:45 -0500 Subject: [PATCH 10/11] Bitmap_label Changes and doc corrections --- adafruit_display_text/bitmap_label.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/adafruit_display_text/bitmap_label.py b/adafruit_display_text/bitmap_label.py index da73453..1ec820d 100755 --- a/adafruit_display_text/bitmap_label.py +++ b/adafruit_display_text/bitmap_label.py @@ -34,7 +34,7 @@ class Label(displayio.Group): Note: This ``bitmap_label.py`` library utilizes a bitmap to display the text. This method is memory-conserving relative to ``label.py``. The ``max_glyphs`` parameter is ignored and is present - only for direct compatability with label.py. + only for direct compatibility with label.py. For further reduction in memory usage, set ``save_text=False`` (text string will not be stored and ``line_spacing`` and ``font`` are immutable with ``save_text`` @@ -54,19 +54,21 @@ class Label(displayio.Group): :param int background_color: Color of the background, use `None` for transparent :param double line_spacing: Line spacing of text to display :param boolean background_tight: Set `True` only if you want background box to tightly - surround text + surround text. When set to 'True' Padding parameters will be ignored. :param int padding_top: Additional pixels added to background bounding box at top :param int padding_bottom: Additional pixels added to background bounding box at bottom :param int padding_left: Additional pixels added to background bounding box at left :param int padding_right: Additional pixels added to background bounding box at right - :param (double,double) anchor_point: Point that anchored_position moves relative to. + :param (float,float) anchor_point: Point that anchored_position moves relative to. Tuple with decimal percentage of width and height. (E.g. (0,0) is top left, (1.0, 0.5): is middle right.) :param (int,int) anchored_position: Position relative to the anchor_point. Tuple containing x,y pixel coordinates. :param int scale: Integer value of the pixel scaling :param bool save_text: Set True to save the text string as a constant in the - label structure. Set False to reduce memory use.""" + label structure. Set False to reduce memory use. + :param: bool base_alignment: when True allows to align text label to the baseline. + This is helpful when two or more labels need to be aligned to the same baseline""" # pylint: disable=unused-argument, too-many-instance-attributes, too-many-locals, too-many-arguments # pylint: disable=too-many-branches, no-self-use, too-many-statements @@ -93,6 +95,7 @@ def __init__( anchored_position=None, save_text=True, # can reduce memory use if save_text = False scale=1, + base_alignment=False, **kwargs, ): @@ -128,6 +131,8 @@ def __init__( self._anchor_point = anchor_point self._anchored_position = anchored_position + self._base_alignment = base_alignment + # call the text updater with all the arguments. self._reset_text( font=font, @@ -144,6 +149,7 @@ def __init__( anchored_position=anchored_position, save_text=save_text, scale=scale, + base_alignment=base_alignment, ) def _reset_text( @@ -162,6 +168,7 @@ def _reset_text( anchored_position=None, save_text=None, scale=None, + base_alignment=None, ): # Store all the instance variables @@ -189,6 +196,8 @@ def _reset_text( self._anchored_position = anchored_position if save_text is not None: self._save_text = save_text + if base_alignment is not None: + self._base_alignment = base_alignment # if text is not provided as a parameter (text is None), use the previous value. if (text is None) and self._save_text: @@ -260,8 +269,10 @@ def _reset_text( self._padding_top + y_offset, ) - # To calibrate with label.py positioning - label_position_yoffset = self._get_ascent() // 2 + if self._base_alignment: + label_position_yoffset = 0 + else: + label_position_yoffset = self._get_ascent() // 2 self.tilegrid = displayio.TileGrid( self.bitmap, @@ -303,6 +314,7 @@ def _reset_text( # x,y positions of the label def _get_ascent_descent(self): + """ Private function to calculate ascent and descent font values """ if hasattr(self.font, "ascent"): return self.font.ascent, self.font.descent @@ -615,7 +627,7 @@ def background_color(self, new_color): @property def text(self): - """Text to displayed.""" + """Text to be displayed.""" return self._text @text.setter # Cannot set color or background color with text setter, use separate setter From 72b7db5a6defe6f240ede5cd6e0f489d799bfc44 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Tue, 16 Feb 2021 20:56:12 -0500 Subject: [PATCH 11/11] Changing base_alignment to public parameter --- adafruit_display_text/bitmap_label.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adafruit_display_text/bitmap_label.py b/adafruit_display_text/bitmap_label.py index 1ec820d..bb5c723 100755 --- a/adafruit_display_text/bitmap_label.py +++ b/adafruit_display_text/bitmap_label.py @@ -131,7 +131,7 @@ def __init__( self._anchor_point = anchor_point self._anchored_position = anchored_position - self._base_alignment = base_alignment + self.base_alignment = base_alignment # call the text updater with all the arguments. self._reset_text( @@ -197,7 +197,7 @@ def _reset_text( if save_text is not None: self._save_text = save_text if base_alignment is not None: - self._base_alignment = base_alignment + self.base_alignment = base_alignment # if text is not provided as a parameter (text is None), use the previous value. if (text is None) and self._save_text: @@ -269,7 +269,7 @@ def _reset_text( self._padding_top + y_offset, ) - if self._base_alignment: + if self.base_alignment: label_position_yoffset = 0 else: label_position_yoffset = self._get_ascent() // 2