Skip to content

Commit

Permalink
fix bmp_lbl for ascenders and descenders
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Nov 14, 2024
1 parent 3ba5f74 commit 9ebaf52
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions adafruit_display_text/bitmap_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,18 @@ def _line_spacing_ypixels(font: FontProtocol, line_spacing: float) -> int:
def _text_bounding_box(
self, text: str, font: FontProtocol
) -> Tuple[int, int, int, int, int, int]:
# pylint: disable=too-many-locals
# pylint: disable=too-many-locals,too-many-branches

ascender_max, descender_max = self._ascent, self._descent
bbox = font.get_bounding_box()
if len(bbox) == 4:
ascender_max, descender_max = bbox[1], -bbox[3]
else:
ascender_max, descender_max = self._ascent, self._descent

lines = 1

xposition = (
x_start
) = yposition = y_start = 0 # starting x and y position (left margin)
# starting x and y position (left margin)
xposition = x_start = yposition = y_start = 0

left = None
right = x_start
Expand Down

0 comments on commit 9ebaf52

Please sign in to comment.