Galactic Unicorn, bitmap8 characters too small, how to make bigger?

I’m using bitmap8 for my 83x11 galactic unicorn, but how can I make the text 11 pixels tall so I’m not ‘wasting’ the extra pixels? I want the text to be readable from far away, so as large as possible.
12-hour time on the left, temp with degree symbol aligned on the right. Currently 2-pixels pad the text on all sides.
Thanks!

def redraw_display_if_reqd():
    global year, month, day, wd, hour, minute, second, last_second, last_temperature_update

    year, month, day, wd, hour, minute, second, _ = rtc.datetime()
    if second != last_second:
        # Convert to local time considering utc_offset
        hour = (hour + utc_offset) % 24
        
        # Convert to 12-hour format and remove leading zero
        is_pm = hour >= 12
        if hour == 0:
            hour = 12  # Midnight to 12 AM
        elif hour > 12:
            hour -= 12  # Convert 13-23 to 1-11 PM

        # Set a solid background color
        graphics.set_pen(BLACK)
        graphics.clear()

        clock = f"{hour}:{minute:02}"
        graphics.set_pen(WHITE)  # Set text color
        x = 2
        y = 2
        graphics.text(clock, x, y, -1, 1)  # Draw clock text

        temperature = get_temperature()
        temp_x = width - graphics.measure_text(temperature, 1) - 1
        temp_y = height - 9
        graphics.text(temperature, temp_x, temp_y, -1, 1)  # Draw temperature text

        last_second = second

graphics.set_font("bitmap8")
gu.set_brightness(1.0)

I’m thinking you may have to roll your own custom font?

I don’t see anything obvious in the read me for Pico Graphics.
pimoroni-pico/micropython/modules/picographics at main · pimoroni/pimoroni-pico (github.com)

I have one, displaying text messages. Day, date, time, temp, % humidity and barometric pressure. It just cycles through each one , updating the info on the fly. Text with a lower case y, g or p etc will use the lower rows of pixels. I have a hard time getting what I want on screen as is. I have a lot of info in some of the messages though.
1029mb High for my current pressure display just fits the width.

People have different needs though so I’m not knocking what you want to do. ;)

I also have an Interstate 75 with a 64 x 64 LED Matrix. Similar info displayed on it as well. The text isn’t much bigger, but is thicker, pixel wise. Two pixels instead of one vertically, bold text if you will. It’s a lot easier to read from a distance. Which was one of the intentions when I built it. My panels have a 4 mm pitch.

I was worried I’d have to create a custom font. I was hoping there was a better solution, but I’ll start looking into how to make a new font. I’ll only need numbers, a : and the degree ° symbol. Maybe it won’t hurt. much.
I think eventually I’ll use the 64x64 display, but the Galactic Unicorn is what I have right now :)
Thanks for the input.

@Tonygo2 Tony is likely the guy to talk to about making custom fonts.

Summary - Tonygo2 - Pimoroni Buccaneers

1 Like

Have a look at this as it might give you some ideas.

Galactic Unicorn - Animated Pacman - Discussion / Projects - Pimoroni Buccaneers

Pretty easy to do and you will have plenty of memory available with such a small character set.

Have fun!

1 Like

haha, here’s what I got ChatGPT to make for me, then I tweaked it a bit. I guess this is a direction I might explore. Seems silly and fun.

import time
from galactic import GalacticUnicorn
from picographics import PicoGraphics, DISPLAY_GALACTIC_UNICORN as DISPLAY

gu = GalacticUnicorn()
graphics = PicoGraphics(DISPLAY)

WHITE = graphics.create_pen(255, 255, 255)
BLACK = graphics.create_pen(0, 0, 0)

