Are there any micropython examples for Pico showing large fonts?
Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
Are there any micropython examples for Pico showing large fonts?
#Write characters, size is the font size, the minimum is 1
#Write characters, size is the font size, the minimum is 1
def write_text(self,text,x,y,size,color):
''' Method to write Text on OLED/LCD Displays
with a variable font size
Args:
text: the string of chars to be displayed
x: x co-ordinate of starting position
y: y co-ordinate of starting position
size: font size of text
color: color of text to be displayed
'''
background = self.pixel(x,y)
info = []
# Creating reference charaters to read their values
self.text(text,x,y,color)
for i in range(x,x+(8*len(text))):
for j in range(y,y+8):
# Fetching amd saving details of pixels, such as
# x co-ordinate, y co-ordinate, and color of the pixel
px_color = self.pixel(i,j)
info.append((i,j,px_color)) if px_color == color else None
# Clearing the reference characters from the screen
self.text(text,x,y,background)
# Writing the custom-sized font characters on screen
for px_info in info:
self.fill_rect(size*px_info[0] - (size-1)*x , size*px_info[1] - (size-1)*y, size, size, px_info[2])
You can add this code to increase the font size, but this is the default pixel font and there is no other style.
report