Skip to content

Commit 1590d81

Browse files
authored
Merge pull request #180 from FoamyGuy/fix_left_glpyh_logic
fix left edge location for first character of the label.
2 parents 4039615 + 94820b3 commit 1590d81

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _text_bounding_box(
314314
lines += 1
315315
if xposition == x_start:
316316
if left is None:
317-
left = my_glyph.dx
317+
left = 0
318318
else:
319319
left = min(left, my_glyph.dx)
320320
xright = xposition + my_glyph.width + my_glyph.dx
@@ -392,7 +392,7 @@ def _place_text(
392392
else:
393393
if xposition == x_start:
394394
if left is None:
395-
left = my_glyph.dx
395+
left = 0
396396
else:
397397
left = min(left, my_glyph.dx)
398398

adafruit_display_text/label.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def _update_text(self, new_text: str) -> None:
271271
right = max(right, x + glyph.shift_x, x + glyph.width + glyph.dx)
272272
if x == 0:
273273
if left is None:
274-
left = glyph.dx
274+
left = 0
275275
else:
276276
left = min(left, glyph.dx)
277277
position_x = x + glyph.dx
@@ -281,15 +281,15 @@ def _update_text(self, new_text: str) -> None:
281281
)
282282
if x == 0:
283283
if right is None:
284-
right = glyph.dx
284+
right = 0
285285
else:
286286
right = max(right, glyph.dx)
287287
position_x = x - glyph.width
288288

289289
elif self._label_direction == "TTB":
290290
if x == 0:
291291
if left is None:
292-
left = glyph.dx
292+
left = 0
293293
else:
294294
left = min(left, glyph.dx)
295295
if y == 0:

0 commit comments

Comments
 (0)