Skip to content

Commit 9e2f2a7

Browse files
committed
fix bounding_box size for outlined accents
1 parent 11c7b2f commit 9e2f2a7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ def _text_bounding_box(
401401
newlines = 0
402402
line_spacing = self._line_spacing
403403

404-
for char in text:
404+
for char_index in range(len(text)):
405+
char = text[char_index]
405406
if char == "\n": # newline
406407
newlines += 1
407408

@@ -426,6 +427,11 @@ def _text_bounding_box(
426427
xright = xposition + my_glyph.width + my_glyph.dx
427428
xposition += my_glyph.shift_x
428429

430+
for accent in self.accent_ranges:
431+
if accent[ACCENT_TYPE] == "outline":
432+
if accent[ACCENT_START] <= char_index < accent[ACCENT_END]:
433+
xposition += self.outline_size
434+
429435
right = max(right, xposition, xright)
430436

431437
if yposition == y_start: # first line, find the Ascender height

0 commit comments

Comments
 (0)