OMEGA AND GREEK SYMBOL on OLED?

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
RainySun
 
Posts: 73
Joined: Thu Nov 18, 2021 2:55 pm

OMEGA AND GREEK SYMBOL on OLED?

Post by RainySun »

Hey, I am currently using ItsyBitsy nrf52840 and an OLED. I was able to print out letter on OLED, but I do not know how to print out Greek symbols such as OMEGA on OLED.
I was able to print the OMEGA symbol on REPL but doesn't work when printing on OLED.

Code: Select all

import time
import board
import busio
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_displayio_sh1106
displayio.release_displays()
i2c = busio.I2C(board.SCL, board.SDA)  # Create the I2C bus
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)  # OLED ADDRESS

# OLED
WIDTH = 130
HEIGHT = 64
BORDER = 5

display = adafruit_displayio_sh1106.SH1106(display_bus, width=WIDTH, height=HEIGHT)
view = displayio.Group()
display.show(view)
text_area = label.Label(
    terminalio.FONT, text="Connect", color=0xFFFFFF, x=15, y=HEIGHT // 2 - 1
)

view.append(text_area)

while True:
    text_area.text = "omega: \u03A9"
    time.sleep(0.2)

Attachments
OMEGA.JPG
OMEGA.JPG (21.1 KiB) Viewed 145 times

User avatar
neradoc
 
Posts: 542
Joined: Wed Apr 27, 2016 2:38 pm

Re: OMEGA AND GREEK SYMBOL on OLED?

Post by neradoc »

Hi,
The terminalio font only contains characters that are used by the Circuitpython firmware, you want to use a font file.
Here is a guide on making a font for use with displayio: https://learn.adafruit.com/custom-fonts ... on-display

There are some fonts in the guides, but it doesn't look like they include characters like Ω.
You can still find them by searching for .bdf or .pcf in the learn guide repo: https://github.com/adafruit/Adafruit_Le ... /find/main

(Note: it displays in the REPL, because that's on your computer, using your computer's fonts)

User avatar
RainySun
 
Posts: 73
Joined: Thu Nov 18, 2021 2:55 pm

Re: OMEGA AND GREEK SYMBOL on OLED?

Post by RainySun »

Hey, I was able to use an example from the website that you provided, and I was able to change the font, size but I still have the same issue where it does not print OMEGA symbol.
Not sure how to print OMEGA symbol.

User avatar
neradoc
 
Posts: 542
Joined: Wed Apr 27, 2016 2:38 pm

Re: OMEGA AND GREEK SYMBOL on OLED?

Post by neradoc »

I forgot there is the default Circuitpython font, before it is cleaned up to keep only the minimum characters, it contains more characters.
It's there: https://raw.githubusercontent.com/adafr ... r-u12n.bdf
I exported a pcf version that will be faster to load (but a bigger file)
https://www.neradoc.me/fonts/ter-u12n.pcf
Scale 5
Scale 5
IMG_1015.jpeg (166.68 KiB) Viewed 114 times
I also did manage to get Ω and other characters using the SourceSerifPro and Roboto fonts following the example from the guide, but they don't look great at size 16, and still take a lot of space since I didn't remove signs from it. There is some work to do to chose a font that looks good at a small size, or exporting it at a size that matches the desired output (and removing unused signs to reduce the file size).

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”