From 22a720a4c2768916ddef716198df46d9db06c990 Mon Sep 17 00:00:00 2001 From: Mitchell Haugen Date: Wed, 8 Nov 2023 23:22:16 -0800 Subject: [PATCH 1/3] Update font documentation for display_text() --- adafruit_macropad.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/adafruit_macropad.py b/adafruit_macropad.py index 4b697ee..354bca1 100755 --- a/adafruit_macropad.py +++ b/adafruit_macropad.py @@ -900,8 +900,9 @@ def display_text( :param int text_scale: Scale the size of the data lines. Scales the title as well. Defaults to 1. :param font: The font or the path to the custom font file to use to display the text. - Defaults to the built-in ``terminalio.FONT``. Custom font files must be - provided as a string, e.g. ``"/Arial12.bdf"``. + Defaults to the built-in ``terminalio.FONT``. The ``font`` argument must be of + a type that subclasses ``FontProtocol``. For more details, see: + https://docs.circuitpython.org/en/latest/shared-bindings/fontio/index.html The following example displays a title and lines of text indicating which key is pressed, the relative position of the rotary encoder, and whether the encoder switch is pressed. @@ -909,11 +910,14 @@ def display_text( .. code-block:: python + from adafruit_bitmap_font import bitmap_font from adafruit_macropad import MacroPad + from displayio import Bitmap macropad = MacroPad() - text_lines = macropad.display_text(title="MacroPad Info") + custom_font = bitmap_font.load_font("/Arial12.bdf", Bitmap) + text_lines = macropad.display_text(title="MacroPad Info", font=custom_font) while True: key_event = macropad.keys.events.get() From 8f5d3ee0ccaa77358d299a0988ce04ab987531a9 Mon Sep 17 00:00:00 2001 From: Mitchell Haugen Date: Wed, 8 Nov 2023 23:36:32 -0800 Subject: [PATCH 2/3] add param data type --- adafruit_macropad.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adafruit_macropad.py b/adafruit_macropad.py index 354bca1..7b29bb7 100755 --- a/adafruit_macropad.py +++ b/adafruit_macropad.py @@ -899,9 +899,10 @@ def display_text( Defaults to 80. :param int text_scale: Scale the size of the data lines. Scales the title as well. Defaults to 1. - :param font: The font or the path to the custom font file to use to display the text. - Defaults to the built-in ``terminalio.FONT``. The ``font`` argument must be of - a type that subclasses ``FontProtocol``. For more details, see: + :param ~FontProtocol|None font: The font or the path to the custom font file to use to + display the text. Defaults to the built-in ``terminalio.FONT``. The ``font`` + argument must be of a type that subclasses ``FontProtocol``. For more details, + see: https://docs.circuitpython.org/en/latest/shared-bindings/fontio/index.html The following example displays a title and lines of text indicating which key is pressed, From 7805935b6d2dab4e2eda5d243e115d06b63b37b6 Mon Sep 17 00:00:00 2001 From: Mitchell Haugen Date: Wed, 8 Nov 2023 23:40:19 -0800 Subject: [PATCH 3/3] rewording --- adafruit_macropad.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/adafruit_macropad.py b/adafruit_macropad.py index 7b29bb7..bb36953 100755 --- a/adafruit_macropad.py +++ b/adafruit_macropad.py @@ -899,11 +899,9 @@ def display_text( Defaults to 80. :param int text_scale: Scale the size of the data lines. Scales the title as well. Defaults to 1. - :param ~FontProtocol|None font: The font or the path to the custom font file to use to - display the text. Defaults to the built-in ``terminalio.FONT``. The ``font`` - argument must be of a type that subclasses ``FontProtocol``. For more details, - see: - https://docs.circuitpython.org/en/latest/shared-bindings/fontio/index.html + :param ~FontProtocol|None font: The custom font to use to display the text. Defaults to the + built-in ``terminalio.FONT``. For more details, see: + https://docs.circuitpython.org/en/latest/shared-bindings/fontio/index.html The following example displays a title and lines of text indicating which key is pressed, the relative position of the rotary encoder, and whether the encoder switch is pressed.