support for outlined text
This commit is contained in:
parent
149d4f3292
commit
ba25bfaba9
1 changed files with 19 additions and 5 deletions
|
|
@ -28,6 +28,7 @@ import terminalio
|
||||||
from adafruit_bitmap_font import bitmap_font
|
from adafruit_bitmap_font import bitmap_font
|
||||||
from adafruit_display_text import wrap_text_to_lines
|
from adafruit_display_text import wrap_text_to_lines
|
||||||
from adafruit_display_text.bitmap_label import Label
|
from adafruit_display_text.bitmap_label import Label
|
||||||
|
from adafruit_display_text.outlined_label import OutlinedLabel
|
||||||
|
|
||||||
__version__ = "0.0.0+auto.0"
|
__version__ = "0.0.0+auto.0"
|
||||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PortalBase.git"
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PortalBase.git"
|
||||||
|
|
@ -164,6 +165,8 @@ class PortalBase:
|
||||||
text_scale=1,
|
text_scale=1,
|
||||||
line_spacing=1.25,
|
line_spacing=1.25,
|
||||||
text_anchor_point=(0, 0.5),
|
text_anchor_point=(0, 0.5),
|
||||||
|
outline_size=0,
|
||||||
|
outline_color=0x000000,
|
||||||
is_data=True,
|
is_data=True,
|
||||||
text=None,
|
text=None,
|
||||||
) -> int:
|
) -> int:
|
||||||
|
|
@ -222,6 +225,8 @@ class PortalBase:
|
||||||
"line_spacing": line_spacing,
|
"line_spacing": line_spacing,
|
||||||
"anchor_point": text_anchor_point,
|
"anchor_point": text_anchor_point,
|
||||||
"is_data": bool(is_data),
|
"is_data": bool(is_data),
|
||||||
|
"outline_size": outline_size,
|
||||||
|
"outline_color": outline_color,
|
||||||
}
|
}
|
||||||
self._text.append(text_field)
|
self._text.append(text_field)
|
||||||
|
|
||||||
|
|
@ -279,11 +284,20 @@ class PortalBase:
|
||||||
print("Creating text area with :", string)
|
print("Creating text area with :", string)
|
||||||
if len(string) > 0:
|
if len(string) > 0:
|
||||||
if self._text[index]["label"] is None:
|
if self._text[index]["label"] is None:
|
||||||
|
if self._text[index]["outline_size"] == 0:
|
||||||
self._text[index]["label"] = Label(
|
self._text[index]["label"] = Label(
|
||||||
self._fonts[self._text[index]["font"]],
|
self._fonts[self._text[index]["font"]],
|
||||||
text=string,
|
text=string,
|
||||||
scale=self._text[index]["scale"],
|
scale=self._text[index]["scale"],
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
self._text[index]["label"] = OutlinedLabel(
|
||||||
|
self._fonts[self._text[index]["font"]],
|
||||||
|
text=string,
|
||||||
|
scale=self._text[index]["scale"],
|
||||||
|
outline_size=self._text[index]["outline_size"],
|
||||||
|
outline_color=self._text[index]["outline_color"],
|
||||||
|
)
|
||||||
if index_in_root_group is not None:
|
if index_in_root_group is not None:
|
||||||
self.root_group[index_in_root_group] = self._text[index]["label"]
|
self.root_group[index_in_root_group] = self._text[index]["label"]
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue