From af282529b9e55c7a4acc315c12528f091b0797fb Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 12 Dec 2020 10:26:51 -0600 Subject: [PATCH 1/3] fix readme example code block. update supported types for pcf in readme. --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 8372bec..17ac27c 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ Introduction :target: https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font/actions/ :alt: Build Status -Loads bitmap fonts into CircuitPython's displayio. BDF files are well supported. PCF and TTF +Loads bitmap fonts into CircuitPython's displayio. BDF and PCF files are well supported. TTF support is not yet complete. Dependencies @@ -53,11 +53,11 @@ To install in a virtual environment in your current project: Usage Example ============= -.. code-block::python +.. code-block:: python from adafruit_bitmap_font import bitmap_font from displayio import Bitmap - font = bitmap_font.load_font("scientifica-11.bdf", Bitmap) + font = bitmap_font.load_font("fonts/Arial-16.bdf", Bitmap) print(font.get_glyph(ord("A"))) From 2c6529dc45d8515173c88882ad848dc1ab67a579 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 12 Dec 2020 11:39:29 -0600 Subject: [PATCH 2/3] add pcf filenames in examples. display variable in displayio simpletest. --- examples/bitmap_font_displayio_simpletest.py | 13 +++++++++++-- examples/bitmap_font_label_magtag.py | 6 +++++- examples/bitmap_font_label_simpletest.py | 9 ++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/examples/bitmap_font_displayio_simpletest.py b/examples/bitmap_font_displayio_simpletest.py index 715f205..13715a6 100644 --- a/examples/bitmap_font_displayio_simpletest.py +++ b/examples/bitmap_font_displayio_simpletest.py @@ -11,7 +11,16 @@ import displayio from adafruit_bitmap_font import bitmap_font -font = bitmap_font.load_font("fonts/Arial-16.bdf") +# use built in display (PyPortal, PyGamer, PyBadge, CLUE, etc.) +# see guide for setting up external displays (TFT / OLED breakouts, RGB matrices, etc.) +# https://learn.adafruit.com/circuitpython-display-support-using-displayio/display-and-display-bus +display = board.DISPLAY + +# try uncommenting different font files if you like +font_file = "fonts/Arial-16.bdf" +# font_file = "fonts/yasashi24.pcf" + +font = bitmap_font.load_font(font_file) bitmap = displayio.Bitmap(320, 240, 2) @@ -59,7 +68,7 @@ group.append(tile_grid) # Add the Group to the Display -board.DISPLAY.show(group) +display.show(group) while True: pass diff --git a/examples/bitmap_font_label_magtag.py b/examples/bitmap_font_label_magtag.py index e6685b2..6c352a0 100644 --- a/examples/bitmap_font_label_magtag.py +++ b/examples/bitmap_font_label_magtag.py @@ -15,9 +15,13 @@ # wait until we can refresh the display time.sleep(display.time_to_refresh) +# try uncommenting different font files if you like +font_file = "fonts/Arial-16.bdf" +# font_file = "fonts/yasashi24.pcf" + # Set text, font, and color text = "HELLO WORLD\nbitmap_font example" -font = bitmap_font.load_font("fonts/Arial-16.bdf") +font = bitmap_font.load_font(font_file) color = 0xFFFFFF background_color = 0x999999 diff --git a/examples/bitmap_font_label_simpletest.py b/examples/bitmap_font_label_simpletest.py index 1c134ee..e209d4c 100644 --- a/examples/bitmap_font_label_simpletest.py +++ b/examples/bitmap_font_label_simpletest.py @@ -7,11 +7,18 @@ from adafruit_display_text import label from adafruit_bitmap_font import bitmap_font +# use built in display (PyPortal, PyGamer, PyBadge, CLUE, etc.) +# see guide for setting up external displays (TFT / OLED breakouts, RGB matrices, etc.) +# https://learn.adafruit.com/circuitpython-display-support-using-displayio/display-and-display-bus display = board.DISPLAY +# try uncommenting different font files if you like +font_file = "fonts/Arial-16.bdf" +# font_file = "fonts/yasashi24.pcf" + # Set text, font, and color text = "HELLO WORLD" -font = bitmap_font.load_font("fonts/Arial-16.bdf") +font = bitmap_font.load_font(font_file) color = 0xFF00FF # Create the tet label From 97c0318e1570f4ba1cd96c4bd815de27f02464c2 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 12 Dec 2020 11:48:11 -0600 Subject: [PATCH 3/3] create fonts section in readme --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 17ac27c..2921ccc 100644 --- a/README.rst +++ b/README.rst @@ -61,6 +61,15 @@ Usage Example print(font.get_glyph(ord("A"))) +Creating Fonts +============== + +See `this learn guide `_ for more information about building custom fornt files + +The command line tool :code:`otf2bdf` can be used make bdf files for use with this library. + +The command line tool :code:`bdftopcf` can be used make pcf files for use with this library. + Contributing ============