Skip to content

Commit fd656fc

Browse files
author
Kevin J Walters
committed
Bugfix for RTL label_direction which was alternating direction. #166
1 parent 148131c commit fd656fc

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ def __init__(
106106
self._save_text = save_text
107107
self._text = self._replace_tabs(self._text)
108108

109-
if self._label_direction == "RTL":
110-
self._text = "".join(reversed(self._text))
111-
112109
# call the text updater with all the arguments.
113110
self._reset_text(
114111
font=font,
@@ -138,8 +135,6 @@ def _reset_text(
138135

139136
if self._save_text: # text string will be saved
140137
self._text = self._replace_tabs(text)
141-
if self._label_direction == "RTL":
142-
self._text = "".join(reversed(self._text))
143138
else:
144139
self._text = None # save a None value since text string is not saved
145140

@@ -205,7 +200,9 @@ def _reset_text(
205200
# Place the text into the Bitmap
206201
self._place_text(
207202
self._bitmap,
208-
text,
203+
text
204+
if self._label_direction != "RTL"
205+
else "".join(reversed(self._text)),
209206
self._font,
210207
self._padding_left - x_offset,
211208
self._padding_top + y_offset,

0 commit comments

Comments
 (0)