|
28 | 28 | from adafruit_bitmap_font import bitmap_font |
29 | 29 | from adafruit_display_text import wrap_text_to_lines |
30 | 30 | from adafruit_display_text.bitmap_label import Label |
| 31 | +from adafruit_display_text.outlined_label import OutlinedLabel |
31 | 32 |
|
32 | 33 | __version__ = "0.0.0+auto.0" |
33 | 34 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PortalBase.git" |
@@ -164,6 +165,8 @@ def add_text( # noqa: PLR0913 Too many arguments in function definition |
164 | 165 | text_scale=1, |
165 | 166 | line_spacing=1.25, |
166 | 167 | text_anchor_point=(0, 0.5), |
| 168 | + outline_size=0, |
| 169 | + outline_color=0x000000, |
167 | 170 | is_data=True, |
168 | 171 | text=None, |
169 | 172 | ) -> int: |
@@ -222,6 +225,8 @@ def add_text( # noqa: PLR0913 Too many arguments in function definition |
222 | 225 | "line_spacing": line_spacing, |
223 | 226 | "anchor_point": text_anchor_point, |
224 | 227 | "is_data": bool(is_data), |
| 228 | + "outline_size": outline_size, |
| 229 | + "outline_color": outline_color, |
225 | 230 | } |
226 | 231 | self._text.append(text_field) |
227 | 232 |
|
@@ -279,11 +284,20 @@ def set_text(self, val, index=0): # noqa: PLR0912 Too many branches |
279 | 284 | print("Creating text area with :", string) |
280 | 285 | if len(string) > 0: |
281 | 286 | if self._text[index]["label"] is None: |
282 | | - self._text[index]["label"] = Label( |
283 | | - self._fonts[self._text[index]["font"]], |
284 | | - text=string, |
285 | | - scale=self._text[index]["scale"], |
286 | | - ) |
| 287 | + if self._text[index]["outline_size"] == 0: |
| 288 | + self._text[index]["label"] = Label( |
| 289 | + self._fonts[self._text[index]["font"]], |
| 290 | + text=string, |
| 291 | + scale=self._text[index]["scale"], |
| 292 | + ) |
| 293 | + else: |
| 294 | + self._text[index]["label"] = OutlinedLabel( |
| 295 | + self._fonts[self._text[index]["font"]], |
| 296 | + text=string, |
| 297 | + scale=self._text[index]["scale"], |
| 298 | + outline_size=self._text[index]["outline_size"], |
| 299 | + outline_color=self._text[index]["outline_color"], |
| 300 | + ) |
287 | 301 | if index_in_root_group is not None: |
288 | 302 | self.root_group[index_in_root_group] = self._text[index]["label"] |
289 | 303 | else: |
|
0 commit comments