@@ -124,6 +124,7 @@ def __init__(
124
124
self ._text_maxlen = []
125
125
self ._text_transform = []
126
126
self ._text_scrolling = []
127
+ self ._text_scale = []
127
128
self ._scrolling_index = None
128
129
self ._text_font = terminalio .FONT
129
130
self ._text_line_spacing = []
@@ -139,6 +140,7 @@ def add_text(
139
140
text_wrap = False ,
140
141
text_maxlen = 0 ,
141
142
text_transform = None ,
143
+ text_scale = 1 ,
142
144
scrolling = False ,
143
145
line_spacing = 1.25 ,
144
146
):
@@ -155,6 +157,7 @@ def add_text(
155
157
``False``, no wrapping.
156
158
:param text_maxlen: The max length of the text for text wrapping. Defaults to 0.
157
159
:param text_transform: A function that will be called on the text before display
160
+ :param int text_scale: The factor to scale the default size of the text by
158
161
:param bool scrolling: If true, text is placed offscreen and the scroll() function is used
159
162
to scroll text on a pixel-by-pixel basis. Multiple text labels with
160
163
the scrolling set to True will be cycled through.
@@ -171,6 +174,9 @@ def add_text(
171
174
text_maxlen = 0
172
175
if not text_transform :
173
176
text_transform = None
177
+ if not isinstance (text_scale , (int , float )) or text_scale < 1 :
178
+ text_scale = 1
179
+ text_scale = round (text_scale )
174
180
if scrolling :
175
181
text_position = (self .display .width , text_position [1 ])
176
182
@@ -184,6 +190,7 @@ def add_text(
184
190
self ._text_wrap .append (text_wrap )
185
191
self ._text_maxlen .append (text_maxlen )
186
192
self ._text_transform .append (text_transform )
193
+ self ._text_scale .append (text_scale )
187
194
self ._text_scrolling .append (scrolling )
188
195
self ._text_line_spacing .append (line_spacing )
189
196
@@ -262,11 +269,18 @@ def set_text(self, val, index=0):
262
269
string = string [: self ._text_maxlen [index ]]
263
270
print ("text index" , self ._text [index ])
264
271
index_in_splash = None
272
+
265
273
if self ._text [index ] is not None :
266
- print ("Replacing text area with :" , string )
274
+ if self ._debug :
275
+ print ("Replacing text area with :" , string )
267
276
index_in_splash = self .splash .index (self ._text [index ])
277
+ elif self ._debug :
278
+ print ("Creating text area with :" , string )
279
+
268
280
if len (string ) > 0 :
269
- self ._text [index ] = Label (self ._text_font , text = string )
281
+ self ._text [index ] = Label (
282
+ self ._text_font , text = string , scale = self ._text_scale [index ]
283
+ )
270
284
self ._text [index ].color = self ._text_color [index ]
271
285
self ._text [index ].x = self ._text_position [index ][0 ]
272
286
self ._text [index ].y = self ._text_position [index ][1 ]
0 commit comments