From c17f147be95e7490e5207c747add2da1cc8b167f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 6 Feb 2019 12:13:17 -0800 Subject: A variety of displayio improvements This changes a number of things in displayio: * Introduces BuiltinFont and Glyph so the built in font can be used by libraries. For boards with a font it is available as board.TERMINAL_FONT. Fixes #1172 * Remove _load_row from Bitmap in favor of bitmap[] access. Index can be x/y tuple or overall index. Fixes #1191 * Add width and height properties to Bitmap. * Add insert and [] access to Group. Fixes #1518 * Add index param to pop on Group. * Terminal no longer takes unicode character info. It takes a BuiltinFont instead. * Fix Terminal's handling of [###D vt100 commands used when up arrowing into repl history. * Add x and y positions to Group plus scale as well. * Add bitmap accessor for BuiltinFont --- tools/gen_display_resources.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py index e0021650d..22f19d84e 100644 --- a/tools/gen_display_resources.py +++ b/tools/gen_display_resources.py @@ -118,7 +118,7 @@ displayio_palette_t supervisor_terminal_color = { c_file.write("""\ displayio_tilegrid_t supervisor_terminal_text_grid = {{ .base = {{ .type = &displayio_tilegrid_type }}, - .bitmap = (displayio_bitmap_t*) &supervisor_terminal_font, + .bitmap = (displayio_bitmap_t*) &supervisor_terminal_font_bitmap, .pixel_shader = &supervisor_terminal_color, .x = 16, .y = 0, @@ -149,7 +149,7 @@ c_file.write("""\ """) c_file.write("""\ -const displayio_bitmap_t supervisor_terminal_font = {{ +const displayio_bitmap_t supervisor_terminal_font_bitmap = {{ .base = {{.type = &displayio_bitmap_type }}, .width = {}, .height = {}, @@ -158,17 +158,29 @@ const displayio_bitmap_t supervisor_terminal_font = {{ .bits_per_value = 1, .x_shift = 5, .x_mask = 0x1f, - .bitmask = 0x1 + .bitmask = 0x1, + .read_only = true }}; """.format(len(all_characters) * tile_x, tile_y, bytes_per_row / 4)) + c_file.write("""\ -terminalio_terminal_obj_t supervisor_terminal = {{ - .base = {{.type = &terminalio_terminal_type }}, - .cursor_x = 0, - .cursor_y = 0, - .tilegrid = &supervisor_terminal_text_grid, +const displayio_builtinfont_t supervisor_terminal_font = {{ + .base = {{.type = &displayio_builtinfont_type }}, + .bitmap = &supervisor_terminal_font_bitmap, + .width = {}, + .height = {}, .unicode_characters = (const uint8_t*) "{}", .unicode_characters_len = {} }}; -""".format(extra_characters, len(extra_characters.encode("utf-8")))) +""".format(tile_x, tile_y, extra_characters, len(extra_characters.encode("utf-8")))) + +c_file.write("""\ +terminalio_terminal_obj_t supervisor_terminal = { + .base = { .type = &terminalio_terminal_type }, + .font = &supervisor_terminal_font, + .cursor_x = 0, + .cursor_y = 0, + .tilegrid = &supervisor_terminal_text_grid +}; +""") -- cgit v1.2.3