@@ -107,6 +107,7 @@ class EffectText {
107107 int32_t text_pos_x = 0 ,
108108 int32_t text_pos_y = 0 ,
109109 char justification = ' l' ,
110+ bool background = true ,
110111 uint8_t textbg_r = 0 ,
111112 uint8_t textbg_g = 0 ,
112113 uint8_t textbg_b = 0 ) :
@@ -118,6 +119,7 @@ class EffectText {
118119 text_g (text_g),
119120 text_b (text_b),
120121 justification (justification),
122+ background (background),
121123 textbg_r (textbg_r),
122124 textbg_g (textbg_g),
123125 textbg_b (textbg_b) { };
@@ -134,22 +136,24 @@ class EffectText {
134136 // PicoGraphics_PenRGB888::text(msg, text_origin, -1, 1.0f);
135137 size_t string_len = fixed_len > 0 ? fixed_len : text.length ();
136138 int32_t space_pixels = string_len > 1 ? (string_len - 1 ) * 1 : 0 ;
137- int32_t bg_max_width_px = bitmap_font.max_width * string_len + space_pixels;
138- int32_t tx = text_pos_x, bx = text_pos_x, ty = text_pos_y, by = text_pos_y;
139+ int32_t tx = text_pos_x, y = text_pos_y;
139140 if (justification == ' r' ) {
140- // Set x positions for right justified text
141+ // Set x position for right justified text
141142 tx = text_pos_x - measure_text (&bitmap_font, text, SCALE, 1 , false );
142- bx = text_pos_x - bg_max_width_px;
143143 }
144- rectangle (bx, by,
145- bg_max_width_px, bitmap_font.height ,
146- textbg_r, textbg_g, textbg_b);
144+ if (background) {
145+ int32_t bg_max_width_px = bitmap_font.max_width * string_len + space_pixels;
146+ int32_t bx = (justification == ' r' ) ? text_pos_x - bg_max_width_px : text_pos_x;
147+ rectangle (bx, y,
148+ bg_max_width_px, bitmap_font.height ,
149+ textbg_r, textbg_g, textbg_b);
150+ }
147151 bitmap::text (&bitmap_font,
148152 [this ](int32_t x, int32_t y, int32_t w, int32_t h) { rectangle (x, y,
149153 w, h,
150154 text_r, text_g, text_b); },
151155 text,
152- tx, ty ,
156+ tx, y ,
153157 -1 , SCALE, 1 , false , 0 );
154158 };
155159
@@ -161,6 +165,7 @@ class EffectText {
161165 int32_t text_pos_x, text_pos_y;
162166 uint8_t text_r, text_g, text_b;
163167 char justification;
168+ bool background;
164169 uint8_t textbg_r, textbg_g, textbg_b;
165170};
166171
@@ -196,7 +201,7 @@ class EffectAudioscopeTuner : public EffectTuner {
196201 64 , 64 , 64 ,
197202 Display::WIDTH,
198203 Display::HEIGHT - font6.height,
199- ' r' ),
204+ ' r' , false ),
200205 // traces initialised in start()
201206 trace_intensity({8 , 20 , 51 , 128 }),
202207 trace_idx(0 ) { };
0 commit comments