def draw_five(offset_x, offset_y, pen):
    five = [
        [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
        [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
        [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]
    ]

    graphics.set_pen(pen)
    for y, row in enumerate(five):
        for x, pixel in enumerate(row):
            if pixel:
                graphics.pixel(offset_x + x, offset_y + y)

def draw_fives():
    pen = graphics.create_pen(255, 0, 0)  # Red color
    spacing = 10  # Spacing between the "5" digits

    # Clear the display before drawing
    graphics.set_pen(BLACK)
    graphics.clear()

    # Draw the first "5"
    draw_five(0, 0, pen)

    # Draw the second "5"
    draw_five(spacing, 0, pen)

    # Draw the third "5"
    draw_five(spacing * 2, 0, pen)

    # Update the Galactic Unicorn display
    gu.update(graphics)

while True:
    draw_fives()
    time.sleep(1)  # Delay for 1 second before clearing and redrawing


I think this is what you need. It should be easy to add any extra symbols required at the end of the code.

# 11x8 Numeric Font with Pimoroni Galactic Unicorn

#       Tony Goodhew 12 March 2024

from galactic import GalacticUnicorn
from picographics import PicoGraphics, DISPLAY_GALACTIC_UNICORN
import time
from machine import Pin, I2C
import random

# create a PicoGraphics framebuffer to draw into
graphics = PicoGraphics(display=DISPLAY_GALACTIC_UNICORN)

# create our GalacticUnicorn object
gu = GalacticUnicorn()
#Define some colours
BLACK = graphics.create_pen(0, 0, 0)
RED =  graphics.create_pen(255, 0, 0)
YELLOW = graphics.create_pen(255, 255, 0)
GREEN = graphics.create_pen(0, 255, 0)
CYAN =  graphics.create_pen(0, 255, 255)
BLUE =  graphics.create_pen(0, 0, 255)
MAGENTA =  graphics.create_pen(255, 0, 255)
WHITE =  graphics.create_pen(200, 200, 200)
GREY =  graphics.create_pen(100, 100, 100)
DRKGRY =  graphics.create_pen(20, 20, 20)

colours =[RED,YELLOW,GREEN,CYAN,BLUE,MAGENTA,GREY] # List of colours

graphics.set_pen(BLACK)
graphics.clear()
gu.update(graphics)
graphics.set_pen(BLACK)

powers =[128,64,32,16,8,4,2,1]
code =[
    0b01111110, # 0
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b01111110,
    0b00001000, # 1
    0b00011000,
    0b00001000,
    0b00001000,
    0b00001000,
    0b00001000,
    0b00001000,
    0b00001000,
    0b00001000,
    0b00001000,
    0b01111110,
    0b01111110, # 2
    0b10000001,
    0b00000001,
    0b00000001,
    0b00000001,
    0b01111110,
    0b10000000,
    0b10000000,
    0b10000000,
    0b10000000,
    0b01111110,
    0b01111110, # 3
    0b10000001,
    0b00000001,
    0b00000001,
    0b00000001,
    0b01111110,
    0b00000001,
    0b00000001,
    0b00000001,
    0b10000001,
    0b01111110,  
    0b00000100, # 4
    0b00001100,
    0b00010100,
    0b00100100,
    0b01000100,
    0b10000100,
    0b11111110,
    0b00000100,
    0b00000100,
    0b00000100,
    0b00000100,      
    0b01111111, # 5
    0b10000000,
    0b10000000,
    0b10000000,
    0b10000000,
    0b01111110,
    0b00000001,
    0b00000001,
    0b00000001,
    0b10000001,
    0b01111110,
    0b01111110, # 6
    0b10000001,
    0b10000000,
    0b10000000,
    0b10000000,
    0b01111110,
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b01111110,
    0b11111111, # 7
    0b00000010,
    0b00000100,
    0b00001000,
    0b00010000,
    0b00010000,
    0b00100000,
    0b01000000,
    0b01000000,
    0b10000000,
    0b10000000,
    0b01111110, # 8
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b01111110,
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b01111110,
    0b01111110, # 9
    0b10000001,
    0b10000001,
    0b10000001,
    0b10000001,
    0b01111111,
    0b00000001,
    0b00000001,
    0b00000001,
    0b00000001,
    0b00000001,
    0b00011100, # deg
    0b00010100,
    0b00011100,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000, # colon
    0b00000000,
    0b00000000,
    0b00000000,
    0b00000000,
    0b00011000,
    0b00000000,
    0b00000000,
    0b00011000,
    0b00000000,
    0b00000000  
    ]

def draw_char(v,xoffset,colour):
    graphics.set_pen(colour)
    start = 11 * v
    for row in range(11):
        q = code[start + row]
        for x in range(8):            
            if q & powers[x] == powers[x]:
                graphics.pixel(x+xoffset, row)

graphics.set_pen(GREEN)
for value in range(12):
    draw_char(value,random.randint(0,45),BLUE)
    gu.update(graphics)
    time.sleep(1)
    graphics.set_pen(BLACK)
    graphics.clear()

gu.update(graphics)

n = 104783
ns = str(n)
l = len(ns)
for p in range(len(ns)):
    v = ord(ns[p])-48
    draw_char(v,9*p,GREEN)
gu.update(graphics)

time.sleep(20)
graphics.set_pen(BLACK)
graphics.clear()
gu.update(graphics)

Best wishes

2 Likes

Thanks Tony, I knew you were the man for this type of thing. Thumbs Up.

1 Like

I ended up getting a Cosmic Unicorn and got some nice BIG numbers! Thanks for the help, these things are fun.